0
$\begingroup$

I have a 4 wheeled robot with a LIDAR on the robot. I am able to move the robot in Gazebo and the lidar "scans"(if that's the right term for the blue lines coming out of it) are showing up in Gazebo. But when I open RVIZ and try to show the laserScan points(?) on in RVIZ nothing will show and the robot doesn't move either. So I am not really sure what I am doing wrong at the moment. I don't know much about robot_state_publisher and joint_state_publisher but I know they are running when I run the launch file. Although I have a working robot I am still very new to ROS so apologies if I've made a rookie mistake.

here is a link to my github and the launch file that will run the robot. Use teleop keyboard node to control the robot.

Some guidance on what the issue could be is very much appreciated. thanks.

$\endgroup$

2 Answers 2

0
$\begingroup$

RViz will not automatically show all possible topics and messages. You'll need to add the topics to the "Displays" panel on the left. To do this, you use the "Add" button at the bottom of the panel. You can search the "By topic" list or if you know the type of item, you can use "By display type." If you use the latter, you'll need to add in the topic name you want RViz to subscribe to after you've added the display feature.

$\endgroup$
7
  • $\begingroup$ Thanks for the answer but I have already done that. I have added the model and then set the fixed frame as the 'base' then I added the laser scan topic and then I set the topic to '/scan' which is the topic used in my lidar.xacro file, i have included the code snippet below. '<plugin name="laser_controller" filename="libgazebo_ros_ray_sensor.so"> <ros> <argument>~/out:=/scan</argument> </ros> <output_type>sensor_msgs/LaserScan</output_type> <frame_name>laser_frame</frame_name> </plugin>' $\endgroup$
    – Balen
    Jan 23 at 15:57
  • $\begingroup$ From the terminal where you launch RViz, does rostopic echo /scan show any information? You'll need to make sure each new terminal window knows where the ros master lives. $\endgroup$
    – proan
    Jan 23 at 16:05
  • $\begingroup$ I have tried running that command I get the following message: "WARNING: no messages received and simulated time is active. Is /clock being published?" Also one thing I have noticed is that the 'rostopic list' command won't show the '/scan' topic until I have added it to the topic section in the 'laserScan' topic in RViz. $\endgroup$
    – Balen
    Jan 23 at 16:12
  • $\begingroup$ So your problem is not with RViz but with communication across multiple console windows. You need to set ROS_MASTER_URI and source your workspace setup every time you use a new console. $\endgroup$
    – proan
    Jan 23 at 16:15
  • $\begingroup$ Oh I see. I have never came across issues with sourcing as I have sourced the devel/setup.bash path in my .bashrc file. I will try to find how to set the ROS_MASTER_URI and update you here. Thanks for the help. $\endgroup$
    – Balen
    Jan 23 at 16:19
0
$\begingroup$

So after a lot of research I managed to fix the issue with the laserscan points not showing in RViz. I used the LiDAR implementation from turtlebot3's description for the 'melodic-devel' version which is the version I am using and then I modified it to be fixed to the chassis etc so that it is correctly positioned in my urdf structure if that's the right way to put it. Now it shows the laser points but the robot won't move in RViz lol so now I have to fix that. I have updated the files on my GitHub so you can have a look at the lidar.xacro file to see the lidar implementation if you are having the same problem.

$\endgroup$

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.