Giter Site home page Giter Site logo

nhquanqt / sim-adapter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hcmus-robotics/ssdf-sim-adapter

0.0 0.0 0.0 48 KB

This is the package to fit simulators from the outside to our packages

License: MIT License

CMake 4.74% Python 95.26%

sim-adapter's Introduction

sim-adapter

This is the package to fit simulators from the outside to our packages

Installlation

Requirements

Run:

pip install -r requirements.txt

Current Supported Simulators

Currently, there are two types of simulation adapters we support: DiRA and UIT. To choose different adapters, you should add adapter argument (please see bin/node.py).

Publish topics:

  • rgb_topic: a topic to publish the image to the self-driving system. Default is /camera/rgb/image/compressed

Subscribe topics:

  • cmd_topic: a topic to set driving info sent from self-driving system. Default is /cmd_vel

Arguments/Parameters:

  • adapter: the value of adapter argument must be in [dira, uit].
  • (optional) is_show_image: whether to use cv2.imshow or not. Default is False
  • (optional) queue_size: the publish queue size. Default is 10

Build:

cd catkin_ws
catkin_make

Example:

rosrun sim_adapter node.py _adapter:=uit _is_show_image:=True

To verify that the simulator can receive the data from command topic such as /cmd_vel, run:

rostopic pub /cmd_vel geometry_msgs/Twist "linear:
  x: <speed>
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: <angle>"

Example:

rostopic pub /cmd_vel geometry_msgs/Twist "linear:
  x: 50.0
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 10.0"

DiRA Simulator

This simulation publishes the below topics which could be subsribed to by rosbridge-server package. In order to use this simulator, you should map the topics respectively. The publishing and subscribing topics belows are used for internal interacting with this simulation only.

Requirements:

Since DiRA Simulator uses rosbridge protocol, we should install it before using

sudo apt install ros-noetic-rosbridge-server

Subscribe topics:

  • dira_rgb_topic: a rgb image topic published by the simulator. It follows the pattern: /<team>/camera/rgb/compressed

where <team> is the team infomation set in the simulator.

Publish topics:

  • dira_speed_topic: a topic to set driving speed of the simulator. It follows the pattern: /<team>/set_speed
  • dira_angle_topic: a topic to set driving angle of the simulator. It follows the pattern: /<team>/set_angle

where <team> is the team infomation set in the simulator.

Example running command:

rosrun sim_adapter node.py _dira_rgb_topic:=/team220/camera/rgb/compressed _dira_speed_topic:=/team220/set_speed _dira_angle_topic:=/team220/set_angle _rgb_topic:=/camera/rgb/image/compressed _is_show_image:=true

Or run from a launch file (please see the launch file and override the arguments if need):

roslaunch sim_adapter dira.launch

UIT Simulator

This simulation send message via websocket. In order to use this simulator, you should choose the hostname and port number respectively.

Requirements:

Since UIT Simulator uses socketio, we should install it before using. Tested with python-socketio==5.4.0 and python-engineio==4.2.1. If you cannot receive images from the simulator. Please consider setting auto_connect=True or auto_connect=False. If it is still not resolved, please raise an issue.

pip install python-socketio==5.4.0 python-engineio==4.2.1 tornado

Parameters:

  • uit_hostname: hostname for the simulator to access. Default is 4567
  • uit_port: port number for the simulator to access. Default is 127.0.0.1

Example running command:

rosrun sim_adapter node.py _adapter:=uit _uit_hostname:=127.0.0.1 _uit_port:=4567 _is_show_image:=True

Or run from a launch file (please see the launch file and override the arguments if need):

roslaunch sim_adapter uit.launch

sim-adapter's People

Contributors

vinhloiit avatar nhquanqt 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.