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

octomap_server doesn't create map

asked 2013-07-31 01:43:31 -0600

Josch gravatar image

updated 2013-07-31 02:04:25 -0600

I'm trying to let the octomap_server create a map from my Pointcloud2 messages. The pointcloud gets a transform, the header frame_id is correct and the header and the transform use the same timestamp.

But the octomap_server gives no output at all.

RViz visualizes the piontclouds correctly. Here is the code for generating the header and publishing the pointcloud/tf/clock.

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)

Here is my launch file for the octomap_server (credits to goetz.mark):

<!--
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.1" />
    <!-- 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="50.0" />
    <param name="latch" value="true" />
    <!-- max/min height for occupancy map, should be in meters -->
    <param name="pointcloud_max_z" value="100" />
    <param name="pointcloud_min_z" value="100" />
    <!-- topic from where pointcloud2 messages are subscribed -->
    <remap from="cloud_in" to="/sonar_pointcloud2" />
  </node>
</launch>

rqt_console error:

Nothing to publish, octree is empty

The node uses Groovy.

What am I doing wrong?

EDIT: The rqt_console error was due to a naming error in the launch file. I fixed this now, there are new errors now.

edit retag flag offensive close merge delete

Comments

Is there a reason why you are explicitly publishing /clock and setting seq in the header? I haven't seen that in any publishing code before...

AHornung gravatar image AHornung  ( 2013-07-31 01:55:48 -0600 )edit

is there any other way to publish /tf topic. If I am using pointcloud from kinect.

KDROS gravatar image KDROS  ( 2015-05-13 10:01:19 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-07-31 02:01:13 -0600

AHornung gravatar image

updated 2013-07-31 02:07:37 -0600

The error message mentions "target=/world", is that a global frame in your TF tree? Your params say that the frame should be called "/map". Have a look at your tree with rqt_tf_tree or view_frames.

A problem will be that you set pointcloud_min_z = pointcloud_max_z = 100 in the params. This will filter all your incoming point clouds to points that are only exactly at z=100. I guess min should be 0, or even below? This explains the error "Nothing to publish, octree is empty". octomap_server received a pointcloud, but it contained nothing that could be integrated into the octree.

edit flag offensive delete link more

Comments

Thanks for your help. I fixed the /map error right after I posted the question, but it didn't change anything. Setting the pointcloud_min_z and pointcloud_max_z to 0-1 made it working. Thank you very mich, that was a quick help!

Josch gravatar image Josch  ( 2013-07-31 02:11:11 -0600 )edit

Thank you for your answer! In my case, changing the "/map" into my "/base_footprint" works

hoporluo gravatar image hoporluo  ( 2019-10-25 04:20:32 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-07-31 01:43:31 -0600

Seen: 2,943 times

Last updated: Jul 31 '13