Rajiv Bharadwaj
Rajiv Bharadwaj

Reputation: 103

Manually build an occupancy grid on ros

I am trying to build and publish a /nav_msgs/OccupancyGrid message to test another node that depends on actual data from a robot. Before I use real data, I just wanted to build a message from an array or matrix of numbers without any real sensors. How can I do that?

Thanks!

Upvotes: 2

Views: 6877

Answers (1)

Malefitz
Malefitz

Reputation: 417

If you have a look at the nav_msgs/OccupancyGrid message definition you will see that the data is just stored as an array of int8s with some MapMetaData. So if you just need something filled in to test the other node without any assumptions about usefulness or plausibility of the data you can write a script that fills in random data into the data structure.

If the data needs to be somewhat useful and plausible you probably should have a look at the Map Server package. It allows you to generate a nav_msgs/OccupancyGrid from an image. This approach might overall even be easier than generating random data.

Upvotes: 3

Related Questions