-
installed ROS (See video Getting Ready for ROS Part 3: Installing ROS and cfr. my notes in Part-1-Getting-ready-ROS2-Aug22-Jan23.md)
-
watched Intro video Why do I think you should build this robot?
- copied template from github: https://github.com/joshnewans/my_bot, created a workspace and built with colcon:
$ cd ~ $ mkdir dev_ws && cd dev_ws $ mkdir src && cd src $ git clone https://github.com/mhered/manolobot_uno.git $ cd .. $ colcon build --symlink-install
-
watched TF overview video: ROS Transform System (TF) | Getting Ready to Build Robots with ROS #6. See my notes in Part-1-Getting-ready-ROS2-Aug22-Jan23.md
- installed xacro and joint state publisher GUI
-
watched URDF Overview video How do we describe a robot? With URDF! | Getting Ready to build Robots with ROS #7. See my notes in Part-1-Getting-ready-ROS2-Aug22-Jan23.md
Video: Creating a rough 3D model of our robot with URDF Blog: Making a Mobile Robot #2 - Concept Design URDF Discussion: Discourse
-
root link must be called
base_link
-
orientation is:
-
x forward (red)
-
y left (green)
-
z up (blue)
-
3 things to take into consideration when saving changes in URDF:
-
build workspace with
$ colcon build --symlink-install
. This avoids having to rebuild with every change (except if you add new files) -
quit (ctrl+c) and relaunch the robot state publisher with.
$ ros2 launch manolobot rsp.launch.py
every time you make a change -
click Reset to refresh RVIZ so it picks up changes. If this does not work tick/untick display items or close/reopen as last resource
-
To get started, go to the workspace and source it:
(Terminal 1):$ cd dev_ws
$ source install/setup.bash
- With every change run the launch file:
$ ros2 launch manolobot_uno rsp.launch.py
If new files are present rebuild the workspace with colcon
before the launch file:
$ colcon build --symlink-install
- to view run RVIZ in another terminal
(Terminal 2):$ rviz2 -d dev_ws/src/manolobot_uno/config/view_bot.rviz
- to publish dynamic joints run
joint_state_publisher_gui
in another terminal
(Terminal 3):$ ros2 run joint_state_publisher_gui joint_state_publisher_gui
To save the state of RVIZ: Save as... in ./config/view_bot.rviz
then open rviz with the rviz file as parameter:
$ rviz2 -d dev_ws/src/manolobot_uno/config/view_bot.rviz
Based on The good way to download code from internet, see notes on ETH Zurich course.
Rather than having multiple repos I copy the folder into the main one and symlink to dev_ws/src
.
This is way cleaner:
- copy the contents of the repo to a folder inside
manolobot
$ mv ~/dev_ws/src/manolobot_uno ~/manolobot/
- Symlink it to
dev_ws
$ ln -s ~/manolobot/manolobot_uno/ ~/dev_ws/src/
- Build it and re-source environment
$ colcon build --symlink-install
$ cd ~/dev_ws
$ source install/setup.bash
- Then, to launch the
robot_state_publisher
:
$ ros2 launch manolobot_uno rsp.launch.py
Blog: https://articulatedrobotics.xyz/mobile-robot-3-concept-gazebo/
Check also: https://articulatedrobotics.xyz/ready-for-ros-8-gazebo/
- Launch
robot_state_publisher
with sim time:
(Terminal 1):$ ros2 launch manolobot_uno rsp.launch.py use_sim_time:=true
- Install - if not done before - and launch gazebo with ROS compatibility:
$ sudo apt install ros-foxy-gazebo-ros-pkgs
(Terminal 2):$ ros2 launch gazebo_ros gazebo.launch.py
- Spawn the robot:
(Terminal 3):$ ros2 run gazebo_ros spawn_entity.py -topic robot_description -entity manolobot
Prepared launch_sim.launch.py to achieve the same effect (launch gazebo and spawn the robot) but with a single command:
(Terminal 1):$ ros2 launch manolobot_uno launch_sim.launch.py
-
Created
gazebo_control.xacro
, a new file with the configuration of thediff_drive
plugin for gazebo -
Properties definition (robot dimensions etc) need to be used now as well by
gazebo_control.xacro
so I moved their definition fromrobot_core.xacro
to a separate fileproperties.xacro
and included it fromrobot.urdf.xacro
. -
Modified
robot.urdf.xacro
to add calls to bothproperties.xacro
andgazebo_control.xacro
-
Modified
robot_core.xacro
:-
added gazebo tags to define colors for each link
-
added very low friction coefficients mu1 mu2 for caster wheels
-
With this it is possible to control the robot in the simulation using teleop_key
:
(Terminal 2):$ ros2 run teleop_twist_keyboard teleop_twist_keyboard
- Adjusted the masses to get a proper behavior of the simulation. Note: the values are not real ones, need to make measurements!!
- Created launch file
joystick.launch
and parameter filejoystick.yaml
to configure and launch support for PS4 gamepad as follows:- Dead man switches: L button (left shoulder) for normal speed, R button (right shoulder) for turbo
- Control on left stick: vertical axis for forward/backward motion and horizontal axis for rotation.
- See details of the setup of the gamepad in ./BOM/gamepad.md
Launch with:
(Terminal 2):$ ros2 launch manolobot_uno joystick.launch.py
- Driving
manolobot_uno
around in Gazebo:
- to open Gazebo in a world:
(Terminal 1):$ ros2 launch manolobot_uno launch_sim.launch.py world:=./src/manolobot_uno/worlds/cones.world use_sim_time:=true
- to force Gazebo to update changes in the model: close all other terminals, source, if necessary kill hung up processes with:
$ sudo killall -9 gazebo gzserver gzclient