-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buggy State Converter Rewrite #4
base: main
Are you sure you want to change the base?
Conversation
def other_raw_state_callback(self, msg): | ||
""" Callback for processing other/raw_state messages and publishing to other/state """ | ||
# Convert the /SC message and publish to other/state | ||
converted_msg = self.convert_SC_state(msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other_raw_state wouldn't be of type SC, it would be a separate type, (take a look at ros2bnyahaj and host2comm from original repo, specifically for the Odometry class, that is what you are converting to.
ecef_z = msg.pose.pose.position.z | ||
|
||
# Convert ECEF to UTM | ||
utm_x, utm_y, _ = self.ecef_to_utm_transformer.transform(ecef_x, ecef_y, ecef_z) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might as well take utm_z and use that (doesn't hurt, and no point removing data)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okayy sounds good
|
||
# Use euler_from_quaternion to get roll, pitch, yaw | ||
_, _, yaw = euler_from_quaternion([qx, qy, qz, qw]) | ||
yaw_aligned_east = yaw - np.pi / 2 # TODO: check if 0 is East |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quaternion and our internal heading should have the same heading, I wouldn't worry about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, take the other variables and it put into the function
_, _, yaw = euler_from_quaternion([qx, qy, qz, qw]) | ||
yaw_aligned_east = yaw - np.pi / 2 # TODO: check if 0 is East | ||
# Store the heading in the x component of the orientation | ||
converted_msg.pose.pose.orientation.x = yaw_aligned_east |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yaw is typically orientation.z, orientation.x, and orientation.y will be roll, pitch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the wiki said x so I just followed that, do we want to use z everywhere instead?
converted_msg.pose.pose.orientation.w = 0.0 | ||
|
||
# ---- 3. Copy Covariances (Unchanged) ---- | ||
# TODO: check whether covariances should be copied over or not sent at all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct, just uncomment it
|
||
# ---- 5. Copy Angular Velocities ---- | ||
converted_msg.twist.twist.angular.x = msg.twist.twist.angular.z # rad/s for heading change rate (using yaw from twist.angular) | ||
converted_msg.twist.twist.angular.y = 0.0 # ignored |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to ignore it, just copy it on over. more data, isn't a problem necessarily
converted_msg.pose.pose.position.z = 0.0 # ignored | ||
|
||
# ---- 2. Orientation in Radians with 0 at East ---- | ||
converted_msg.pose.pose.orientation.x = msg.pose.pose.orientation.x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again oreitnation.z but correct idea
converted_msg.pose.pose.orientation.w = 0.0 | ||
|
||
# ---- 3. Copy Covariances (Unchanged) ---- | ||
# TODO: check whether covariances should be copied over or not sent at all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We dont' get covariancs, so they will be initialized to whatever, don't comment it
return converted_msg | ||
|
||
# replaced custom function with tf_transformations library function | ||
def quaternion_to_yaw(self, qx, qy, qz, qw): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
appreciate you using your own function, but I'm unsure if it's correct. Can you instead use the function in this library from tf.transformations import euler_from_quaternion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, it’s using the library, that’s just some old code from earlier, I’ll remove it
converted_msg.twist.twist.linear.z = msg.twist.twist.linear.z # Keep original Z velocity (??) | ||
|
||
# ---- 5. Copy Angular Velocities ---- | ||
converted_msg.twist.twist.angular.x = msg.twist.twist.angular.z # rad/s for heading change rate (using yaw from twist.angular) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swap
# converted_msg.twist.covariance = msg.twist.covariance | ||
|
||
# ---- 4. Copy Linear Velocities ---- | ||
# TODO: check that ROS serial translator node changes scalar speed to velocity x/y components before pushing to raw_state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thsi is done on our side
What type of PR is this? (check all applicable)
Description
Rewrote/wrote a state converter node to convert
raw_state
to cleanstate
for both SC and NAND. Benefits: unit and format conversion not done in arbitrary files anymore.Related Tickets & Documents
QA Instructions, Screenshots, Recordings
Test this node by checking if the node converts raw values exactly as they were converted in pre-refactor code.
Added/updated tests?
We encourage you to keep the code coverage percentage at 80% and above.
NAND/self
,SC/self
, andSC/other
have not been included
[optional] Are there any post deployment tasks we need to perform?
raw_state
topics have to be created and published to[optional] What gif best describes this PR or how it makes you feel?