I recommend to clone this repo in the same workspace you have the px4_msgs package -> Hence you would clone it in /px4_ws/src.
For it to work remember to use the appropiate namespace (same as the real BlueROV2 in the tank):
PX4_UXRCE_DDS_NS=itrl_rov_1 make px4_sitl_uuv gz_uuv_bluerov2_heavyYou can also try it in the KTH tank environment with:
PX4_UXRCE_DDS_NS=itrl_rov_1 PX4_GZ_WORLD=kth_marinarium make px4_sitl_uuv gz_uuv_bluerov2_heavyThere is also a version with the docking station:
PX4_GZ_WORLD=kth_marinarium_docking make px4_sitl_uuv gz_uuv_bluerov2_heavyRemember to run the Micro-XRCE-DDS-Agent:
micro-xrce-dds-agent udp4 -p 8888To launch the controller and the keyboard teleop, make sure you are in Offboard mode in QGC and:
cd ~/px4_ws
colcon build
source install/setup.bashExample for a robot namespace <ns> being <splash>:
ros2 launch bluerov2_control stabilized_control.launch.py ns:=splashIn a second terminal run the custom keyboard teleop:
ros2 run bluerov2_control wasd_teleopOr run joystick teleop for Xbox controllers where <joy_dev> is the selector between all connected controllers (i.e. 0 or 1 if two controllers are connected), and <cmd_vel_topic> is the topic we want to send the velocities to:
ros2 launch bluerov2_control teleop.launch.py joy_dev:=1 cmd_vel_topic:=/splash/cmd_velAlso, make sure to arm the vehicle after you run the controller node.
Same setup as Stabilized Control but run:
cd ~/px4_ws
colcon build
source install/setup.bash
# 1) Launch the nodes (heartbeat + PID)
ros2 launch bluerov2_control position_control_pid.launch.py
# 2) In a second terminal run the custom keyboard teleop
ros2 run bluerov2_control wasd_teleopYou will need to install casadi:
pip install casadiAnd then run:
cd ~/px4_ws
colcon build
source install/setup.bash
# 1) Launch the nodes (heartbeat + MPC)
ros2 launch bluerov2_control mpc_hold_position.launch.pyAcados is a fast nonlinear optimization library designed for embedded applications. To use it first install it following the official documentation:
git clone https://github.com/acados/acados.git
cd acados
git submodule update --recursive --init
mkdir -p build
cd build
cmake -DACADOS_WITH_QPOASES=ON ..
make install -j4
pip install -e ../interfaces/acados_templateThen you also need to add environment variables (if you have it in a folder inside $HOME make sure to point to it below):
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/acados/lib
export ACADOS_SOURCE_DIR=$HOME/acadosTo make them permanent, you can add those two lines to ~/.bashrc. You will also probably have to install the t_renderer, for that, download the latest one for your system here, rename it to just t_renderer and then inside your acados repository folder do:
mkdir -p binand place the renderer file there, then give it executable permissions:
chmod +x bin/t_rendererand verify:
ls -l bin/t_renderer
/bin/t_renderer --helpIf that last command runs, the renderer part is fixed.
Then build and launch:
cd ~/px4_ws
colcon build
source install/setup.bash
ros2 launch bluerov2_control mpc_hold_position_acados.launch.pySame installation instructions as the 6DoF MPC Holding controller (acados). It is currently setup for the Marinarium tank world with the docking station which is launch with:
PX4_UXRCE_DDS_NS=itrl_rov_1 PX4_GZ_WORLD=kth_marinarium_docking make px4_sitl_uuv gz_uuv_bluerov2_heavywith the goal to dock in the station. You can build and launch it with:
cd ~/px4_ws
colcon build
source install/setup.bash
ros2 launch bluerov2_control rrt_star_mpc_docking.launch.py