Skip to content

Latest commit

 

History

History
65 lines (59 loc) · 1.3 KB

README.md

File metadata and controls

65 lines (59 loc) · 1.3 KB

ROS2 Iron Docker

Features

  • Gazebo
  • Rviz2
  • Python-Websocket to ROS2 interface

Prerequisites

  • docker
  • docker-compose
  • VSCode
  • Dev Containers VSCode extension
  • Postman (Optional)

Preparation

Inside vscode, with Dev Containers installed press ctrl+shift+P and type 'rebuild and reopen in container'. Wait until docker build the container and then in a new terminal run:

cd main
pip3 install -r requirements.txt

Examples

Python to Gazebo ROS Topic Example

Inside a terminal run:

gazebo --verbose /opt/ros/iron/share/gazebo_plugins/worlds/gazebo_ros_diff_drive_demo.world

In another terminal inside /main, to make the robot move run:

python3 start.py

And to stop it run:

python3 stop.py

Python-WebSocket to ROS2 interface

In a terminal inside /main, run:

python3 websocket-ros2-interface.py

It should print "Server started at ws://{local_ip}:{port}". From a WebSocket Client connect to ws://{local_ip}:{port}/{client_name} and send a json with this format:

{
    "acceleration": {
        "x": 1.0, 
        "y": 2.0, 
        "z": 3.0
    }, 
    "angular_velocity": {
        "x": 0.1, 
        "y": 0.2, 
        "z": 0.3
    }
}

Finally you can check if this worked from ROS:

ros2 topic echo imu_data