Giter VIP home page Giter VIP logo

ros-2-simulated-robot.'s Introduction

Ros-2-simulated-robot.

A ros 2 simulated robot(ROS 2)

Fisrt step in building the differential-drive robot:

In the src directory of your workspace , make a folder called "robot" and clone the repo in it.

  cd src
  mkdir robot 
  cd robot 
  git clone https://github.com/Daviesss/Ros-2-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

Launch the Node:

  ros2 launch <name_of_package> robot.launch.py

The joint state publisher node must be launched/be active when launching the robot in rviz2.

  ros2 run joint_state_publisher_gui joint_state_publisher_gui

Open Rviz2:

  ros2 run rviz2 rviz2

Set the fixed frame to "base_link".

The centre of the robot which is the "base_link".

Plugins used in simulation of the robot can be gotten from: https://classic.gazebosim.org/tutorials?tut=ros_gzplugins

STEPS TO TAKE TO GET THE ROBOT UP AND READY:

  1. Launch the robot_state_publisher in simulation mode.
  2. Launch Gazebo.
  3. Spawn the robot into Gazebo.

Set the sim time to true,we dealing with simulation.So our the boolean has to be true.

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

Start up Gazebo empty world:

   ros2 launch gazebo_ros gazebo.launch.py 

SPAWNING THE ROBOT INTO GAZEBO:

 To spawn the robot into gazebo, launch the file called show.robot.launch.py (Note: launch files in ROS 2 are python scripts/files)

Command:

  ros2 launch robot show.robot.launch.py

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 .xacro file.Video decription below,while using the teleop_twist_keyboard to drive the robot.

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

LAUNCHING SAVED GAZEBO WORLD WITH ROBOT SPAWNED IN IT.

   ros2 launch robot show.robot.launch.py world:='path to where you saved your Gazebo world'

Screenshot from 2023-03-07 16-57-01 Screenshot from 2023-03-07 17-02-44

You can check the TF2 TREE:

  ros2 run rqt_tf_tree rqt_tf_tree

Screenshot from 2023-03-08 19-52-28

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/magnum/simuate_ws/src/robot/worlds/new.world

Screenshot from 2023-03-08 23-10-51

SLAM

Run the slam_toolbox node.

  ros2 launch robot online_async.launch.py 
Screencast.from.03-09-2023.11.21.33.AM.webm

AUTONOMOUS NAVIGATION:

Localization:

   ros2 launch robot localization.launch.py map:=/home/magnum/simuate_ws/src/robot/maps/offline.yaml  use_sim_time:=true

But if you want to use the localization mode (AMCL) you have to specify the path in which your map.yaml file is located and pass it into map:=""

  • ros2 launch robot localization.launch.py map:="" use_sim_time:=true

Navigation Mode(NAV2 stack)

   ros2 launch  robot nav.launch.py use_sim_time:=true map_subscribe_transient_local:true
Screencast.from.03-11-2023.05.26.36.PM.webm

ros-2-simulated-robot.'s People

Contributors

daviesss avatar

Stargazers

Yassine Cherni  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.