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

Laser scanner / Lidar not publishing /scan

asked 2022-07-31 23:34:42 -0600

Snicker gravatar image

Im having trouble adding a laser sensor to my robot, im using ROS1, can you find an error ? This is what is inside my lidar.xacro file, and on gazebo i can see the rays and them adjusting to a wall colision, while not having a topic with /scan when i do a rostopic list or an echo

Also tested a code more similar to the one inside turtlebot3 but had no sucess

<robot <a="" href="http://xmlns:xacro="http://www.ros.org/wiki/xacro">xmlns:xacro="http://www.ros.org/wiki/..." ><="" p=""> </robot>

<joint name="laser_joint_s" type="fixed">
    <parent link="base_link"/>
    <child link="laser_frame_s"/>
    <origin xyz="0.0 0.0 0.01" rpy="0 0 0"/>
</joint>

<link name="laser_frame_s">
    <visual>
        <geometry>
            <cylinder radius="0.005" length="0.035"/>
        </geometry>
        <material name="red"/>
    </visual>
    <collision>
        <geometry>
            <cylinder radius="0.005" length="0.035"/>
        </geometry>
    </collision>

</link>

<joint name="laser_joint" type="fixed">
    <parent link="laser_frame_s"/>
    <child link="laser_frame"/>
    <origin xyz="0.0 0.0 0.02" rpy="0 0 0"/>
</joint>

<link name="laser_frame">
    <visual>
        <geometry>
            <cylinder radius="0.015" length="0.005"/>
        </geometry>
        <material name="red"/>
    </visual>
    <collision>
        <geometry>
            <cylinder radius="0.015" length="0.005"/>
        </geometry>
    </collision>

<gazebo reference="laser_frame">
    <material>Gazebo/Red</material>

    <sensor name="laser" type="ray">
        <pose> 0 0 0 0 0 0 </pose>
        <visualize>false</visualize>
        <update_rate>60</update_rate>
        <always_on>1</always_on>

        <ray>
            <scan>
                <horizontal>
                    <samples>360</samples>
                    <min_angle>-3.14</min_angle>
                    <max_angle>3.14</max_angle>
                </horizontal>
            </scan>
            <range>
                <min>0.05</min>
                <max>1</max>
            </range>
        </ray>
        <plugin name="laser_controller" filename="libgazebo_ros_laser.so">
            <ros>
                <topicName>/scan</topicName>
                <frameName>laser_frame</frameName>
            </ros>
        </plugin>
    </sensor>
</gazebo>

</link>

</robot>

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-08-01 19:31:17 -0600

RyanChen.YLC gravatar image

Hi, compared to my urdf.

I found that error may comes from the whole <gazebo> block.

Just simply place whole <gazebo> block beneath </link>:

<link>
...
</link>
<gazebo>
...
</gazebo>

I think this will work.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-07-31 23:34:42 -0600

Seen: 489 times

Last updated: Aug 01 '22