Robotics StackExchange | Archived questions

Publish sensor data to cartographer

Hey, I'm working with google cartographer and I have a rgb camera. I have a topic where the PointCloud2 data is published to. It's /ifm3d/camera/cloud and I made my own node to publish this data to the cartographer. The cartographer has a topic where points2 is subscribing to. But my problem is that I don't know how to write the code to publish the sensor data to the cartographer. This is my code:

...
ros::init(argc,argv,"point_cloud_publisher);
ros::NodeHandle nh;

ros::Publisher pub_pointCloud = nh.advertise<sensor_msgs::PointCloud>("/points2",1000); 
sensor_msgs::PointCloud2 cloud;

So I have a camera and its publishing its data to the topic and I don''t know how to publish it to the cartographer.

Asked by S.Yildiz on 2018-09-10 03:35:59 UTC

Comments

If all you want is for Cartographer to be able to "read" the /ifm3d/camera/cloud topic then a remap might be more efficient. No need to republish a message just to connect two nodes together.

Asked by gvdhoorn on 2018-09-10 04:05:55 UTC

I thought the remap has the function to change the name of the topic

Asked by S.Yildiz on 2018-09-10 04:18:29 UTC

That is sort-of what it does yes.

If you don't need to do any processing on the /ifm3d/camera/cloud messages, but just want to forward them, I would advise to use a remap.

Asked by gvdhoorn on 2018-09-10 04:23:22 UTC

And how exactly do I have to do this? I have the subscriber points2. In which file?

Asked by S.Yildiz on 2018-09-10 04:30:47 UTC

First: please clarify: do you or do you not need to run your own algorithm on the cloud msgs coming in on /ifm3d/camera/cloud?

Asked by gvdhoorn on 2018-09-10 04:38:32 UTC

No I just want to forward them and don't need my own algorithm

Asked by S.Yildiz on 2018-09-10 04:43:15 UTC

And do I have to forward it to a publisher?

Asked by S.Yildiz on 2018-09-10 05:34:36 UTC

No I just want to forward them and don't need my own algorithm

Ok. In that case you should be able to use a remap.

You could do this either by making the ifm3d launch file remap to the topic that Cartographer expects (points2), or the other way around.

Asked by gvdhoorn on 2018-09-10 05:52:35 UTC

I'm not sure if I'm doing this correct points2 is already a topic that is published by the cartographer. https://google-cartographer.readthedocs.io/en/latest/ Here are the inputs which are awaited by cartographer. And points2 is a subscribed topic

Asked by S.Yildiz on 2018-09-11 06:23:07 UTC

Answers