This tutorial is created by Rosbotics Ambassador 020 Muhammad
Rosbotics Ambassador Program https://www.theconstruct.ai/rosbotics-ambassador/)
What are we going to Learn?
- How to create ROS2 Package
- How to compile ROS2 workspace
- How to create node in Python to spawn new object in Gazebo Simulation
List of Resources in this Post
- ROSJect Link: https://app.theconstructsim.com/rosjects/741580
- Robotics Discourse Link: https://discourse.ros.org/t/spawning-a-robot-entity-using-a-node-with-gazebo-and-ros-2/9985
- The Construct App: https://app.theconstructsim.com/
Overview:
ROS (Robot Operating System) is a de facto standard for Robotics. In order to program Robots, simulation of Real world systems is very important to test and debug the systems. For simulations of Robotics systems, Gazebo is used commonly in ROS. In this post we will learn how to add new objects in simulation scene without terminating the simulation entirely.
In general, if we want to add new object in simulation scene, we have to terminate all running nodes in simulation, edit the World file (description file for simulation in Gazebo). In order to add new objects, without terminating nodes, we can use Gazebo API in Python to spawn new objects in simulation dynamically.
Opening the ROSJect:
To follow along the post, we need to have ROS2 installed in our system. To make things easier, we have created ROSJect to follow along: https://app.theconstructsim.com/rosjects/741580
Just open the ROSJect in your browser
Click on “FORK”
Next, Click on “RUN”
Go to the ROS2 Workspace
cd ros2_ws
Then, source the workspace
source install/setup.bash
In one web shell, run Gazebo
gazebo –verbose -s libgazebo_ros_factory.so
In another web shell, run the ROS2 Node
ros2 run robot_spawner_pkg spawn_turtlebot the_robot_name robot_namespace 0.0 0.0 0.1
Keep pushing your ROS Learning.
Video Tutorial
0 Comments