RTAB-Map + rosmon is not running twice

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

RTAB-Map + rosmon is not running twice

iprob
Hi,

I'm using RTAB-Map with ZED2 and ROS. The ZED2 is plugged in a Jetson Nano that is in the same network with my robot PC. The Jetson is properly publishing the image topics in the robot ROS master, and the robot is publishing its odometry. These topics are consumed by the RTAB-Map, which is running in a rosmon node that I start and stop when I want to create a new map using the rosmon start and stop services. When I start the node for the first time it goes well, but the problem is that if I stop it and in any moment start it again, the RTAB-Map does not map and this warning is prompted:

 [CommonDataSubscriber::warningLoop]: /robot/zed2/rtabmap: Did not receive data since 5 seconds! Make sure the input topics are published ("$ rostopic hz my_topic") and the timestamps in their header are set. If topics are coming from different computers, make sure the clocks of the computers are synchronized ("ntpdate"). If topics are not published at the same rate, you could increase "queue_size" parameter (current=10).
/robot/zed2/rtabmap subscribed to (approx sync):
             /robot/odom \
             /robot/zed2/zed_node/rgb/image_rect_color \
             /robot/zed2/zed_node/depth/depth_registered \
             /robot/zed2/zed_node/rgb/camera_info

I am using the same method to run a LOAM-based algorithm instead of RTAB-Map and this is not happening. The date and time in the jetson is synchronized so that should not be the problem, and it happens always the second time but not the first and the jetson node is always running. Maybe there is any kind of incompatibility between RTAB-Map and rosmon? Is there anyone that have used rosmon and RTAB-Map?

Thank you in advance,
Inés
Reply | Threaded
Open this post in threaded view
|

Re: RTAB-Map + rosmon is not running twice

matlabbe
Administrator
Hi Inés,

I never used rosmon, so not sure what it is doing when stopping and starting a node. If you want to pause rtabmap, it is possible to do so with the custom services: rosservice call /rtabmap/pause, rosservice call /rtabmap/resume.

Otherwise when this warning happens, check:
 rostopic hz /robot/odom \
             /robot/zed2/zed_node/rgb/image_rect_color \
             /robot/zed2/zed_node/depth/depth_registered \
             /robot/zed2/zed_node/rgb/camera_info 

to make sure they are all still published. If so, check if the header/timestamp of the messages are all in the same range.

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: RTAB-Map + rosmon is not running twice

iprob
Hi Mathieu,

Thank you for your answer.

They are all published and the timestamps are correct. I assume that the /rtabmap/pause and /rtabmap/resume services do not stop the map and start a new one, right? That's why I use rosmon, because I need to stop and start again from scratch.
However now I see that I could complete the pause and resume with the /rtabmap/reset, so maybe I can use that solution for now.

Cheers,
Inés

Reply | Threaded
Open this post in threaded view
|

Re: RTAB-Map + rosmon is not running twice

iprob
In reply to this post by matlabbe
Hi,

I discovered something about this issue. When I stop the node using rosmon, there are some parameters that are deleted from the ros parameter server like:

      subscribe_depth: false
      subscribe_odom_info: false
      subscribe_rgbd: false
      subscribe_scan: false
      subscribe_scan_cloud: true
      subscribe_stereo: true
      subscribe_user_data: false

 and others. Is there any configuration to avoid clearing the parameters when rtabmap stops?
Reply | Threaded
Open this post in threaded view
|

Re: RTAB-Map + rosmon is not running twice

iprob
In reply to this post by matlabbe
Hi again,

The destructor of the CommonDataSubscriber class does this:

        //clear params
        ros::NodeHandle pnh("~");
        pnh.deleteParam("subscribe_depth");
        pnh.deleteParam("subscribe_laserScan");
        pnh.deleteParam("subscribe_scan");
        pnh.deleteParam("subscribe_scan_cloud");
        pnh.deleteParam("subscribe_stereo");
        pnh.deleteParam("subscribe_rgb");
        pnh.deleteParam("subscribe_rgbd");
        pnh.deleteParam("subscribe_odom_info");
        pnh.deleteParam("subscribe_user_data");
        pnh.deleteParam("odom_frame_id");
        pnh.deleteParam("rgbd_cameras");
        pnh.deleteParam("depth_cameras");
        pnh.deleteParam("queue_size");
        pnh.deleteParam("approx_sync");
        pnh.deleteParam("stereo_approx_sync");

This is the reason why when I relaunch de same node without relaunching the launchfile with the configuration (using rosmon), they are removed and rtabmap doesn't run. A solution would be to add a parameter to choose if those parameters are deleted or not.
Reply | Threaded
Open this post in threaded view
|

Re: RTAB-Map + rosmon is not running twice

matlabbe
Administrator
Hi,

This is an old code added because of some issues I don't remember. Normally, the ROS way to tell ROS to clear parameters when a node exits, is to use clear_params argument. There are also other parameters here that are cleared. I would have to test the impact of removing the auto-clearing of private parameters.

On one of our system, we kill and relaunch the rtabmap launch file with always the parameters we want.

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: RTAB-Map + rosmon is not running twice

iprob
Hi Mathieu,

Thank you for your answer. The problem here is that rosmon kills the node and rerun it, but without relaunching the launchfile. We use rosmon to launch everything in our project, so if you find out if it is possible not to remove the parameters it would be great.

Thank you,
Inés
Reply | Threaded
Open this post in threaded view
|

Re: RTAB-Map + rosmon is not running twice

matlabbe
Administrator
This post was updated on .
Hi Inés,

I updated how parameters are handled with rtabmap nodes. The parameters won't be cleared if you don't launch the nodes with clear_params.

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: RTAB-Map + rosmon is not running twice

iprob
Perfect! But I get this "This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository." in that link and I can't clone that commit.
Reply | Threaded
Open this post in threaded view
|

Re: RTAB-Map + rosmon is not running twice

matlabbe
Administrator
Hi,

I modified the commit message afterwards, I updated the link, the commit is available from the master branch.
Reply | Threaded
Open this post in threaded view
|

Re: RTAB-Map + rosmon is not running twice

iprob
Ok, thank you so much!
Reply | Threaded
Open this post in threaded view
|

Re: RTAB-Map + rosmon is not running twice

iprob
In reply to this post by matlabbe
Hi Mathieu,

Sorry to bother you again. As the changes are in the master branch I had to uninstall rtabmap and install the one in the master from source, then clone the rtabmap_ros from the master branch too and compile, getting this errors:

/usr/local/lib/librtabmap_core.so: undefined reference to `gtsam::Marginals::Marginals(gtsam::NonlinearFactorGraph const&, gtsam::Values const&, gtsam::Marginals::Factorization, boost::optional<gtsam::Ordering const&>)'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/robot/new_faster_ws/devel/.private/rtabmap_ros/lib/rtabmap_ros/stereo_odometry] Error 1
make[1]: *** [CMakeFiles/rtabmap_stereo_odometry.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/usr/local/lib/librtabmap_core.so: undefined reference to `gtsam::Marginals::Marginals(gtsam::NonlinearFactorGraph const&, gtsam::Values const&, gtsam::Marginals::Factorization, boost::optional<gtsam::Ordering const&>)'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/robot/new_faster_ws/devel/.private/rtabmap_ros/lib/rtabmap_ros/icp_odometry] Error 1
make[1]: *** [CMakeFiles/rtabmap_icp_odometry.dir/all] Error 2
/usr/local/lib/librtabmap_core.so: undefined reference to `gtsam::Marginals::Marginals(gtsam::NonlinearFactorGraph const&, gtsam::Values const&, gtsam::Marginals::Factorization, boost::optional<gtsam::Ordering const&>)'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/robot/new_faster_ws/devel/.private/rtabmap_ros/lib/rtabmap_ros/rtabmap] Error 1
make[1]: *** [CMakeFiles/rtabmap.dir/all] Error 2
/usr/local/lib/librtabmap_core.so: undefined reference to `gtsam::Marginals::Marginals(gtsam::NonlinearFactorGraph const&, gtsam::Values const&, gtsam::Marginals::Factorization, boost::optional<gtsam::Ordering const&>)'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/robot/new_faster_ws/devel/.private/rtabmap_ros/lib/rtabmap_ros/rgbdicp_odometry] Error 1
make[1]: *** [CMakeFiles/rtabmap_rgbdicp_odometry.dir/all] Error 2
/usr/local/lib/librtabmap_core.so: undefined reference to `gtsam::Marginals::Marginals(gtsam::NonlinearFactorGraph const&, gtsam::Values const&, gtsam::Marginals::Factorization, boost::optional<gtsam::Ordering const&>)'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/robot/new_faster_ws/devel/.private/rtabmap_ros/lib/rtabmap_ros/rgbd_odometry] Error 1
make[1]: *** [CMakeFiles/rtabmap_rgbd_odometry.dir/all] Error 2
make: *** [all] Error 2


I think that this problem is similar to this https://github.com/introlab/rtabmap_ros/issues/456 but I think that the procedure is correct. I'm working on ubuntu 18.04 and ros melodic.
Reply | Threaded
Open this post in threaded view
|

Re: RTAB-Map + rosmon is not running twice

matlabbe
Administrator
Hi,

which gtsam version did you install? I didn't touch gtsam stuff on rtabmap side since a while ago...