Ask Your Question

Generate map with underwater sonar data

asked 2013-07-29 23:22:43 -0600

Josch gravatar image

updated 2013-07-30 04:58:52 -0600

I would like to create a map with underwater sonar intensity data. What I did so far was creating a pointcloud2 message from the intensity data, with a simple threshold for the intensities. Due to the nature of an underwater sonar, the Pointclouds are quite noisy.

Since I am relatively new to ROS Navigation, I have no idea how to generate a 2D/3D map from this data. Are there any tutorials for map generation in ROS? Which are most suitable for this kind of sonar data?

Any advices or directions are welcome.

The node is running on Groovy with Ubuntu 12.04 LTS.


self.pointcloud2_pub = rospy.Publisher('/sonar_pointcloud2', smsgs.PointCloud2, latch=True)
self.clock_pub = rospy.Publisher('/clock', rgmsgs.Clock, latch=True)

#Create Header
msg_header = stdmsgs.Header()
msg_header.seq = self.incId
self.incId += 1
msg_header.frame_id = "/sonar_pointcloud2"
msg_header.stamp =

#.... filling the Pointcloud
#.... calculating new position and quaternion

#Transform Broadcaster
br.sendTransform((self.pose.x, self.pose.y, self.pose.z), (quat[0], quat[1], quat[2], quat[3]), msg_header.stamp, "/sonar_pointcloud2", "/map")

#Pointcloud2 Publisher

#Clock Publisher
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-07-29 23:48:23 -0600

goetz.marc gravatar image

when you already have a 3d pointcloud you could have a look at , just give this node your pointcloud2-msgs and it will generate a 2D and 3D map out of it (the 2d map is just the downprojected 3d map)

just do an apt-get install ros-groovy-octomap*

example launch file:

firing up the octomap server to generate 2D/3D occupancy maps

  <node pkg="octomap_server" type="octomap_server_node" name="octomap_server">
    <!-- resolution in meters per pixel -->
    <param name="resolution" value="0.05" />
    <!-- name of the fixed frame, needs to be "/map" for SLAM -->
    <param name="frame_id" type="string" value="/map" />
    <!-- max range / depth resolution of the kinect in meter -->
    <param name="sensor_model/max_range" value="4.0" />
    <param name="latch" value="true" />
    <!-- max/min height for occupancy map, should be in meters -->
    <param name="pointcloud_max_z" value="1.75" />
    <param name="pointcloud_min_z" value="0.1" />
    <!-- topic from where pointcloud2 messages are subscribed -->
    <remap from="cloud_in" to="/camera/depth_registered/points" />
edit flag offensive delete link more


Thank you for the fast answer, the launch file was a good start. I set all the options to fit the 120x500 Pointcloud in a 50m range. Unfortunately I don't receive any binary octomaps. Rxgraph also says that the correct topics are linked. What i don't understand: How does Octomap get the transforms?

Josch gravatar imageJosch ( 2013-07-30 01:15:04 -0600 )edit

You need to provide the transforms via tf, from your sensor origin to the map frame. OctoMap won't do the full SLAM for you.

AHornung gravatar imageAHornung ( 2013-07-30 01:17:52 -0600 )edit

I think i already provide the correct tf. /map ist the fixed frame, /tf1 is child from /map and /tf2 is child from /tf1. When visualized in RViz I can see the tf's moving around like they should. Is there any way I can any error messages from the octomap node, to see what's wrong? What about /clock?

Josch gravatar imageJosch ( 2013-07-30 01:23:06 -0600 )edit

Fire up rxconsole or rqt_console and have a look at the debug output. Otherwise check the octomap_server wiki page on how to display the octomap directly in RViz. You definitely need /clock and tf correct, since there's a message filter running.

AHornung gravatar imageAHornung ( 2013-07-30 01:30:31 -0600 )edit

Okay, tf/pointcloud2/clock all have synchrone time stamps now, nothing changed though. I will have a look at rqt_console and rxconsole, thank you.

Josch gravatar imageJosch ( 2013-07-30 01:39:20 -0600 )edit

rqt_console says that the MessageFilter [target=/odom_combined] dropped 100% of messages so far. Does that mean that my tf and clock are wrong?

Josch gravatar imageJosch ( 2013-07-30 03:57:09 -0600 )edit

Yes, or the header information of your point clouds.

AHornung gravatar imageAHornung ( 2013-07-30 03:59:29 -0600 )edit

I added the important parts of my code to the main post. Maybe I am already too used to my code to see the mistake, i'd be grateful if you could have a look at it. Is it okay to use the same timestamp for all messages?

Josch gravatar imageJosch ( 2013-07-30 05:02:45 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2013-07-29 23:22:43 -0600

Seen: 1,112 times

Last updated: Jul 30 '13