Open sahilsaqi opened 6 months ago
The imu_filter_madgwick shouldn't publish the odom -> imu
transform. This is just for visualization/debugging. You can disable it like this:
rosrun imu_filter_madgwick imu_filter_node _use_mag:=false _publish_tf:=false
The odom -> imu
transform published by the IMU only contains the rotation, not the translation. On a wheeled robot, you need to use robot_localization
or something equivalent to fuse the IMU values and the wheel odometry to obtain a TF transform like this:
graph TD;
IMU-driver -->|/imu/data_raw| imu_filter_madgwick;
imu_filter_madgwick -->|/imu/data| robot_localization;
your-robot-driver -->|/odom| robot_localization;
robot_localization --> |tf-transform| hector_mapping;
... where the /odom
topic has the message type nav_msgs/Odometry, /imu/data_raw
and /imu/data
topics have type sensor_msgs/Imu, and the "tf-transform" is a TF transform like odom -> base_footprint
that is required (along with other TF transforms from the URDF) by hector_mapping.
The imu_filter_madgwick shouldn't publish the
odom -> imu
transform. This is just for visualization/debugging. You can disable it like this:rosrun imu_filter_madgwick imu_filter_node _use_mag:=false _publish_tf:=false
The
odom -> imu
transform published by the IMU only contains the rotation, not the translation. On a wheeled robot, you need to userobot_localization
or something equivalent to fuse the IMU values and the wheel odometry to obtain a TF transform like this:graph TD; IMU-driver -->|/imu/data_raw| imu_filter_madgwick; imu_filter_madgwick -->|/imu/data| robot_localization; your-robot-driver -->|/odom| robot_localization; robot_localization --> |tf-transform| hector_mapping;
... where the
/odom
topic has the message type nav_msgs/Odometry,/imu/data_raw
and/imu/data
topics have type sensor_msgs/Imu, and the "tf-transform" is a TF transform likeodom -> base_footprint
that is required (along with other TF transforms from the URDF) by hector_mapping.
okay I just tried this approach
you can see the graph below, but there is still some problem.
i have used the static transform publisher
instead of robot localization
because i am using hand held device so i don't have any wheeled robot
here i am providing the static publisher launch file.
<launch>
<node pkg="tf2_ros" type="static_transform_publisher" name="test_static_pub_imu" args="0 0 0 0 0 0 1 base_link imu" />
<!-- <node pkg="tf2_ros" type="static_transform_publisher" name="test_static_pub_lidar" args="0 0 0 0 0 0 0 base_link lidar" /> -->
<!-- Start the static tf publisher with a valid tf. There is a test
(tf_from_param_server_valid) that ensures the TF is published. -->
<rosparam param="test_tf2/tf_valid"
file="$(find test_tf2)/test/test_tf_valid.yaml" />
<node pkg="tf2_ros" type="static_transform_publisher"
name="test_static_pub_param_valid"
args="test_tf2/tf_valid" />
<!-- Start the static tf publisher with an *invalid* tf.
The main purpose of this test is to ensure the node dies gracefully. -->
<rosparam param="test_tf2/tf_invalid"
file="$(find test_tf2)/test/test_tf_invalid.yaml" />
<node pkg="tf2_ros" type="static_transform_publisher"
name="test_static_pub_param_invalid"
args="test_tf2/tf_invalid" />
<!-- Start the static tf publisher with a non-existent parameter.
The main purpose of this test is to ensure the node dies gracefully. -->
<node pkg="tf2_ros" type="static_transform_publisher"
name="test_static_pub_param_null"
args="test_tf2/tf_null" />
<test test-name="test_static_publisher" pkg="test_tf2"
type="test_static_publisher" args="--text" />
<test test-name="test_static_publisher_py"
pkg="test_tf2"
type="test_static_publisher.py"
launch-prefix="python$(env ROS_PYTHON_VERSION)"/>
</launch>
i am pretty sure that there is something wrong.
that is why I am getting drift on map while moving a bit or rotate the handheld device
these are my topics
aiot@ubuntu:~$ rostopic list
/ImuFilter/parameter_descriptions
/ImuFilter/parameter_updates
/clicked_point
/imu/data
/imu/data_raw
/initialpose
/map
/map_metadata
/map_updates
/move_base_simple/goal
/poseupdate
/rosout
/rosout_agg
/scan
/slam_cloud
/slam_out_pose
/syscommand
/tf
/tf_static
/trajectory
``
Also you can check my tree
So if you look at the hector_mapping documentation, you'll see the following:
<the frame attached to incoming scans> → base_frame
- usually a fixed value, broadcast periodically by a robot_state_publisher, or a tf static_transform_publisher.
... and:
~pub_map_odom_transform
(bool, default: true) -- Determine if the map->odom transform should be published by the system.
So it looks like in your case, you'll need the base_link
-> laser
transform, which you can publish via a static_transform_publisher
. Also, if you set the ~pub_map_odom_transform
parameter (or just leave it as default), hector_mapping
will publish map to odom, so you mustn't do that yourself.
Also, I don't see any option in hector_slam
to use IMU input, so you probably don't need this package here at all.
Anyway, this discussion has nothing to do with imu_tools
, so please ask any follow-up questions on https://robotics.stackexchange.com/.
Good luck!
I am using
Ros Noetic on Ubuntu 20.04 LTS
and I installed this library for integration of IMU (
mpu6050_driver
) with Hector SLAM. basically as you know mpu6050_driver provides/imu/raw/data
so I need to filter this using madgwick filter,so here is the steps I am taking
roscore
roslaunch rplidar_ros rplidar_a1.launch
roslaunch hector_slam_launch tutorial.launch
rosrun imu_filter_madgwick imu_filter_node _use_mag:=false
also my rostopics are
output of /imu/data
and i want to change the
frame id
of/imu/data
asimu_link
because the frame id's are same for/imu/data_raw
also so that it cannot create any buzz in the futurealso, you can check my tf graph
and Finally here is the output of the madgwick command
rosrun imu_filter_madgwick imu_filter_node _use_mag:=false
if you need any clarification please reply soon,
i need help here