Skip to content
vbo3376Public

About

Simultaneous Multi Robot Control using ROS for Inter IIT Bootcamp organized by Robotics club IITG

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Install all extra and the necessary packages at once

sudo apt install ros-jazzy-xacro
sudo apt install ros-jazzy-robot-state-publisher
sudo apt install ros-jazzy-joint-state-publisher
sudo apt install ros-jazzy-joint-state-publisher-gui
sudo apt install ros-jazzy-teleop-twist-keyboard
sudo apt install ros-jazzy-twist-mux
sudo apt install ros-jazzy-twist-stamper
sudo apt install ros-jazzy-topic-tools
sudo apt install ros-jazzy-tf2-tools
sudo apt install ros-jazzy-tf-transformations
sudo apt install ros-jazzy-rqt
sudo apt install ros-jazzy-rqt-graph
sudo apt install ros-jazzy-rqt-tf-tree
sudo apt install ros-jazzy-rqt-image-view
sudo apt install ros-jazzy-ros-gz
sudo apt install ros-jazzy-ros-gz-bridge
sudo apt install ros-jazzy-ros-gz-sim
sudo apt install ros-jazzy-ros2-control
sudo apt install ros-jazzy-ros2-controllers
sudo apt install ros-jazzy-gz-ros2-control
sudo apt install ros-jazzy-gz-ros2-control-demos
sudo apt install ros-jazzy-navigation2
sudo apt install ros-jazzy-nav2-bringup
sudo apt install ros-jazzy-slam-toolbox
sudo apt install ros-jazzy-interactive-markers
sudo apt install ros-jazzy-dynamixel-sdk
sudo apt install ros-jazzy-hardware-interface
sudo apt install ros-jazzy-nav2-msgs
sudo apt install ros-jazzy-nav2-costmap-2d
sudo apt install ros-jazzy-nav2-map-server
sudo apt install ros-jazzy-nav2-bt-navigator
sudo apt install ros-jazzy-nav2-bringup
sudo apt install ros-jazzy-interactive-marker-twist-server
sudo apt install ros-jazzy-cartographer-ros

Make sure you are sourcing the environment

echo "source /opt/ros/jazzy/setup.bash" >> ~/.bashrc
source ~/.bashrc

Download and extract this repo:

In new terminal paste the following commmands one-by-one

git clone https://github.com/akshat0605/ros_ws.git

# Go to home directory
cd ros_ws

# Build the workspace
colcon build

# Source the setup file to use built packages
source install/setup.bash
export GZ_SIM_RESOURCE_PATH=$HOME/ros_ws/src/gazebo_models

Once the build is successful, enter the following commands in the same terminal.

# Launch the robot simulation
ros2 launch bme_ros2_navigation spawn_robot.launch.py

If the simulation is launched witout any error, go to a new terminal and type the following commands:

# Run teleoperation node to control robot
ros2 run teleop_twist_keyboard teleop_twist_keyboard

Creating a package in ros2

#Go to the home directory:
cd 
# Create new workspace for custom packages
mkdir -p colcon_ws/src
cd ~/colcon_ws/src

# Create C++ and Python ROS2 packages
ros2 pkg create my_cpp_pkg --build-type ament_cmake --dependencies rclcpp
ros2 pkg create my_python_pkg --build-type ament_python --dependencies rclcpy

# Build the workspace and source it
cd ~/colcon_ws
colcon build
source install/setup.bash

Task:

Add Launch and Node Files

# Navigate to your new Python package
cd ~/colcon_ws/src/my_python_pkg

# Create a launch directory
mkdir launch

# Copy launch and node files from Downloads/src
cp -r $HOME/ros_ws/src/talker_listener.launch.py ~/colcon_ws/src/my_python_pkg/launch/
cp -r $HOME/ros_ws/src/talker.py ~/colcon_ws/src/my_python_pkg/my_python_pkg/
cp -r $HOME/ros_ws/src/listener.py ~/colcon_ws/src/my_python_pkg/my_python_pkg/

Update setup.py. Replace contents of setup.py with:

from setuptools import find_packages, setup

package_name = 'my_python_pkg'

setup(
    name=package_name,
    version='0.0.0',
    packages=find_packages(exclude=['test']),
    data_files=[
        ('share/ament_index/resource_index/packages',
            ['resource/' + package_name]),
        ('share/' + package_name, ['package.xml']),
        ('share/' + package_name + '/launch', ['launch/talker_listener.launch.py']),
    ],
    install_requires=['setuptools'],
    zip_safe=True,
    maintainer='akshat',
    maintainer_email='akshat.agarwal@iitg.ac.in',
    description='TODO: Package description',
    license='TODO: License declaration',
    extras_require={
        'test': [
            'pytest',
        ],
    },
    entry_points={
        'console_scripts': [
            'talker = my_python_pkg.talker:main',
            'listener = my_python_pkg.listener:main',
        ],
    },
)

Build and run the package:

# Rebuild workspace
cd ~/colcon_ws
colcon build
source install/setup.bash

In the same terminal, enter the following command:

ros2 run my_python_pkg talker #ctrl+c to kill the node

Open a new terminal and enter the following commands:

source install/setup.bash
ros2 run my_python_pkg listener #ctrl+c to kill the node

Open a third terminal and enter the following command to run the launch file

source install/setup.bash
ros2 launch my_python_pkg talker_listener.launch.py #ctrl+c to kill the nodes

About

Simultaneous Multi Robot Control using ROS for Inter IIT Bootcamp organized by Robotics club IITG

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages