Duckietown : ROS Developers LIVE-Class #30

I am following the free live class based on Duckietown : ROS Developers LIVE-Class #30

The UI shown in the video is very different then the present studio i.e. there is no way to launch the main.launch directly from the UI. So, we have to launch it manually.

I did following steps.

1.roslaunch duckietown_gazebo main.launch → this launches gazebo simulation with the duckieworld

2.roslaunch duckietown_gazebo spawn_duckbot.launch → this spawns the duckiebot robot .

3.as shown in the video I gave following commands to move the robot.
rostopic pub -1 /robot1/cmd_vel geometry_msgs/Twist “linear:
x: 0.1
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.5”

However, the robot is not moving whereas in the video the robot moves if we publish to cmd_vel.

One interesting thing is that if I spawn the same robot in some other world and publish to cmd_vel then the robot moves.

why is not moving in the duckietown simulation? Please let me know?

Hi @vibs ,

The system has been updated many times since then, although we kept the ROS distro configuration. You did it correctly to run the simulation manually.

I’m trying to reproduce the same environment but here I could not have the simulation running.

I have the fresh rosject copied but when I try to run the command

roslaunch duckietown_gazebo main.launch

I had some errors related to gazebo libs. Did you install something previously?

[Err] [SystemPaths.cc:429] File or path does not exist["/home/user/.gazebo/models/apartment/meshes/model.dae"]
[Err] [MeshShape.cc:67] No mesh specified
[Err] [Plugin.hh:165] Failed to load plugin libanimated_box.so: libanimated_box.so: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:165] Failed to load plugin libanimated_box_south.so: libanimated_box_south.so: cannot open shared object file: No such file or directory

Please, let me know if you had something extra installed so I can reproduce exactly the same environment as you have.

Could you share your rosject with me?

Regards

hi marco,

thanks for your time.

please ignore I have resolved the issue.

thanks in advance

1 Like

Hi @macro,

note: in the video its shown with distro=kinetic and in the video the author has mentioned that we don’t need to build i.e. run as is. But its not happening for distro=noetic.

I have made some following changes to rosject i.e. earlier it was using the distro=kinetic. The problem with kinetic was that I was not getting the menu in the gazebo.
.roslaunch duckietown_gazebo main.launch
So to try different option I edited the distro to noetic. But when I try to do a roslaunch i.e.
.roslaunch duckietown_gazebo main.launch

I am getting the following error i.e.
RLException: [main.launch] is neither a launch file in package [duckietown_gazebo] nor is [duckietown_gazebo] a launch file nameThe traceback for the exception was written to the log file

then I did:
user:~$ source /home/user/simulation_ws/devel/setup.bash
~$ roslaunch duckietown_gazebo main.launch
bash: roslaunch: command not found

I am getting the error as : bash: roslaunch: command not found

please let me know how to fix this?

Thanks

Hi @vibs ,

Thank you for the details. I tried from here the same environment, switching from kinetic to noetic.
Remember to source ~/simulation_ws/devel/setup.bash, and here I could have the launch file run

Although still had the issue with the libs. I’m investigating it
Please, run echo $ROS_PACKAGE_PATH before the roslaunch so we can check your environment is properly configured

Hi @marco,

If you refer my first message regarding this discussion. Even before you have mentioned.I gave the same path i.e. source /home/user/simulation_ws/devel/setup.bash

But still I am getting the following error without the build. I have also provided the rosject link which I am using along with $ROS_PACKAGE_PATH before and after the roslaunch:

user:~$ echo $ROS_PACKAGE_PATH
/home/simulations/public_sim_ws/src:/opt/ros/noetic/share
user:~$ source ~/simulation_ws/devel/setup.bash
user:~$ echo $ROS_PACKAGE_PATH
/home/simulations/public_sim_ws/src:/opt/ros/noetic/share
user:~$ roslaunch
bash: roslaunch: command not found

RosjectLink:
https://www.youtube.com/redirect?event=comments&redir_token=QUFFLUhqbXRWdU43bUhPem92Z3FMNEhWWnJ0OTllVnNEQXxBQ3Jtc0tsZXMxQ25zLU01R0VjWm9qanNQSEJ0ZWxpSm5ZbF85dHZkNlc4X3ZpczUweHdIVEFPQl9ReVNvSEtsTHF1UTJ2cmVHMG51bFBFQnlpQWZkcS1JRjJpZl9vU1RFM3g2eEgtWFlLY2poRWtDdnhWSU5QWQ&q=https%3A%2F%2Fapp.theconstructsim.com%2F%23%2Fl%2F7cfd8ab7-d70c-40cd-9bc6-d420356f2c61&stzid=UgyAnYh_6MWmsq1qAHl4AaABAg.94rowHUbuLB9Jq5nzI6Ggi

Thanks,

Hi @vibs ,

What do you mean by “without the build” ?
We can run launch files without building them, but the build and devel folders must be present to be sourced, they will create the paths to the installation folders of ROS and all its libraries.Do you have such folders in the simulation_ws?

I tried the rosject you send to me with the same changes and still got the simulation launched like I’ve shown, but with some errors.

I need some time to understand it, I’ll get back with more details after debugging it.

By the way, are you running it inside ROSDS or in another environment?

Hi @marco,

As I mentioned earlier I am using the project as is without any modification i.e. both the devel and build folders are present both in simultaion_ws and catkin_ws (I have not done any kind of build or changed anything)

Again, as mentioned earlier if I use distro=kinetic then the project works. But I don’t get the menu in gazebo.

To get the menu in gazebo I have changed the distro=noetic. But the project doesn’t works even with errors as mentioned above I am getting the error : roslaunch command not found(so bascially even if I am setting the path to source ~/simulation_ws/devel/setup.bash. I am still get the error as roslaunch command not found)

Please do your research, fix the issue and then get back to me. Its almost a week now and still there is no solution.

Hope it helps,

thanks in advance

Hi @vibs ,

Let me break into 2 parts the steps I followed.
The 1st part is compiling the environment properly using kinetic, since this project was designed for that distro.

Kinetic

1 - Remove build and devel folders from catkin_ws and simulation_ws
2 - Source /home/simulations/public_sim_ws/devel/setup.bash, it contains other dependencies of our platform
3 - Modify the files below, because they are referencing the package duckietown_msgs when it is not included in our system anymore, and not being used in the packages we are compiling

The files are:

  • duckietown_gazebo/CMakeLists.txt
...
...
find_package(Boost REQUIRED COMPONENTS system)
find_package(catkin REQUIRED COMPONENTS 
#  duckietown_msgs 
  )
find_package(Protobuf REQUIRED)
catkin_package(
#   INCLUDE_DIRS include
  CATKIN_DEPENDS
    gazebo_ros
    # duckietown_msgs
  DEPENDS
    # gazebo
    # SDF
  LIBRARIES
#    duckie_ros_diff_drive
)
...
...
  • duckietown_gazebo/package.xml
...
...
  <build_depend>gazebo_ros</build_depend>
  <!-- <build_depend>duckietown_msgs</build_depend> -->
  <run_depend>gazebo_ros</run_depend>
  <!-- <run_depend>duckietown_msgs</run_depend> -->
  <run_depend>message_runtime</run_depend>
  <!-- The export tag contains other, unspecified, tags -->
...
...
  • duckietown_gazebo/launch/main.launch
...
<arg name="gui" default="true"/>
...

You also need to install the gazebo plugin animated_box (Gazebo : Tutorial : Animated Box)

Please check the video I recorded with these steps:


Noetic

Then we go for noetic distro, where you will need to re-compile the packages and source the paths properly to have it setup.

Here you will have gazebo with the menu shown. There is another video where I’m showing it after changing the distro of my rosject

Please, have in mind this is a very heavy simulation and may not run properly in a shared computers of a free plan.

Please let me know if you need more help with this

Regards

Hi @macro,

thanks for the above solution. I will try and get back to you if there is any problem.

I have one more question regarding the gazebo environment. Please find here attached fig 1 and fig 2.

Question:
what is the way I can find the position of x,y coordinates in the gazebo simulation.
For example consider the attached fig 1 what is the way I can find the x,y position of red dot?

also, consider the attached fig 2 what is the way I can find the x,y position of yellow dot or for matter x,y coordinates position for any point in gazebo world?

Thanks in advance

Hi @vibs ,

If you have models or objects in the scene, you can subscribe to gazebo topics and get the position.

If you want to know the position of a specific point, there is a plugin for that https://answers.gazebosim.org//question/15783/getting-the-coordinates-of-a-point-using-the-mouse/ . I would say it’s recommended for complex simulations, but it would also require a more powerful computer.

Finally, for simpler simulations, like the one you attached in the 1st image, you can also use the simulator coordinate frames. By convention, we have Blue for z-axis, red for x-axis and green for y-axis. The ground is divided in squares of 1 meter

I hope it helps you

Regards

Hi @marco,

Can you explain the simpler solution with a detailed example for the fig 1?

thanks in advance

Hi @vibs,

It is basically counting the squares in the ground, taking into account the frames of the world.

Do you have the Gazebo world reference frame in the center of the ground?
It should be the same you we have for the duckietown simulation, at the center you can see the long blue and green lines.

It’s not the best way as I mentioned before, we can do it for small worlds. The best approach would be using rviz or even the gazebo plugin.

Regards

Hi @macro,

I was able to add a plugin using the following link : Gazebo : Tutorial : GUI Overlay

i.e. in this plugin I get a button on the top left of the gazebo world and when I click that button I get a sphere in the world.

Now coming to the link(https://answers.gazebosim.org//question/15783/getting-the-coordinates-of-a-point-using-the-mouse/) that you have provided for showing x,y coordinates.
I followed the same steps as for the above plugin i.e. plugin was added successfully(as the build i.e. “make” was successfull)

But whenever I move the mouse on the 3D scene I am not getting any x,y coordinates. Is there some additional way to get the coordinates?

Thanks in advance

Could you share your rosject with me so I can debug it better?

There are some steps to follow and I need to check your files

Regards

Can you try on any of your rosject(in noetic) and share the additional steps?

or you could try on our favorite rosject:

RosjectLink:
https://www.youtube.com/redirect?event=comments&redir_token=QUFFLUhqbXRWdU43bUhPem92Z3FMNEhWWnJ0OTllVnNEQXxBQ3Jtc0tsZXMxQ25zLU01R0VjWm9qanNQSEJ0ZWxpSm5ZbF85dHZkNlc4X3ZpczUweHdIVEFPQl9ReVNvSEtsTHF1UTJ2cmVHMG51bFBFQnlpQWZkcS1JRjJpZl9vU1RFM3g2eEgtWFlLY2poRWtDdnhWSU5QWQ&q=https%3A%2F%2Fapp.theconstructsim.com%2F%23%2Fl%2F7cfd8ab7-d70c-40cd-9bc6-d420356f2c61&stzid=UgyAnYh_6MWmsq1qAHl4AaABAg.94rowHUbuLB9Jq5nzI6Ggi

thanks in advance

Hi @vibs ,

Unfortunately I don’t have an example for this plugin. As I mentioned, this is recommended in gazebo forum, but I haven’t tried it.

Th additional steps are the implementation mentioned in the original post, using the Dominoes example to get the mouse movement and position in the simulation

Regards

This part is already mentioned in the link that you have provided earlier?

I have installed this plugin but it doesn’t work i.e. nothing is happening on mouse move?

Can you please try installing at your end once and see if it works?

Thanks

Hi @vibs, unfortunately I can’t it since it’s a bit out of the scope of the platform, our courses and material created.

The suggested post leads you to get the example of the time widget and the code of another plugin that reads the data of the camera and world to show the position information in the widget.

Please, let me know if you have any other issue regarding to the live class mentioned before.

Regards

Hi marco when i launch main.launch file after watching to this video i have this in terminal :
$ roslaunch duckietown_gazebo main.launch
… logging to /home/mohamedali/.ros/log/92db1680-cdd3-11ee-a360-51ff6577cb1d/roslaunch-mohamedali-Lenovo-ideapad-330-15IKB-23140.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://mohamedali-Lenovo-ideapad-330-15IKB:40383/

SUMMARY

PARAMETERS

  • /gazebo/enable_ros_network: True
  • /rosdistro: noetic
  • /rosversion: 1.16.0
  • /use_sim_time: True

NODES
/
gazebo (gazebo_ros/gzserver)
gazebo_gui (gazebo_ros/gzclient)

ROS_MASTER_URI=http://localhost:11311

process[gazebo-1]: started with pid [23155]
process[gazebo_gui-2]: started with pid [23159]
[ INFO] [1708209052.111267040]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1708209052.116423141]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting…
[ INFO] [1708209052.402686687]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1708209052.410322349]: waitForService: Service [/gazebo_gui/set_physics_properties] has not been advertised, waiting…
Service [/House 1/shininess] is not valid.
Service [/House 2/shininess] is not valid.
Service [/House 3/shininess] is not valid.
Service [/Fast Food/shininess] is not valid.
Service [/Gas Station/shininess] is not valid.
[ INFO] [1708209053.901454089]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[ INFO] [1708209053.981014622]: Physics dynamic reconfigure ready. and the gui is not completed haw can i solve this issue please