Skip to content

Oyefusi-Samuel/ZED-mobile-cleaning-simulated-robot.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 

Repository files navigation

ZED-mobile-cleaning-simulated-robot.

image

Fisrt step in building the differential-drive ZED mobile cleaning robot:

Create your ros2 workspace (You can use any name for your workspace, but follow naming rules.)

mkdir ros_ws 
cd ros_ws

Create your src folder

mkdir src

In the src directory of your workspace clone the repo in it to work with robot pkg.

cd src
  git clone https://github.com/Oyefusi-Samuel/ZED-mobile-cleaning-simulated-robot..git

If you build the workspace and you see some errors pop up .You should upgrade pytest to a version that is 6.2 or higher. Use the following command

  pip install --upgrade pytest

Then build the workspace again:

  colcon build

Source the workspace

source install/setup.bash

STEPS TO TAKE TO GET THE ROBOT UP AND READY:

  1. Lauch the robot in an empty world

  2. Visualize in Rviz .

  3. check the TF2 TREE

Launch the Node: (To visualize the robot in an empty gazebo world)

 ros2 launch robot show.robot.launch.py use_sim_time:=true

Screenshot from 2024-12-19 13-42-21

Launch the rviz Node: (To visualize the robot joint, tf)

  ros2 launch robot display.launch.py 

Screenshot from 2024-12-19 13-58-04

You can check the TF2 TREE:

  ros2 run rqt_tf_tree rqt_tf_tree

Screenshot from 2024-12-19 14-40-35

The centre of the robot is the "base_link".

Plugins used in simulation of the robot can be gotten from:

https://classic.gazebosim.org/tutorials?tut=ros_gzplugins

image

Spawning the robot into a custom gazebo world:

To spawn the robot into gazebo, launch the file called show.robot.launch.py, ensure you save the custom designed gazebo world into the world directory in the src folder (Note: launch files in ROS 2 are python scripts/files)

To LAUNCH THE WORLD:

   ros2 launch robot show.robot.launch.py world:="path to the .world file"

Mine is:

ros2 launch robot show.robot.launch.py world:='/home/sam/zed_robot/src/robot/worlds/cafeworld' 

Screenshot from 2024-12-19 14-09-51 Screenshot from 2024-12-19 14-24-43

ros2 launch robot show.robot.launch.py world:='/home/sam/zed_robot/src/robot/worlds/outside.world' 

Screenshot from 2024-12-19 14-36-34

Check if the topics are available.This list all topics which are available:

  ros2 topic list

Now,we can drive the robot around once we use the teleop_twist_keyboard node to publish to the "/cmd_vel" topic that the robot subscribes to.

  ros2 run teleop_twist_keyboard  teleop_twist_keyboard

You can give colour to the robot,by adding colour to the robot description .xacro file.

image

SLAM

Run the slam_toolbox node.

  ros2 launch ros2_mapping online_async_launch.py

Open rviz to visualize SLAM (add laserscan, mapp tf, robotmodel) topics

rviz2

image

Now,we can drive the robot around using the teleop_twist_keyboard node to map the world.

  ros2 run teleop_twist_keyboard  teleop_twist_keyboard

image

Save your map using the ros2 map server node

ros2 run nav2_map_server map_saver_cli -f /path/to/save/map_name  # Saves the current map to the specified path and file name

mine was

ros2 run nav2_map_server map_saver_cli -f /home/sam/zed_robot/src/ros2_mapping/map/map_2  # Saves the current map to the specified path and file name

image

ff.webm

AMCL

Run the AMCL node.

 ros2 launch ros2_mapping amcl.launch.py

Open rviz to visualize SLAM (add Particlecloud, laserscan, mapp tf, robotmodel) topics, 2d pose estimate, you should see the particle cloud.

rviz2

image

Now,we can drive the robot around using the teleop_twist_keyboard node to visualize the particle cloud around.

  ros2 run teleop_twist_keyboard  teleop_twist_keyboard

AUTONOMOUS NAVIGATION:

Localization:

ros2 launch ros2_mapping localization.launch.py

Navigation Mode(NAV2 stack)

 ros2 launch ros2_mapping navigation.py    # set 2d pose estimate of the robot to begin navigation

We can also write a python script that publish certain velocity to make the robot move and also perform some basic task.

Create a ROS 2 package called drive_robot ,its dependecies on rclpy,the package should be created in the src directory of your workspace.

  cd src
  ros2 pkg create drive_robot --build-type ament_python --dependencies rclpy

Run the node in the pasckage to make the robot drive forward, in linear of x.

  ros2 run drive_robot velocity_drive

Converting Gazebo classic to Gazebo Ignition(Lastest Gazebo simulator)

Install required dependecies

  sudo apt install ros-<ros2_distro>-ros-ign-gazebo
  sudo apt install ros-humble-ros-ign-gazebo  # my current ros distro is humble, you can change to fit your ros version (foxy, jazzy)
  sudo apt install ros-humble-ros-gz-bridge
  sudo apt install ros-humble-ign-ros2-control
  sudo apt install ros-humble-twist-mux
  sudo apt install ros-humble-twist-stamper
  sudo apt install ros-humble-ros2-control
  sudo apt install ros-humble-ros2-controllers

for example:

If you are using ros 2 humble distro , just replace <ros2_distro> with humble . So it will be :

  sudo apt install ros-humble-ros-gz

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published