Publish sensor data to cartographer

asked 2018-09-10 03:35:59 -0500

S.Yildiz gravatar image

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.

edit retag flag offensive close merge delete

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.

gvdhoorn gravatar imagegvdhoorn ( 2018-09-10 04:05:55 -0500 )edit

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

S.Yildiz gravatar imageS.Yildiz ( 2018-09-10 04:18:29 -0500 )edit
2

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.

gvdhoorn gravatar imagegvdhoorn ( 2018-09-10 04:23:22 -0500 )edit

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

S.Yildiz gravatar imageS.Yildiz ( 2018-09-10 04:30:47 -0500 )edit

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?

gvdhoorn gravatar imagegvdhoorn ( 2018-09-10 04:38:32 -0500 )edit

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

S.Yildiz gravatar imageS.Yildiz ( 2018-09-10 04:43:15 -0500 )edit

And do I have to forward it to a publisher?

S.Yildiz gravatar imageS.Yildiz ( 2018-09-10 05:34:36 -0500 )edit

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.

gvdhoorn gravatar imagegvdhoorn ( 2018-09-10 05:52:35 -0500 )edit