Helper scripts and programs for trajectories to be used on UAVs
Parts of this software are based on [mav_trajectory_generation]: https://github.com/ethz-asl/mav_trajectory_generation, a software package developed at ETH Zurich, implementing a trajectory optimization approach developed at MIT. When using this work academically, follow their instructions on how to cite their work. We use the provided library in that package, but do not require ROS for execution.
Tested on Ubuntu 16.04. Install additional dependencies using:
sudo apt install libnlopt-dev libgoogle-glog-dev
Clone and build this repository:
git clone --recursive https://github.com/whoenig/uav_trajectories.git
mkdir uav_trajectories/build
cd uav_trajectories/build
cmake ..
make
This program takes a sequence of waypoints and dynamic quadrotor limits as inputs, and produces a smooth trajectory (with 0 derivatives at the beginning and end) that can be executed safely. All waypoints will be visited in order and the time of arrival at a waypoint is computed automatically.
Example:
./genTrajectory -i ../examples/waypoints1.csv --v_max 1.0 --a_max 1.0 -o traj1.csv
This python script fits an 8th order polynomial through the given time/position pair. This can be useful to define a choreography of multiple UAVs. All derivatives are 0 at the beginning and the end.
Example:
python3 ../examples/circle_with_time.py
python3 ../scripts/generate_trajectory.py timed_waypoints_circle0.csv circle0.csv --pieces 5
Here, the first script generates timed waypoints and writes them into csv files. The second script fits 5 pieces of an 8th-order spline through the generated waypoints.
A python script can be used to visualize a trajectory csv-file (3D plot, velocity, acceleration, angular velocity, yaw).
Example:
python3 ../scripts/plot_trajectory.py traj1.csv
This python scripts takes the trajectory generated by genTrajectory, and converts it to a bezier defined between times [0,1]. You should evaluate this bezier for a given time with f(t/duration).
Example:
python3 ../scripts/convert_to_bezier.py traj1.csv bezier1.csv