-
Notifications
You must be signed in to change notification settings - Fork 121
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
Fix imu 2d transform #268
base: devel
Are you sure you want to change the base?
Fix imu 2d transform #268
Conversation
Please let me know why the checks have failed, so I can look into it. |
sensor_msgs::Imu imu_transformed; | ||
try | ||
{ | ||
tf_buffer_.transform(*msg, imu_transformed, params_.twist_target_frame); |
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.
There are currently multiple target frames supported:
https://github.com/locusrobotics/fuse/blob/devel/fuse_models/include/fuse_models/parameters/imu_2d_params.h#L99-L101
...though I'm not entirely sure why. I would think that both the twist and acceleration would want to use the same target/body frame.
And it's been a long time since I thought about IMUs, but my recollection is that transforming the IMU pose is complicated. I need to review the imu_transformer package in detail. It was not clear to me how the orientation was being transformed.
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.
Yes, that's something I wanted to discuss in this PR and I forgot to mention it.
Right now there are three different target frames:
acceleration_target_frame
orientation_target_frame
twist_target_frame
However, the implementation in imu_transformer transforms everything in the IMU all at once with a single target frame.
I wonder if it really makes sense to have multiple target frames. 🤔
In that case, we could call the imu_transformer
code three times and only take the components we're interested in, with each target frame. However, in that case, it'd be more efficient, and I believe still clean, to steal some of the code in imu_transformer to perform the same transformation for each component separately.
I believe the twist is already done correctly, and probably the acceleration as well. The orientation is definitely incorrect.
Just let me know whether you want to keep the three target frames or not, and I'll make the changes mentioned above?
If we remove the existing target frames and create a singal target_frame
, then we need some deprecation warnings, and set the new target_frame
with them. In that case, if the different target frames aren't the same, I'm not sure which one should be used. I've been using twist_target_frame
in this initial implementation.
pinging on this, so I can have a look at fixing the PR checks |
Three of the four checks are from the actual ROS build farm, right? Won't those have the details? |
https://build.ros.org/job/Mpr__fuse__ubuntu_bionic_amd64/31/consoleFull I believe you can see that one too.
|
I thought I couldn't access those. Thanks. I've fixed a couple of compilation issues. Hopefully after that all checks pass. 🤞 |
|
I just fixed the roslint issues |
0bb6b9e
to
f10d102
Compare
Also fixes transformed twist covariance not being used in differential mode when using the twist covariance.
f10d102
to
0dbc4ad
Compare
Fix IMU transform
Also fixes transformed twist covariance not being used in differential
mode when using the twist covariance.
This is on top of #267, fixing the rostest provided in that PR.
I think the IMU data needs to be handled differently than all other pose/twist/odometry measurements when used in differential mode to create relative constraints. Indeed, in https://github.com/cra-ros-pkg/robot_localization/blob/b5345749e1449a5ec3536d3c8cc80f1de65ae9f6/src/ros_filter.cpp#L2563-L2955 the IMU is handled differently when its data has to be transformed to a different frame. However, I've used the implementation in https://github.com/ros-perception/imu_pipeline/blob/ec36441c5c0cf1e63c12731a3a59185d29a00979/imu_transformer/include/imu_transformer/tf2_sensor_msgs.h#L80-L121, which is way simpler and seems to fix the issue.