Spiega documentation

robotics utils

How do you build robotics applications.

tools

A list of tools used in robotics applications:

  • ros/ros2
  • RGB-D :: colors and depth
    structured light
    infrared pattern to estimate the depth (kinect)
    time of flight
    diffraction with bouncing light
    stereo vision
    using multiple cameras
    LiDAR
  • Isaac sim :: framework on omniverse for robotics simulations
  • bullet :: collision libraries
  • genesis :: simulation platform for physical AI dev
  • SLAM :: building a map as you explore the environment
  • movelt :: A motion planning, manipulation, and kinematics framework for ROS
  • CAD :: computer aided design
  • URFD :: unified robots description

[ CAD Model ] –> [ URDF File (links, joints, sensors) ] –> [ RobotOps CI/CD Pipeline ]

 

v v [ Meshes (.stl/.dae) ] [ Simulators: Gazebo, RViz ] [ Controllers: ROS Control ]

computer-aided design (CAD), Unified Robot Description Format (URDF

robotics stack

ros2

We start with a simple example in ROS2 lyrical. We have nodes which communicate through ROS like:

webserver
actuators
sensors
(no term)

concepts

We have

bag files
a file format to store messaging data
rqt
a gui to display BAG files

We install ros2:

sudo apt update 
export ROS_APT_SOURCE_VERSION=$(curl -s https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest | grep -F "tag_name" | awk -F'"' '{print $4}')
curl -L -o /tmp/ros2-apt-source.deb "https://github.com/ros-infrastructure/ros-apt-source/releases/download/${ROS_APT_SOURCE_VERSION}/ros2-apt-source_${ROS_APT_SOURCE_VERSION}.$(. /etc/os-release && echo ${UBUNTU_CODENAME:-${VERSION_CODENAME}})_all.deb"
sudo dpkg -i /tmp/ros2-apt-source.deb
sudo apt install -y python3-mypy  python3-pip python3-pytest python3-pytest-cov  python3-pytest-mock   python3-pytest-repeat python3-pytest-rerunfailures  python3-pytest-runner  python3-pytest-timeout ros-dev-tools
#sudo apt install ros-lyrical-desktop
colcon mixin add default https://github.com/colcon/colcon-mixin-repository/raw/master/index.yaml
colcon mixin update default
mkdir -p ~/lav/src/blender_twin/robot_ws/
mkdir -p ~/ros2_lyrical/src
cd ~/ros2_lyrical
vcs import --input https://raw.githubusercontent.com/ros2/ros2/lyrical/ros2.repos src
sudo apt upgrade
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src -y --skip-keys "fastcdr rti-connext-dds-7.7.0 urdfdom_headers"
colcon mixin add default https://github.com/colcon/colcon-mixin-repository/raw/master/index.yaml
colcon mixin update default
cd ~/ros2_lyrical/
colcon build --symlink-install --mixin release

Create a sample urfd file

#+begin_example <robot name=“simple_bot”> <link name=“base_link”> <visual> <geometry> <box size=“1 1 0.2”/> </geometry> <material name=“blue”/> </visual> </link> </robot> ,#+end_example

And launch the model

,*aiment* is the building system ,*colcon* is the building tool

,#+name: ros-launch ,#+begin_src bash :results output replace :async t :var urfd=urfd_file cd ~/lav/src/blender_twin/robot_ws/ echo $urfd > my_robot.urfd colcon build ros2 launch urdf_tutorial display.launch.py model:=my_robot.urdf #+end_src


Summary: 0 packages finished [0.11s]

turtle example

We launch the turtle agent

source /opt/ros/lyrical/setup.bash
/opt/ros/lyrical/bin/ros2 run turtlesim turtlesim_node

We launch the turtle remote controller

source /opt/ros/lyrical/setup.bash
/opt/ros/lyrical/bin/ros2 run turtlesim turtle_teleop_key

Show the graphs connecting nodes

#source /opt/ros/lyrical/setup.bash
. ~/ros2_lyrical/install/local_setup.bash
ros2 run rqt_graph rqt_graph

We look at the qrt_bag which manages and records bag files

source /opt/ros/lyrical/setup.bash
/opt/ros/lyrical/bin/rqt_bag 
echo $COLCON_PREFIX_PATH

,#+name: ros-dependencies ,#+begin_src bash :results output replace sudo apt install python3-colcon-common-extensions source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash #+end_src

cd ~/lav/src/blender_twin/camera_esp32/src
colcon build

create package

source /opt/ros/lyrical/setup.bash
cd ~/lav/src/blender_twin/robot_ws
/opt/ros/lyrical/bin/ros2 pkg create bottino_controller --build-type ament_python

python and ros

install ros (lyrical)

The python library is rlcpy

#sudo apt install python3-sphinx python3-sphinx-autodoc-typehints python3-sphinx-rtd-theme
source /opt/ros/lyrical/setup.bash
mkdir -p /tmp/rclpy_ws/src
cd /tmp/rclpy_ws/src
git clone https://github.com/ros2/rclpy.git
cd ..
colcon build --symlink-install
source install/setup.bash
cd src/rclpy/rclpy/docs
make html

coding

I create a python mcu_node.py and build the application

I add the command in the setup.py

entry_points={
    'console_scripts': ["mcu_node = bottino_controller.mcu_node:main"
    ],
},

With `–symlink-install` I don’t need to re-run the build after every python edit.

cd ~/lav/src/blender_twin/robot_ws
colcon build --symlink-install

So I can use the module from everywhere

. ~/ros2_lyrical/install/local_setup.bash
source install/local_setup.sh
ros2 run bottino_controller mcu_node

Author: sabeiro

Created: 2026-09-05 Sat 19:41

Validate