28 #define AUTOPILOT_CORE_GUIDANCE_C
31 #include "generated/airframe.h"
32 #include "generated/autopilot_core_guidance.h"
37 #if PERIODIC_TELEMETRY
59 #if PERIODIC_TELEMETRY
64 autopilot_core_guidance_init();
70 autopilot_core_guidance_periodic_task();
78 #define MAX_POS_ERR 10.f // max position error
79 #define MAX_SPEED_ERR 10.f // max speed error
80 #define MAX_INTEGRAL_CMD (MAX_PPRZ / 10.f) // 10% of max command
81 #define PROXIMITY_DIST 0.5f // proximity distance TODO improve
186 #ifdef ROVER_GUIDANCE_MODE_GUIDED
187 void rover_guidance_guided_run(
bool in_flight)
191 rover_guidance_hover_enter();
195 rover_guidance_traj_run(in_flight);
198 bool rover_guidance_set_guided_pos(
float x,
float y)
209 bool rover_guidance_set_guided_heading(
float heading)
220 bool rover_guidance_set_guided_body_vel(
float vx,
float vy)
223 float newvx = cosf(-psi) * vx + sinf(-psi) * vy;
224 float newvy = -sinf(-psi) * vx + cosf(-psi) * vy;
225 return rover_guidance_set_guided_vel(newvx, newvy);
228 bool rover_guidance_set_guided_vel(
float vx,
float vy)
239 bool rover_guidance_set_guided_heading_rate(
float rate)
#define FLOAT_ANGLE_NORMALIZE(_a)
struct RoverGuidancePID speed_pid
motor speed controller
#define FLOAT_VECT2_ZERO(_v)
static float stateGetHorizontalSpeedNorm_f(void)
Get norm of horizontal ground speed (float).
struct FloatVect2 speed
speed setpoint
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
Periodic telemetry system header (includes downlink utility and generated code).
void rover_guidance_run(float *heading_sp)
float heading
heading setpoint
struct RoverGuidancePID turn_pid
turn rate controller
#define VECT2_DIFF(_c, _a, _b)
struct RoverGuidance rover_guidance
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
static float compute_pid(struct RoverGuidancePID *pid)
void rover_guidance_periodic(void)
Basic guidance for rover.
static float float_vect2_norm(struct FloatVect2 *v)
void rover_guidance_set_turn_igain(uint32_t igain)
uint8_t mask
bit 5: vx & vy, bit 6: vz, bit 7: vyaw
void rover_guidance_enter(void)
static struct FloatRates * stateGetBodyRates_f(void)
Get vehicle body angular rate (float).
struct RoverGuidanceSetpoint sp
setpoints
void rover_guidance_set_speed_igain(uint32_t igain)
struct RoverGuidanceControl cmd
commands
API to get/set the generic vehicle states.
struct FloatVect2 pos
position setpoint in NED.
void rover_guidance_init(void)