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

Josch's profile - activity

2021-03-17 19:23:39 -0500 received badge  Good Question (source)
2018-07-10 02:31:22 -0500 received badge  Good Answer (source)
2017-12-11 08:35:38 -0500 received badge  Guru (source)
2017-12-11 08:35:38 -0500 received badge  Great Answer (source)
2017-10-18 01:43:59 -0500 marked best answer Get cone from occupancy grid

Hello everyone,

Is there any built in method to get the range data in a cone-format from a nav_msgs/OccupancyGrid message?

I am using the Octomap package with the octomap_server on Groovy, with Python.

2016-09-02 22:22:29 -0500 received badge  Nice Question (source)
2016-09-02 22:22:14 -0500 received badge  Nice Answer (source)
2015-05-28 22:25:27 -0500 marked best answer Is there a VFH* Implementation for ROS?

Hi everyone,

I am looking for an implementation of the VFH* Algorithm for local obstacle avoidance. Is there any?

Best regards,

2014-11-18 16:48:51 -0500 received badge  Necromancer (source)
2014-01-30 12:57:37 -0500 received badge  Notable Question (source)
2014-01-30 12:57:37 -0500 received badge  Famous Question (source)
2014-01-28 17:31:22 -0500 marked best answer octomap_server doesn't create map

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.

2014-01-28 17:31:21 -0500 marked best answer Generate map with underwater sonar data

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)
2014-01-28 17:31:12 -0500 marked best answer Segmentation fault while visualizing own PointCloud2 Message

Hi everyone,

I wrote a python class which should convert an 2D-Array with intensities to a Pointcloud an publish it. Unfortunately RViz crashes, as soon as it should show something. The error is the following:

Segmentation fault (Memory image written) (Translation is hand done and may be vague)

Is there any tutorial how to correctly generate a PointCloud2 message in Python? If not, is somebody able to give me a simple short code block how to do it? I feel like I missed something....

This is the class description:

sensor_msgs/PointCloud2

Python conversion to bits

This is the python class: #!/usr/bin/env python

import sensor_msgs.msg as smsgs
import std_msgs.msg as stdmsgs
import math as m
import tf

POINTCLOUD_TOPIC = 'sonar'
NODE_NAME = 'adapter'

class Adapter():
    def receive(self):
        self.sonarToPointfield()

    def sonarToPointfield(self):

        #  Create Header
        msg_header = stdmsgs.Header()
        msg_header.seq = 1
        msg_header.frame_id = "/map"
        msg_header.stamp = rospy.Time.now()

        #  Create 4 PointFields as channel description
        msg_pf1 = smsgs.PointField()
        msg_pf1.name = 'x'
        msg_pf1.offset = 0
        msg_pf1.datatype = 7
        msg_pf1.count = 1

        msg_pf2 = smsgs.PointField()
        msg_pf2.name = 'y'
        msg_pf2.offset = 4
        msg_pf2.datatype = 7
        msg_pf2.count = 1

        msg_pf3 = smsgs.PointField()
        msg_pf3.name = 'z'
        msg_pf3.offset = 8
        msg_pf3.datatype = 7
        msg_pf3.count = 1

        msg_pf4 = smsgs.PointField()
        msg_pf4.name = 'intensity'
        msg_pf4.offset = 12
        msg_pf4.datatype = 2
        msg_pf4.count = 1

        resultList = [2.0, 3.0, 4.0, 1, 5.0, 6.0, 7.0, 2]
        resultList = [0, 0, 0, 200]

        #  len(resultList) / 4 is the number of points, since every point consists of 4 elements
        #  one point representation (x=FLOAT32, y=FLOAT32, z=FLOAT32, intensity=UINT8) is 13 bytes long
        resultList2 = []
        resultArray = np.zeros((len(resultList) / 4) * 13, dtype=np.ubyte)
        print "len(resultArray): ", len(resultArray)
        for x in range(0, len(resultList)-1, 4):
            tmpArr = np.zeros(13, np.ubyte)
            print "Coords: " + str(resultList[x+0]) + ", " + str(resultList[x+1]) + ", " + str(resultList[x+2]) + ", " + str(resultList[x+3])
            struct.pack_into('fffB', tmpArr, 0, resultList[x+0], resultList[x+1], resultList[x+2], resultList[x+3])
            print "tmpArr: ", tmpArr
            for i in range(len(tmpArr)):
                resultList2.append(tmpArr[i])
                resultArray[((x/4)*13)+i] = tmpArr[i]

        #  Create PointCloud2 instance
        msg_pointcloud2 = smsgs.PointCloud2()

        #  Fill message
        msg_pointcloud2.header = msg_header
        msg_pointcloud2.fields = [msg_pf1, msg_pf2, msg_pf3, msg_pf4]
        msg_pointcloud2.data = resultList2
        msg_pointcloud2.width = len(resultList2)
        msg_pointcloud2.height = 1
        msg_pointcloud2.point_step = 13
        msg_pointcloud2.row_step = 1560
        msg_pointcloud2.is_dense = False
        msg_pointcloud2.is_bigendian = True

        self.publishPointCloud2(msg_pointcloud2)

    def publishPointCloud2(self, msg_pointcloud2):
        self.pub.publish(msg_pointcloud2)
        self.publishWorldFrame()

    def publishWorldFrame(self):
        br = tf.TransformBroadcaster()
        br.sendTransform((0, 0, 0), (1, 1, 1, 1), rospy.Time.now(), "/sonar_pointcloud", "/map")

    def init(self):
        self.pub = rospy.Publisher('sonar_pointcloud', smsgs.PointCloud2)
        rospy.init_node('pcl_adapter')
        self.receive()

if __name__ == '__main__':
    adapter = Adapter()
    adapter.init()

Thank you in advance, Josch

2014-01-28 17:30:18 -0500 marked best answer ROSSerializationException while publishing PointCloud2 Message

Hello everyone,

when my node is publishing a PointCloud2 message I get the following error:

Traceback (most recent call last):
  File "/home/rosuser/ros_workspace/src/udp_83b_adapter_eclipse_python/src/UDP83BAdapter.py", line 141, in <module>
    adapter.init()
  File "/home/rosuser/ros_workspace/src/udp_83b_adapter_eclipse_python/src/UDP83BAdapter.py", line 137, in init
    self.receive()
  File "/home/rosuser/ros_workspace/src/udp_83b_adapter_eclipse_python/src/UDP83BAdapter.py", line 43, in receive
    self.sonarToPointfield()
  File "/home/rosuser/ros_workspace/src/udp_83b_adapter_eclipse_python/src/UDP83BAdapter.py", line 128, in sonarToPointfield
    self.pub.publish(msg_pointcloud2)
  File "/opt/ros/groovy/lib/python2.7/dist-packages/rospy/topics.py", line 801, in publish
    raise ROSSerializationException(str(e))
rospy.exceptions.ROSSerializationException: field fields[].offset must be unsigned integer type

The message is completely generated by my python script. Here is the fields declaration and initialization:

    #  Create 4 PointFields as channel description
    msg_pf1 = smsgs.PointField()
    msg_pf1.name = np.str('x')
    msg_pf1.offset = np.uint32(0)
    msg_pf1.datatype = np.uint8(7)
    msg_pf1.count = np.uint32(1)

    msg_pf2 = smsgs.PointField()
    msg_pf2.name = np.str('y')
    msg_pf2.offset = np.uint32(4)
    msg_pf2.datatype = np.uint8(7)
    msg_pf2.count = np.uint32(1)

    msg_pf3 = smsgs.PointField()
    msg_pf3.name = np.str('z')
    msg_pf3.offset = np.uint32(8)
    msg_pf3.datatype = np.uint8(7)
    msg_pf3.count = np.uint32(1)

    msg_pf4 = smsgs.PointField()
    msg_pf4.name = np.str('intensity')
    msg_pf4.offset = np.uint32(12)
    msg_pf4.datatype = np.uint8(2)
    msg_pf4.count = np.uint32(1)

And somewhere later in the code:

    msg_pointcloud2.fields = [msg_pf1, msg_pf2, msg_pf3, msg_pf4]

I'm using python/rospy. Another strange thing: I can run the script. As soon as I try to access the message (e.g. via rostopic echo) the error comes up.

Does anybody have a idea why this is happening? What can I try to debug?

2014-01-28 17:29:40 -0500 marked best answer Set RViz laserscan decay time

I am writing an RViz plugin which allows the user to play rosbags and also let's him pause the playing. The problem with pausing is that the decay time is still the same, so pointcloud data will exceed the decay time even if they should stay while the playing is paused.

There is a RViz display plugin tutorial, but it only describes how to create new displays.

Does anybody know how to programmatically change the decay time of this display? Or is there another possibility to hold the current message?

EDIT: I need this node to work on fuerte and Ubuntu 12.04 LTS.

2014-01-28 17:29:28 -0500 marked best answer How can i use my own rosbag version

Hi,

I need to be able to set the duration for a rosbag play command. This feature is not implemented in rosbag yet, there is a pull request though.

Since I need this feature now I would either have to stop the rosbag play process at an given time or I would have to implement it in my own rosbag branch. When I am using my own rosbag branch I will also have to install this custom branch on other computers which will use my package.

Is there a nice way to do any of this?

2014-01-28 17:29:23 -0500 marked best answer Set RViz camera/view on fuerte

Hi,

I'm writing a RViz plugin which allows the user to play rosbags and record them. During playing the rosbags I would like to make it possible to do a tracking shot in the scene. Therefore I have to set the current view in RViz.

Is there a possibility to do this programmatically?

There are some articles which say it is possible with a RViz plugin, but it's never explained anywhere. If it is not possible in a single plugin, is it possible via librviz?

Thanks in advance, best regards, Josch.

EDIT: The node should run on fuerte and Ubuntu 12.04 LTS.

EDIT 2: New question: How do I get an instance from the VisualizationManager? Creating my own one requires a RenderPanel and a WindowManagerInterface-implementing class.

2014-01-28 17:29:12 -0500 marked best answer Using rosbag c++ code API

Hello everyone,

I am trying to use the rosbag C++ code API in my own node. For that I need to refer to the rosbag sources (rosbag::Bag etc.). By default only the binaries from rosbag were installed. So I cloned the ros_comm git into my local ros stack ros_comm. Now the stack contains the src files, but I still can't refer to them in my eclipse project for the node.

Where do I have to put the source files from rosbag to let Eclipse and the maker recognize them?

One solution would be to include them via their absolute path, but don't feel like this would be a good solution.

Best regards, Josch

2014-01-28 17:28:39 -0500 marked best answer Laserscan bag to film

Hi everyone,

i'm looking for a method to automatically generate films from laserscan bags. Important is that it's also possible to set the camera perspective.

So far i've been thinking about extracting PCD files, extracting images from the PCD file and stringing them together. But i didn't find any possibility to use my own camera perspective for taking the picture.

Does anyone have any idea how to do this? Except writing a hole new engine... Does OpenCV maybe offer some useful methods for that?

2014-01-26 18:53:21 -0500 received badge  Favorite Question (source)
2014-01-13 09:22:26 -0500 received badge  Taxonomist
2013-11-14 11:22:52 -0500 received badge  Enlightened (source)
2013-11-02 10:02:09 -0500 received badge  Famous Question (source)
2013-11-01 08:43:55 -0500 received badge  Popular Question (source)