Clone this repository, then change into the cloned directory.
- python3 -m venv venv
- source venv/bin/activate
- pip install -e .
- python -m venv venv
- cd into the folder venv/Scripts
- activate
- navitage back to the root directory of the project
- pip install -e .
This script will prompt you to select a skyc file, and will evaluate it, providing animation and diagrams.
With the Trajectory class and the write_skyc function, you can craft a trajectory
and then write it to a skyc file. Take a look at the provided example.py for an example.
To make a trajectory, you must initialize it by providing its type ("POLY4D" or "COMPRESSED").
By default POLY4D trajectories are of degree 5, and COMPRESSED ones are of degree 3, although
you can overwrite this in the Trajectory.degree variable. The first order of business when it
comes to a Trajectory is defining its starting point with Trajectory.set_start. After that,
you may add whatever gotos you would like using add_goto. A goto consists of an XYZYaw
object, each dimension of which may be an iterable. In this iterable, you can specify the desired
position, velocity and acceleration at the end of the goto. Take care to provide constraints that
make sense mathematically. For example:
- if your Trajectory is degree 3, you can't give acceleration constraints, since to match the position, velocity, and acceleration both at the start and end of the goto segment, you would need 6 variables; a degree 3 Trajectory can only have 4.
- if your goto has velocity a constraint, give continuity of at least 2 (default is 3). Obviously, with a continuity of 1, the resulting goto segment will only be continuous in position, and will therefore violate your constraints.
In summary, make sure that the continuity of your goto segments (1 to 3) is less than half of the degree of your Trajectory (POLY4D->5, COMPRESSED->3), and set your goto constraints accordingly.
If you want a more complex Trajectory, provide a list of t-x-y-z-heading data, where each coordinate
is a list of equal length. That way, the first iterable in the list is the timestamps, the second
is the x positions corresponding to the timestamps, and so on. The function add_interpolated_traj
will fit bezier segments to this data. If you want your trajectory to transition smoothly into this
part of the trajectory, then add a goto with the trajectory's starting conditions before adding
the interpolated trajectory.
Once you're satisfied with your Trajectory, generate it with write_skyc. This function expects a
list of Trajectory objects, since you may want to include several drones in your skyc file. If you
only have one, provide a list with only one element.