whoobee / sensor_odom_manager

Intel Realse tf/odom transform fix for differential drive robot
MIT License
9 stars 2 forks source link

Question for detail description of offsets #2

Open jaykorea opened 2 years ago

jaykorea commented 2 years ago

First of all , Really big thanks to your easy library for odom transformation

However, I need a little bit more detail description of the param "offsets"

I'm using t265 odometry with my robot, and How can I set the offset to transform base foot print to fix to the map coordination "z = 0"

Below is my rviz robot tf links 1

I want to set base_footprint link to center of the robot , and t265 is fixed to the robot upside the base footprint about 50cm

Thanks!

jaykorea commented 2 years ago

As I test your library with t265 odom, found out something went wrong.

As the robot rotates in place, roll and pitch drift occurs and it keeps pitching and rolling up down to oneside.

would u mind check out for this bug?

Thank you

whoobee commented 2 years ago

Hello @jaykorea , sorry for the delayed response. In order to set your T265 camera with an offset you need to setup the argument sensor_offset with the x,y and z values. The value has to be written in a json format.

Here is an example of the camera being mounted on the robot with an translation offset of X=0.3m (the camera is mounted with 30cm in front of the robot), y=0m (so centered to the robot) and z=0.21m (so the camera is mounted with a height of 21 cm from the base of the robot)

<!-- sensor offset values are in meters -->
<arg name="sensor_offset"         default='{"x": 0.307, "y": 0.000, "z": 0.210}'/>

_You can check the example launch file which is actually used by me (https://github.com/whoobee/sensor_odom_manager/blob/master/launch/sensor_odom_manager.launch)_

Please keep in mind that the xyz axes of the T265 and the ROS axes are different. In this configuration you should consider the ROS standard axes (where z is up). So if I understand right, your camera is actually mounted with a z offset giving the fact that normally the base_link is considered with z=0.

Regarding your other concern, when the camera pitch drifts, I would suspect that this is an issue from the T265 itself. The camera T265 it is notoriously known for its drift, especially when high frequency oscillations are introduced to the sensor. This is why in all cases of wheeled based robots, Intel suggests to have the wheel encoders odom topic feed into the T265 itself. Please check out this thread from Realsense: https://github.com/IntelRealSense/librealsense/issues/5047 or try to browse a bit on the realsense Github issue list for a possible explanation. I checked a bit the code, and I cannot see any reason for potential drifts, this small package is nothing more than taking the odometry TF from the camera and it translates it or rotates it with respect to the values provided in the sensor_offset and sensor_rotation parameters.