IMRCLab / crazyswarm2

A Large Quadcopter Swarm
MIT License
110 stars 57 forks source link

Teleop: add higher-level manual flight #13

Closed whoenig closed 2 years ago

whoenig commented 2 years ago

Currently, teleoperation only supports low-level flight, where a user controls roll, pitch, yawrate, and thrust. It would be nice to have a mode where a user controls the position (+velocity) setpoint instead. Ideally, one can also specify a "safe bounding box", so that it is impossible to crash the quadrotor.

whoenig commented 2 years ago

Steps (in teleop.cpp):

  1. Use a virtual single integrator, that is i) introduce a state that tracks desired x,y,z, yaw and velocities (vx, vy, vz, omega_z), ii) On a joystick (axis) change, interpret the changes as a velocity input (i.e., vx, vy, vz, and omega_z) and update the desired position (using euler-integration).
  2. Introduce a position bounding box (parameter). Clip/clamp the position to always stay within this safe region.
  3. Construct a cmd_full_state message and send it at regular intervals (e.g., 100 Hz), similar to how cmd_vel is currently handled.

Note: Start by initializing the the desired state with all zeros. Later, we need a smarter way to handle takeoff/landing and only allow the cmd_full_state control after takeoff.

whoenig commented 2 years ago

Fixed in PR #15.