Files
rotor_py_control/rotorpy/trajectories/hover_traj.py
spencerfolk 4d7fca10e4 Init
2023-03-15 15:38:14 -04:00

42 lines
1.3 KiB
Python

import numpy as np
class HoverTraj(object):
"""
This trajectory simply has the quadrotor hover at the origin indefinitely.
By modifying the initial condition, you can create step response
experiments.
"""
def __init__(self):
"""
This is the constructor for the Trajectory object. A fresh trajectory
object will be constructed before each mission.
"""
def update(self, t):
"""
Given the present time, return the desired flat output and derivatives.
Inputs
t, time, s
Outputs
flat_output, a dict describing the present desired flat outputs with keys
x, position, m
x_dot, velocity, m/s
x_ddot, acceleration, m/s**2
x_dddot, jerk, m/s**3
x_ddddot, snap, m/s**4
yaw, yaw angle, rad
yaw_dot, yaw rate, rad/s
"""
x = np.zeros((3,))
x_dot = np.zeros((3,))
x_ddot = np.zeros((3,))
x_dddot = np.zeros((3,))
x_ddddot = np.zeros((3,))
yaw = 0
yaw_dot = 0
flat_output = { 'x':x, 'x_dot':x_dot, 'x_ddot':x_ddot, 'x_dddot':x_dddot, 'x_ddddot':x_ddddot,
'yaw':yaw, 'yaw_dot':yaw_dot}
return flat_output