github original : (https://github.com/patrickelectric/bluerov_ros_playground)
See more documentation : https://acolor-bluerov2.gitbook.io/acolor-bluerov2/
Scripts to help BlueRov integration with ROS. What is possible ?
- Video streaming capture with opencv
- Read and write over mavlink protocol with MAVROS
- Joystick interaction
- Gazebo simulation
- git
- ros-*-desktop-full
- kinetic or newer
- mavros
- python
- opencv_python
- numpy
- gi, gobject
- PyYAML
- freefloating_gazebo
- Go to your ROS package source directory:
$ cd ros_workspace_path/src
- Clone this project.
$ git clone https://github.com/patrickelectric/bluerov_ros_playground
- Go back to your ROS workspace:
$ cd ../
- Build and install it:
$ catkin_make --pkg bluerov_ros_playground
- if using ROS from source:
$./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --pkg bluerov_ros_playground
- Reload your ROS env.
- bash:
$ source devel/setup.sh
- zsh:
$ source devel/setup.sh
- bash:
-
BlueRov2 node
For more information check here.
-
Launch user example
This example will start user example, reading data from mavlink, interacting with joystick over rc commands and showing ROV video stream.
roslaunch bluerov_ros_playground user_mav.launch
To run QGC parallel with user_mav, it's necessary to run user_mav first. If it's necessary to change the input, the parameter
joy_dev
can be used to set the one used. -
Visualize video stream
Shows video stream using opencv and gstreamer
roslaunch bluerov_ros_playground video.launch
To capture video stream in user_mav/video and QGC at same time, it's necessary to modifie gstreamer options, changing
! udpsink host=192.168.2.1 port=5600
to! multiudpsink clients=192.168.2.1:5600,192.168.2.1:5601
and add the udp_port parameter when calling roslaunch (video_udp_port:=5601
). -
Gazebo
This example allow SITL communication with Gazebo, right now the only interaction that happen is the thruster control using thruster pwm fitting.
- Run SITL and start gazebo.launch
roslaunch bluerov_ros_playground gazebo.launch
-
Gazebo Teleop
It'll open a window with the camera stream and Gazebo, a joystick can be used to control the ROV.
roslaunch bluerov_ros_playground gazebo_teleop.launch
To change the default joystick input (
/dev/input/js0
), it's possible add the parameterjoy_dev:=/dev/input/jsX
when launching the simulation. -
RVIZ
Visualize 3D model
roslaunch bluerov_ros_playground rviz.launch
-
Run ArduPilot SITL
- Download ArduPilot and configure SITL.
$ cd ardupilot/ArsuSub
$ sim_vehicle.py
- To test mavros communication with SITL:
$ roslaunch mavros apm.launch fcu_url:=udp://0.0.0.0:14550@
-
Fake video stream
$ gst-launch-1.0 videotestsrc ! video/x-raw,width=640,height=480 ! videoconvert ! x264enc ! rtph264pay ! udpsink host=127.0.0.1 port=5600
- If necessary, change video source and resolution.
- To test the udp reception:
gst-launch-1.0 -v udpsrc port=5600 ! application/x-rtp, payload=96 ! rtpjitterbuffer ! rtph264depay ! avdec_h264 ! fpsdisplaysink sync=false text-overlay=false
If you need more information about the topics and what you can access, take a look here.
+-----------------------+ +------------------------+ | Raspberry Pi | | Topside Computer | | ip 192.168.2.2 | | ip 192.168.2.1 | | | | | +-------+ Telemetry | +-------------------+ | | | |Pixhawk<-------------->USB MAVProxy| | | | +-------+ Pilot | + + | | +--------------------+ | Control | | udpbcast<----------->:14550 MAVROS| | | +-------------------+ | Pilot | |(UDP) | | | | Control | | | | | +-------------------+ | | | (ROS) | | +---------+ | CSI+2 raspivid| | | +------+/mavros+-----+ | |Raspberry+------------>camera | | | ^ | | Camera | | port | | | | | +---------+ | + | | | +---------v----------+ | | | | | | |subs.py pubs.py| | | +------------+stdout+ | | | | | | + | | | | | | Raw | | | | | | | H264 | | | | | | | v | | | user.py | | | +------------+ fdsrc+ | | | | | | |gstreamer | | | | | | | | + | | :5600 video.py | | | | udpsink+----------->(UDP) | | | +-------------------+ | Video | +---------^----------+ | | | Stream | | | +-----------------------+ | + | | +--------/joy--------+ | | |joy (ROS) | | +--------+ | | USB<----------+Joystick| | +--------------------+ | Pilot +--------+ | | Control +------------------------+