ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Generate map with underwater sonar data

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

Josch gravatar image

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

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.

EDIT2:

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 = rospy.Time.now()

#.... 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
self.pointcloud2_pub.publish(msg_pointcloud2)

#Clock Publisher
self.clock_pub.publish(msg_header.stamp)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

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

goetz.marc gravatar image

when you already have a 3d pointcloud you could have a look at http://www.ros.org/wiki/octomap_server , 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
-->

<launch>
  <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" />
  </node>
</launch>
edit flag offensive delete link more

Comments

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 image Josch  ( 2013-07-30 01:15:04 -0500 )edit
2

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 image AHornung  ( 2013-07-30 01:17:52 -0500 )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 image Josch  ( 2013-07-30 01:23:06 -0500 )edit
2

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 image AHornung  ( 2013-07-30 01:30:31 -0500 )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 image Josch  ( 2013-07-30 01:39:20 -0500 )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 image Josch  ( 2013-07-30 03:57:09 -0500 )edit
1

Yes, or the header information of your point clouds.

AHornung gravatar image AHornung  ( 2013-07-30 03:59:29 -0500 )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 image Josch  ( 2013-07-30 05:02:45 -0500 )edit

Question Tools

2 followers

Stats

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

Seen: 1,583 times

Last updated: Jul 30 '13