0
$\begingroup$

Rosanswers logo

I have installed the rplidar A3 and it functions fine in RViz when testing with the proper command in the terminal.

When I activate the laser with my launch file, and set the global fixed frame to 'odom' (fixed frame connected with the world), then the laser pattern disappears . All the rest Rviz works fine, when I move the robot, the base_link moves accordingly.

Anyone can tell me what I have to change or add in order to see the laser pattern?

I just see I am not allowed to add a print-screen picture, so here are the most important settings:

  • Global options: Fixed Frame: odom

  • Grid: Fixed Frame odom

  • RPLidarLaser Topic: /scan, style: squares, size: 0.03, Position Transformer and Color Transformer are blanked out and cannot be selected

  • Axes: Reference Frame: base_link

When I set the global fixed frame to laser, then the laser pattern appears but then, of course, the world is connected with the lidar, which is not the idea.

My urdf file:

<?xml version="1.0"?>

    <robot name="robot"> 
    
      <link name="base_link"> <!-- the Vehicle -->
        <visual>
          <geometry>
            <box size="0.6 0.6 0.2"/> <!-- vehicle shape -->
          </geometry>
           <origin rpy="0.0 0.0 0.0" xyz="0.05 0 -0.1"/> <!-- origin = middle between wheels -->
        </visual>
      </link>
      
   
     <link name="laser">  <!-- the Laser -->
       <visual>
         <geometry>
           <cylinder length="0.03" radius="0.05"/> <!-- laser shape -->
         </geometry>
         <origin rpy="0 0 0" xyz="0.3 0 0.2"/> <!-- origin = cilinder center -->
       </visual>
     </link>
     
   
     <joint name="base_link_to_laser" type="fixed"> <!-- laser pos relative to vehicle -->
       <parent link="base_link"/>
       <child link="laser"/>
       <origin xyz="0 -0.22 0.25" rpy = "0 0 0" />
     </joint>
   
   </robot>

Thanks a lot


Originally posted by RH56 on ROS Answers with karma: 3 on 2022-02-20

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

According to ROS REP-105, there are two frames recommended for navigation; map and odom. The difference between them is that the odom frame may drift over time (which makes it useless for long-term reference) whereas the map frame should not drift over time but maybe noncontinuous (may cause discrete jumps) in the short term.

You will have to create a link from map -> odom -> base_link to get all the transforms working properly. From your urdf file, it is clear that you are creating a link between base_link and laser, but ROS has no idea how to get from base_link to odom (and map in the future).

I recommend using a package like robot_localization in your setup to get odometry information and take care of these transforms for you. If you choose not to, you can also calculate the transforms manually but make sure you publish them to the tf tree. You can use tools such as rqt_tf_tree to ensure these transforms exist.


Originally posted by Akhil Kurup with karma: 459 on 2022-02-25

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by RH56 on 2022-03-17:
thanks a lot, Akhil.

$\endgroup$

Your Answer

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