Gazebo actor not seen by sensors

Hi everyone
I’ve add an actor in a Gazebo simulation. I’ve read that in order to be this actor detected by the sensor I should change the type from <sensor type="ray" to <sensor type="gpu_ray" but I dont find the sensor definition for the turtlebot3 waffle_pi in ros2 galactic. turtlebot3/turtlebot3_description at galactic-devel · ROBOTIS-GIT/turtlebot3 · GitHub
Can anyone help me?
Thanks in advance

Hi @lfernandez ,

I have completed this course Mastering Gazebo Simulator a while back, and I have not come across a term “actor”. Are you working on this course (OR) is this an external request for a problem you have?

What do you mean by “actor”? Are you referring to a model in the world? And by “actor” are you referring to a model of human being?

– Girish

Hi @girishkumar.kannan
It’s not directly related to the course content. I’ve follow this tutorial Gazebo : Tutorial : Make an animated model (actor).
Bu actor they meant an animated model.
Thanks again

Hi @lfernandez ,

I now understood what you meant by “actor” after following your link.

I checked the git repository for turtlebot3 galactic version. When I checked the urdf directory, I could not find any .xacro or .gazebo files. So I guess you should create a .gazebo file and convert .urdf into a .xacro file and later launch the .xacro file instead of .urdf from launch file.

Here is a minimalistic .gazebo file with laser sensor only, let’s call this laser_scan.gazebo:

<?xml version="1.0"?>
<robot>

    <!-- Gazebo tags - Laser Scan -->
    <gazebo reference="scan_joint">
        <preserveFixedJoint>true</preserveFixedJoint>
    </gazebo>
    <gazebo reference="scan_joint">
        <material>Gazebo/DarkGrey</material>
    </gazebo>

    <!-- Gazebo ROS Plugin - Laser Scan -->
    <gazebo reference="base_scan">
        <!-- Change Laser Sensor Type Below -->
        <sensor type="ray" name="head_hokuyo_sensor">
            <pose>0 0 0 0 0 0</pose>
            <visualize>true</visualize>
            <update_rate>20</update_rate>
            <ray>
                <scan>
                    <horizontal>
                        <samples>720</samples>
                        <resolution>1</resolution>
                        <min_angle>-1.570796</min_angle>
                        <max_angle>1.570796</max_angle>
                    </horizontal>
                </scan>
                <range>
                    <min>0.20</min>
                    <max>10.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_head_hokuyo_controller" filename="libgazebo_ros_laser.so">
                <topicName>/laser/scan</topicName>
                <frameName>sensor_laser</frameName>
            </plugin>
        </sensor>
    </gazebo>

</robot>

And here is a minimalistic .xacro file with laser sensor only, lets call this laser_scan.xacro:

<?xml version="1.0" ?>

<!--robot name="robot"-->
<robot name="robot" xmlns:xacro="http://www.ros.org/wiki/xacro">

    <xacro:include filename="$(find robot_description)/urdf/laser_scan.gazebo" />

    <!-- Laser Scan -->
    <joint name="scan_joint" type="fixed">
        <origin rpy="0 0 0" xyz="0.8 0 0.3" />
        <child link="base_scan" />
        <parent link="base_link" />
        <joint_properties damping="1.0" friction="1.0" />
    </joint>
    
    <link name="base_scan">
        <inertial>
            <origin xyz="0 0 0" rpy="0 0 0" />
            <mass value="0.5" />
            <inertia ixx="0.000252666666667" ixy="0" ixz="0" iyy="0.000252666666667" iyz="0" izz="0.0005"/>
        </inertial>
        <visual>
            <origin xyz="0 0 0" rpy="0 0 0" />
            <geometry>
                <cylinder radius="0.15" length="0.20"/>
            </geometry>
            <material name="Red">
                <color rgba="0.7 0.1 0.1 1" />
            </material>
        </visual>
        <collision>
            <origin xyz="0 0 0" rpy="0 0 0"/>
            <geometry>
                <cylinder radius="0.15" length="0.20"/>
            </geometry>
        </collision>
    </link>

</robot>

The above two files are just an example. You will have to make a copy of the turtlebot3_waffle_pi.urdf and make appropriate changes to include the above two code-snippets.

Note: The above codes are may not work “as-is”. It must be changed to suit the robot model - like dimensions, geometry, collision, visual, etc. Compare the actual values with the original .urdf file and do suitable changes. I have just copy-pasted the code here. It will NOT be correct. This is just to give you an idea of the process.

I hope this helps.

Regards,
Girish

1 Like

Thanks @girishkumar.kannan!! but I think I dont how to apply so many changes.
Thanks anyway!

Hi @lfernandez ,

If you are still subscribed to the courses, you can take a quick glimpse into Mastering Gazebo Simulator course. This course covers these topics in detail and to-the-point.

Regards,
Girish

1 Like

I’ve tried to change the sensor type from the model.sdf turtlebot3_gazebo <sensor name="hls_lfcd_lds" type="gpu_ray"> but actors are not detected.
Thanks again

Hi @lfernandez ,

Where is turtlebot3_gazebo directory located? I cannot find it in the git repository that you have shared in your initial post.

– Girish

It’s inside turtlebot3_simulations. git clone -b galactic-devel GitHub - ROBOTIS-GIT/turtlebot3_simulations: Simulations for TurtleBot3

Thanks again

Hi @lfernandez ,

I think your problem may not be with the “type” of ray. I guess, it has something to do with “visual” and/or “collision” of the model.
I just worked on one of my own ROS package by changing the lidar’s type="ray" with "gpu_ray", and I did not see a major / significant difference in the simulation.

Would you be able to post a screenshot of what is happening in your simulation?
Also, please describe what should be the expected result.
This way I can understand what is happening and (maybe) provide a solution.

Regards,
Girish

Hi @girishkumar.kannan,
the simulation seems to be ok but the actor is not detected in the /scan topic
Thanks again

Hi @lfernandez ,

I am not exactly sure how to fix this problem, I have not faced this issue yet.

For now, I can redirect you to this link: [ROS Q&A] 124 - Range sensor does not detect obstacles in Gazebo - The Construct

Let me know if that link is useful for you.

Regards,
Girish

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.