0
$\begingroup$

I have build a robot with a urdf to visualize in gazebo. After some struggle being new to gazebo I got it working. I then decided to make a video series for myself and others on how I did it.

Sadly the new urdf's "ray" plugin taking from gazebo wiki won't play nice. The laser visualize and the rostopic echo the laser but the laser cuts through everything so it publishes inf for all data point on "echo rostopic".I went online but could not fix it.

Note laser through bin and pump

Spawning this "test" bot in the other working robot workspace heralds the same result. for the live of me I can't see why?

<link name="laser_link">
<visual>
    <geometry>
        <cylinder radius="0.02" length="0.05"/>
    </geometry>
    <material name="Blue">
        <color rgba="0.31 0.18 2.07 1.0"/>
    </material>
</visual>
<collision>
    <geometry>
        <cylinder radius="0.02" length="0.05"/>
    </geometry>
</collision>
<inertial>
    <mass value="0.002"/>
    <inertia ixx="0.000015417" ixy="0.0" ixz="0.0" iyy="0.000015417" iyz="0.0"  izz="0.000004"/> 
    <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
</inertial>
</link>

<joint name="laser_joint" type="fixed">
   <parent link="base_link"/>
   <child link="laser_link"/>
   <origin xyz="0 0.0 0.275" rpy="0 0 0"/>
<!--axis xyz="0 0 0"/-->
</joint>

<gazebo reference="laser_link">
     <sensor type="ray" name="LD06_laser">
         <pose>0 0 0 0 0 0</pose>
         <visualize>true</visualize>
         <update_rate>20</update_rate>
     <ray>
        <scan>
            <horizontal>
                <samples>362</samples>
                <resolution>1</resolution>
                <min_angle>-3.141592654</min_angle>
                <max_angle>3.141592654</max_angle>
            </horizontal>
        </scan>
        <range>
            <min>0.02</min>
            <max>12.0</max>
            <resolution>0.01</resolution>
        </range>
    </ray>
    <plugin name="laser_controler" filename="libgazebo_ros_laser.so">
        <topicName>/scan</topicName>
        <frameName>laser_link</frameName>
    </plugin>
</sensor>
</gazebo>

Any help appreciated.

Used the plugin from here:plugin from tutorial and using a roslaunch file from here:the launch file used

Heres the buggy urdf: buggy laser The working urdf: working urdf the ros_launch files for both are the same only the path to urdf's are different and both loads the gas station or willows garage just fine. the Buggy laser does have a 2/3 second black screen before loading where working one loads up instantly.

incase the launch files: faulty laser launch and working laser launch

$\endgroup$
6
  • $\begingroup$ Welcome to Robotics, TK noob. Can you please edit your question to add a link to the plugin in question? I tried briefly to look for it online and only found this question lol. How are you adding the other scenery to your world? It could also be that you're missing colliders on those objects, causing them to appear invisible to the laser in simulation. $\endgroup$
    – Chuck
    May 18, 2023 at 19:30
  • $\begingroup$ Hi Chuck, sorry for not responding sooner but was sick (covid). Sorry I have updated as requested. When driving the bot around it collides with walls and so on, it's only the lidar that plays up. $\endgroup$
    – TK noob
    May 24, 2023 at 0:33
  • $\begingroup$ You said the plugin works fine in one URDF but not in another. What's the difference between the two? The files you've provided aren't actually files, but tutorials, and I can't tell what you've taken from those pages. Can you please edit your post to include the file that works and the one that doesn't? You can just paste the contents in here with a code tag (from the text editor options) or you can link to a service like textbin. $\endgroup$
    – Chuck
    May 24, 2023 at 12:12
  • $\begingroup$ "What's the difference between the two? " I have tried to figure that out and come up with nothing. Spend hours on it, copy pasted between them, changed structure around, used same naming conventions .... I am at a loss $\endgroup$
    – TK noob
    May 25, 2023 at 0:02
  • $\begingroup$ Best troubleshooting advice I could give then is to use the one that works. Make one change at a time until it stops working. I checked your URDF files with BeyondCompare and there's a lot that's changed between the two, which is making it hard to compare 1:1. One thing I noticed is that your launch files are referencing two different environments, and my earlier comment was that it could be a mesh/collider issue, so that would be a thing to check as well. $\endgroup$
    – Chuck
    May 25, 2023 at 19:23

1 Answer 1

1
$\begingroup$

The "ray" sensor in Gazebo detects collision shapes. If you want to use the visual shapes, you need to use "gpu_ray" in the sensor type. Also, since "ray" and "gpu_ray" are deprecated, you should use "lidar" or "gpu_lidar"

$\endgroup$
3
  • $\begingroup$ I changed as suggested but it made no difference. The plugin works fine in one urdf but plays up in this one? $\endgroup$
    – TK noob
    May 24, 2023 at 0:38
  • $\begingroup$ @TKnoob - Did you actually make a change? You reference this tutorial but the sensor type is already set to "gpu_ray". I found this post online that recommends the opposite - Try using the non-GPU version of the laser. Change the value sensor type="gpu_ray" to sensor type="ray" and change filename="libgazebo_ros_gpu_laser.so" to filename="libgazebo_ros_laser.so". $\endgroup$
    – Chuck
    May 24, 2023 at 12:16
  • $\begingroup$ In above code snippet, the link and the plugin for the laser reflects the mentioned changes already. I did not know how to include/link files. I set up textbin and will edit post to reflect. after I get laser working I will start with xacro's to shorten code. $\endgroup$
    – TK noob
    May 24, 2023 at 23:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.