Utils#
There are a number of support functions and classes included in progpy.utils. These utilities are used throughout the package, but are also available for use in your own code.
Trajectory#
- class progpy.utils.traj_gen.Trajectory(lat, lon, alt, takeoff_time=None, etas=None, **kwargs)#
Trajectory class.
This class generates a trajectory object that is used to create a smooth profile including position, velocity, acceleration, Euler’s angles, and attitude rates. The profiles are used to generate the desired state of a vehicle that needs to be followed to complete the trajectory.
- Parameters
lat (np.ndarray) – rad, n x 1 array, doubles, latitude coordinates of waypoints
lon (np.ndarray) – rad, n x 1 array, doubles, longitude coordinates of waypoints
alt (np.ndarray) – m, n x 1 array, doubles, altitude coordinates of waypoints
takeoff_time (float, optional) – take off time of the trajectory. Default is None (starting at current time).
etas (list[float], optional) – ETAs of each waypoints. Default is None. In that case, the ETAs are calculated based on the desired speed between waypoints.
- kwargs:
- gravity (float, optional):
Magnitude of force of gravity. Default 9.81 m/s^2
- max_phi (float, optional):
Maximum Euler’s angle (rad). Default 45/180.0*np.pi
- max_theta (float, optional):
maximum Euler’s angle (rad). Default 45/180.0*np.pi
- max_iter (int, optional):
maximum number of iterations to adjust the trajectory according to the maximum average jerk. Default: 10
- max_avgjerk (float, optional):
maximum average Jerk allowed (m/s^3), if the generated trajectory has a higher value, new, more forgiving ETAs are generated to satisfy this constraint. Default: 20
- nurbs_order (int, optional):
order of the NURBS used to generate the position profile. Default: 4
- waypoint_weight (int, optional):
default weight value associated to all the waypoints. Default: 20
- weight_vector (np.ndarray, optional):
Waypoint weight vector. Default is None (all waypoints will have same value from ‘waypoint_weight’). If passed, the user can define different weight for each waypoints, such that some waypoints will be approached more closely and some will be approached more smoothly.
- nurbs_basis_length (int, optional):
default length of basis function used to generate the position profile with the NURBS.Default: 1000
- cruise_speed (float, optional):
desired cruise speed between waypoints (m/s). If ETAs are provided, this value is ignored. Default = 6.0.
- ascent_speed (float, optional):
desired ascent speed (m/s) between waypoints. If ETAs are provided, this value is ignored. Defualt: 3
- descent_speed (float, optional):
desired descent speed (m/s) between waypoints. If ETAs are provided, this value is ignored. Default: 3
- landing_speed (float, optional):
desired landing speed (m/s) between waypoints. This speed is used when the vehicle’s altitude is lower than ‘landing_altitude’ parameter. If ETAs are provided, this value is ignored. Default: 1.5
- landing_altitude (float, optional):
landing altitude (m) below which the vehicle is supposed to move at ‘landing_speed’. Default: 10.5
- generate(dt, **kwargs)#
Generate trajectory given the waypoints and desired velocity or ETAs. The function requires the time step size dt, in seconds, used to interpolate the waypoints and generate the trajectory.
- Parameters
dt – s, scalar, time step size used to interpolate the waypoints and generate the trajectory
- Returns
dictionary of state variables describing the trajectory as a function of time