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

Range sensor does not detect objects in gazebo

asked 2018-05-20 14:11:10 -0600

Joep gravatar image

Hi,

I am new to ROS and try to create an urdf file to represent my robot in rviz and gazebo, but I can't get the range sensor to detect objects in the simulator. The message at /arduino/sensor/ir_left always reports 3.75 as range, which is the maximum. For test, I added a gpu_ray scanner and that shows the object just fine in rviz. Spinning the robot in place doesn't help either, so it's doesn't seem to be the sensor angle.

What's wrong? Or any suggestion on how to debug this further?

The sensor definition is below.

Thanks,
Joep

<gazebo reference="ir_left">        
   <sensor type="ray" name="ir_leftabc">
      <pose>0 0 0 0 0 0</pose>
      <update_rate>50</update_rate>
      <ray>
         <scan>
            <horizontal>
               <samples>1</samples>
               <resolution>1.0</resolution>
               <min_angle>-0.01</min_angle>
               <max_angle>0.01</max_angle>
            </horizontal>
            <vertical>
               <samples>1</samples>
               <resolution>1</resolution>
               <min_angle>-0.01</min_angle>
               <max_angle>0.01</max_angle>
            </vertical>
         </scan>
         <range>
            <min>0.01</min>
            <max>3.75</max>
            <resolution>0.02</resolution>
         </range>
      </ray>
      <plugin filename="libgazebo_ros_range.so" name="gazebo_ros_range">
         <gaussianNoise>0.005</gaussianNoise>
         <alwaysOn>true</alwaysOn>
         <updateRate>5</updateRate>
         <topicName>/arduino/sensor/ir_left</topicName>
         <frameName>ir_left</frameName>
         <visualize>true</visualize>
         <radiation>infrared</radiation>
         <fov>0.02</fov>
      </plugin>
   </sensor>            
</gazebo>
edit retag flag offensive close merge delete

Comments

If you want to use GPU laser plugin the filename of this plugin is called libgazebo_ros_gpu_laser.so IMO instead of libgazebo_ros_range.so. The library should be saved in /opt/ros/kinetic/lib location. Try to run gazebo in verbose mode to see if the plugin is loaded or not.

l4ncelot gravatar image l4ncelot  ( 2018-05-21 04:06:44 -0600 )edit

Btw this is ROS related forum. For the future post Gazebo related questions here.

l4ncelot gravatar image l4ncelot  ( 2018-05-21 04:07:48 -0600 )edit

Also the type of sensor should be gpu_ray instead of ray.

l4ncelot gravatar image l4ncelot  ( 2018-05-21 04:10:29 -0600 )edit

@i4ncelot - thanks for your reply! I'm trying to create a sensor_msgs/Range topic, not laserscan. Laserscan works okay. Tried to check the gazebo log at the location shown in the launch window. There are a few logfiles there, but none with gazebo in the name or with 'laser' or 'ray' in it.

Joep gravatar image Joep  ( 2018-05-21 09:26:08 -0600 )edit

My bad, I thought you wanted to use the gpu_ray sensor. I've tried your model and it works for me just fine when I subscribe to /arduino/sensor/ir_left topic. Can you edit your question with the launch file you use? Have you tried to launch gazebo with verbose option?

l4ncelot gravatar image l4ncelot  ( 2018-05-22 02:43:58 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2018-05-22 02:36:30 -0600

R. Tellez gravatar image

Hi Joep, I think I found what happens to your range ray. The configuration is correct but it is very likely that due to the way that you have created your robot, the range is colliding against itself. Either it is colliding against the collision mesh of the sensor itself or either against the body of the robot. I cannot say which one because you did not publish the whole URDF.

Anyway, I created a video about how to detect that. Check it out here: https://youtu.be/Qq4Xsl-n3nM

edit flag offensive delete link more

Comments

Wouldn't the sensor report something like ~0.05 range when colliding with itself as shown in your video?

l4ncelot gravatar image l4ncelot  ( 2018-05-22 02:59:38 -0600 )edit

Oh... if he has the collision box around the sensor greater than the max range it will return exactly the max range. I see it now.

l4ncelot gravatar image l4ncelot  ( 2018-05-22 03:03:45 -0600 )edit

Yes l4ncelot. You can see at minute 6:24 of the video how the rostopic echo is providing exactly that value, reporting the collision with itself

R. Tellez gravatar image R. Tellez  ( 2018-05-22 05:41:18 -0600 )edit

Hi Ricardo, thank you so much for your video. Very informative. Add it shows my code could work! However this is not the same issue. My sensor always reports 3.75 as range, which is the maximum. Is your robot model available for download? Would love to find out the differences with mine.

Joep gravatar image Joep  ( 2018-05-22 12:52:52 -0600 )edit

The simulation is of the ROS Live Class that we do every Tuesday 18:00CEST online (open to anyone https://youtu.be/ajgwQ_lGFL4 ). In order to get it, create a free account at rds.theconstructsim.com and afterwards, click this link: https://goo.gl/rAovtd That will copy my project to your RDS account.

R. Tellez gravatar image R. Tellez  ( 2018-05-22 13:53:58 -0600 )edit
0

answered 2018-08-09 21:28:28 -0600

FerdeLance gravatar image

Just adjust the minimum value of the range sensor to match the collision box. In this example I changed the min range to 0.1.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-05-20 14:11:10 -0600

Seen: 4,019 times

Last updated: Aug 09 '18