introlab / rtabmap_ros

RTAB-Map's ROS package.
http://wiki.ros.org/rtabmap_ros
BSD 3-Clause "New" or "Revised" License
956 stars 557 forks source link

Running RTABMAP on Robot #1196

Open imranhussain14 opened 1 month ago

imranhussain14 commented 1 month ago

I am using a depthai camera (Model: OAK-D PRO POE-W) with the rtabmap for creating a map. but i am facing a problem in tf. as i am new to this field so i don't know whats the problem. I am following the below steps: 1: roslaunch robot_bringup robot_base_2.launch ( This launch file include the robot.urdf.xacro file and robot_state publisher and joint state publisher along with a node cansend_message which is used to send the CAN control message to robot for movement. 2: roslaunch depthai_examples stereo_inertial_node.launch 3: rosrun imu_filter_madgwick imu_filter_node imu/data_raw:=/stereo_inertial_publisher/imu imu/data:=/stereo_inertial_publisher/imu/data _use_mag:=false _publish_tf:=false 4: roslaunch rtabmap_launch rtabmap.launch args:="--delete_db_on_start" rgb_topic:=/stereo_inertial_publisher/color/image depth_topic:=/stereo_inertial_publisher/stereo/depth camera_info_topic:=/stereo_inertial_publisher/color/camera_info imu_topic:=/stereo_inertial_publisher/imu/data frame_id:=oak-d_frame approx_sync:=true wait_imu_to_init:=true After this my robot tf frames are broken and i got below in rviz. image

and when i set the argument fixed frame to base_footprint. then the camera and imu link is broken. i am not sure about this. can anyone help me regarding this? I am also uplaoding the frame.pdf frame_id_oak_d_frame.pdf frame_id_base_footprint.pdf

matlabbe commented 4 weeks ago

For rtabmap launch, you should use frame_id:=base_footprint to not break the tree. Not sure why camera and imu link are broken, because in your base_footprint tf tree, everything seems there.

imranhussain14 commented 3 weeks ago

Thank you for your reply @matlabbe , This is what happened in rviz when i launch the rtabmap.launch and set the fixed frame from base_footprint to map. Fixed frame to base_footprint: image Fixed Frame to map: image I am not sure about this like why this is happenening, even my transform trees are perfecr as attached above. Any suggestion or help from your side, i will be glad. Thank You

matlabbe commented 3 weeks ago

Is the camera upside down? Maybe there is a missing rotation in the URDF.

imranhussain14 commented 3 weeks ago

Thank You for your reply, I fix this by deleting the static transform in my robot_base launch file. My next plan is to use the rtabmap for the autonomous navigation. I already followed the "https://wiki.ros.org/rtabmap_ros/Tutorials/MappingAndNavigationOnTurtlebot" but it couldn't work for me. Can you kindly help me with this?.

matlabbe commented 3 weeks ago

The navigation demo didn't work? which step failed?

imranhussain14 commented 2 weeks ago

Actually, after creating the map. I am running the rtabmap in localization mode like

roslaunch rtabmap_launch rtabmap.launch \
    args:="--delete_db_on_start:=false" \
    rgb_topic:=/stereo_inertial_publisher/color/image \
    depth_topic:=/stereo_inertial_publisher/stereo/depth \
    camera_info_topic:=/stereo_inertial_publisher/color/camera_info \
    imu_topic:=/stereo_inertial_publisher/imu/data \
    frame_id:=base_footprint \
    approx_sync:=true \
    wait_imu_to_init:=true \
    localization:=true
    database_path:=/home/darlab/Maps/rtabmap.db

and then i am running the move_base node and then giving the goal using rviz but the robot is not moving. I am not sure weather I am doing the right way or not. Can you help me ?

here is my move_base launch file :+1: <?xml version="1.0"?>

imranhussain14 commented 2 weeks ago

@matlabbe Can you kindly help me . i still facing issues with navigation.

matlabbe commented 1 week ago
 <remap from="odom" to="/rtabmap/localization_pose"/>

That should be mapped to an odometry topic (in your case it seems the visual odometry topic /rtabmap/odom), not the output localization pose. If you launch rtabmap in localization mode, you don't need to launch a map_server at the same time. rtabmap will already publish the map. Just make sure to remap at the right place for move_base.

The scan_topic should be the original laser scan topic.

odom_frame is odom by default.

You may try turtlebot3 example on https://wiki.ros.org/rtabmap_ros/Tutorials/MappingAndNavigationOnTurtlebot to see how topics are connected and look also the TF tree (rosrun tf2_tools view_frames.py).

cheers, Mathieu

imranhussain14 commented 23 hours ago

@matlabbe , I followed the above tutorial but the robotis still not moving and rostopic echo /cmd_vel is not giving me any data. I am not sure is it the problrm with my map or the navigation algortithm. Secondaly, I am also not getting the good 2D map. i think this is the main problem. Iam not sure is it the problem with the camera sensor or the point cloud is not properly converting into laser scan. can you help me in this ? map1

Thank You

matlabbe commented 3 hours ago

Can you share the database? With stereo indoor, the default Grid/ parameters may not be the best for a clean occupancy grid. You could try with Grid/NormalsSegmentation=false (simple passthrough) with Grid/MaxGroundHeight=0.2, Grid/MaxObstacleHeight=1, Grid/3D=false and Grid/RayTracing.

imranhussain14 commented 3 hours ago

Here is the link of my database : https://drive.google.com/file/d/1enbrCAwQY-832kBlXwIbF-PYxLPLm6qT/view?usp=sharing I will ollow your guidlines and perform the algorithm again and will let you know about it. Thank you for your response.

matlabbe commented 2 hours ago

Peek 2024-09-12 19-57

It seems the frame_id is set on the camera, not the base of the robot. It seems roughly 1.5 meters over the ground. It will be easier to set the Grid ground height and obstacle height thresholds if the frame_id is a frame at ground level.

With current frame_id at camera height, I adjusted the parameters above to Grid/MaxGroundHeight=-1.2, Grid/MaxObstacleHeight=0.1. For the second session in the database: Before Screenshot from 2024-09-12 20-14-37

After Screenshot from 2024-09-12 20-14-20

Another issue is that it seems to have quite drift in roll/pitch and also in Z. Based on your original post, can I assume you are using visual odometry for rtabmap? I checked at the images, I don't know if I hallucinate this, but they don't look rectified. Here the beam doesn't look straight: image

If they still have distortion, visual odometry won't work well.

imranhussain14 commented 1 hour ago

Thank You for your reply, Should i give this parameters in my rtabmap.launch file? and i already set my frame_id= base_footprint for my rtabmap. but for the camera the base id is :

<arg name="parent_frame"         default="oak-d-base-frame" /> 

and then oak-d-base-frame" atatched to my base_link using static transform.

for the odometry, i am using the visual odometry from the rtabamap , rgbd_odom node. I am trying to better my odometry as well but i don't have any idea about it. Can you guide me how i do this.