OFFBOARD control is dangerous.
If you are operating on a real vehicle be sure to have a way of gaining back manual control in case something goes wrong.
-
include/offboard/offboard.h: header offboard
-
src/offboard_node.cpp: offboard node source code
-
src/offboard_lib.cpp: library for offboard node
-
src/setmode_offb.cpp: set OFFBOARD mode and ARM vehicle in simulation
-
launch/offboard.launch: launch file, include parameter
- ROS: tested on ROS Melodic (Ubuntu 18.04)
- PX4 Firmware: tested on v10.0.1 - setup here
- Catkin workspace:
catkin_ws
## create a workspace if you've not had one mkdir -p [path/to/ws]/catkin_ws/src cd [path/to/ws]/catkin_ws
catkin init catkin config --extend /opt/ros/melodic catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release catkin config --merge-devel catkin build
- MAVROS: binary installation - setup here
cd [path/to/ws]/catkin_ws/src
git clone https://github.com/catkin/catkin_simple.git
git clone https://github.com/ethz-asl/eigen_catkin.git
git clone https://github.com/ethz-asl/eigen_checks.git
git clone https://github.com/ethz-asl/nlopt.git
git clone https://github.com/ethz-asl/glog_catkin.git
git clone https://github.com/ethz-asl/mav_comm.git
git clone https://github.com/ethz-asl/yaml_cpp_catkin.git
git clone https://github.com/ethz-asl/mav_trajectory_generation.git
cd [path/to/ws]/catkin_ws
catkin build
cd [path/to/ws]/catkin_ws/src
git clone https://github.com/congtranv/offboard.git
cd [path/to/ws]/catkin_ws
catkin build offboard
IVSR Tutorial: Read from onedrive
Before run OFFBOARD node, check and modify (if need) the value of parameters in launch/offboard.launch
- HOVERING: drone hover at
z
meters (input from keyboard) inhover_time
seconds (change in launch/offboard.launch) - MISSION: fly with the local/GPS setpoints that prepared in launch/offboard.launch or input from keyboard
Refer the test_case.md for all detail use cases of OFFBOARD node
roslaunch px4 mavros_posix_sitl.launch
If run OFFBOARD Mission with Delivery mode (landing at each setpoint) -
(roslaunch offboard offboard.launch simulation:=true delivery:=true z_delivery:=0.0
)
In this terminal (Run PX4 simulation), run param set COM_DISARM_LAND -1
to disable auto disarm when land of pixhawk:
pxh> param set COM_DISARM_LAND -1
When done, set COM_DISARM_LAND
to 2
for enable auto disarm after land 2 seconds:
pxh> param set COM_DISARM_LAND 2
roslaunch offboard offboard.launch simulation:=true
If forgot parameter simulation
, can use setmode node (in another terminal)
rosrun offboard setmode_offb
(maybe have to run twice for ARM and Switch OFFBOARD mode)
Before run OFFBOARD Mission with Delivery mode (landing at each setpoint) (roslaunch offboard offboard.launch delivery:=true z_delivery:=0.0
), use QGround Control to set parameter COM_DISARM_LAND
to -1
(disable) for disable auto disarm when drone landed.
Use Remote controller to DISARM when mission completed
When practice done, HAVE TO set COM_DISARM_LAND
to 2
for enable auto DISARM when drone landed after 2 seconds.
roslaunch mavros px4.launch fcu_url:=/dev/ttyTHS1:921600
roslaunch offboard offboard.launch
Use Remote controller to ARM and switch flight mode to OFFBOARD