How to set visualize-tag in ray

asked 2019-05-02 06:10:11 -0600

living_in_simulation gravatar image

Hi, I am currently writing my own ROS-laser-plugin because I want to have a multi-ray-laser that doesn't have multiple lines of horizontal rays but the rays should be arbitrary (for example an 8-figure).

I created a RayShapePtr using the following code-snippet:

// Create ray
gazebo::physics::RayShapePtr ray1 = boost::dynamic_pointer_cast<gazebo::physics::RayShape>(this->collision_ptr_->GetShape());
// Set start- and end-point to ray
ray1->SetPoints(start, end1);
// Add created ray to list
this->rays_.push_back(ray1);
...
// later on I get the intersection with the ray using the following code-snippet:
this->rays_[i]->GetIntersection(dist, entityName);

However, for debugging purposes I would like to visualize this ray in Gazebo just like the normal ray-plugin in Gazebo when I use the following tag in the urdf/sdf:

<visualize>true</visualize>

It seems that when I created the ray1 in the code above it doesn't get visualized like the rays I specified in the urdf/sdf using the following configuration:

<gazebo reference="my_laser_frame">
      <sensor type="ray" name="my_laser_link_sensor">
        <pose>0 0 0 0 0 0</pose>
        <visualize>true</visualize>
        <update_rate>5</update_rate>
        <ray>
          <scan>
            <horizontal>
              <samples>16</samples>
              <resolution>1</resolution>
              <min_angle>0.6</min_angle>
              <max_angle>-0.6</max_angle>
            </horizontal>
          </scan>
          <range>
            <min>0.10</min>
            <max>30.0</max>
            <resolution>0.01</resolution>
          </range>
          <noise>
            <type>gaussian</type>
            <mean>0.0</mean>
            <stddev>0.01</stddev>
          </noise>
        </ray>
        <plugin name="gazebo_ros_my_laser_controller" filename="lib_my_laser_plugin.so">
          <visualize>true</visualize>
          <robotNamespace>my_robot</robotNamespace>
          <frameName>my_laser_frame</frameName>
          <topicName>laser_topic</topicName>
          <updateRate>10</updateRate>
        </plugin>
      </sensor>
    </gazebo>

In short: The rays defined in the urdf are visualized in Gazebo but not my own programatically created RayShape (e.g. ray1) in the plugin-code. Does anyone have any idea how I can also visualize the programatically created RayShape in Gazebo?

Thanks in advance.

edit retag flag offensive close merge delete