APM:Libraries
|
#include <SIM_Calibration.h>
Public Member Functions | |
Calibration (const char *home_str, const char *frame_str) | |
void | update (const struct sitl_input &input) |
![]() | |
Aircraft (const char *home_str, const char *frame_str) | |
void | set_speedup (float speedup) |
void | set_instance (uint8_t _instance) |
void | set_autotest_dir (const char *_autotest_dir) |
virtual void | set_interface_ports (const char *address, const int port_in, const int port_out) |
void | fill_fdm (struct sitl_fdm &fdm) |
void | smooth_sensors (void) |
float | get_rate_hz (void) const |
const Vector3f & | get_gyro (void) const |
const Vector3f & | get_velocity_ef (void) const |
const Vector3f & | get_velocity_air_ef (void) const |
const Matrix3f & | get_dcm (void) const |
const Vector3f & | get_mag_field_bf (void) const |
virtual float | gross_mass () const |
const Location & | get_location () const |
const Vector3f & | get_position () const |
void | get_attitude (Quaternion &attitude) const |
Static Public Member Functions | |
static Aircraft * | create (const char *home_str, const char *frame_str) |
![]() | |
static double | rand_normal (double mean, double stddev) |
static bool | parse_home (const char *home_str, Location &loc, float &yaw_degrees) |
Private Member Functions | |
void | _stop_control (const struct sitl_input &input, Vector3f &rot_accel) |
void | _attitude_set (float desired_roll, float desired_pitch, float desired_yaw, Vector3f &rot_accel) |
void | _attitude_control (const struct sitl_input &input, Vector3f &rot_accel) |
void | _angular_velocity_control (const struct sitl_input &input, Vector3f &rot_accel) |
void | _calibration_poses (Vector3f &rot_accel) |
Simulation model to simulate calibration of accelerometers and compasses.
The vehicle rotation can be controlled by sending PWM values to the servos input, denoted by PWM[i] for the i-th channel (starting by zero). All PWM values must be in [1000, 2000], otherwise that will cause undefined behavior.
There are four control modes, that are set with PWM[4]:
1) Stop (1000 <= PWM[4] < 1100): Stop the vehicle, i.e., stop the actuation of the other modes.
2) Attitude (1100 <= PWM[4] < 1200): Rotate the vehicle to the specified attitude. The attitude is defined with the PWM channels 5, 6 and 7 for roll, pitch and yaw angles, respectively. The PWM value for a desired angle in radians is given by:
pwm(theta) = 1500 + 500 * round(theta / pi) where -pi <= theta <= pi
3) Simple autonomous compass calibration (1200 <= PWM[4] < 1300): Move continuously the vehicle through six calibration poses and do a rotation about each pose over a short period of time.
4) Angular Velocity (1300 <= PWM[4] <= 2000): Rotate the vehicle at a desired angular velocity. The angular velocity is specified by a rotation axis and an angular speed.
The x, y and z components of the rotation axis is given, respectively, by the PWM channels 5, 6 and 7 with an offset of 1500. The rotation axis is normalized internally, so that PWM[5,6,7] = [1600, 1300, 0] and PWM[5,6,7] = [1700, 1100, 0] means the same normalized rotation axis.
The angular speed value is specified by PWM[4]. The PWM value for a desired angular speed in radians/s is given by:
pwm(theta) = 1300 + 700 * round(theta / (2 * pi)), where 0 <= theta <= 2 * pi
Definition at line 65 of file SIM_Calibration.h.
SITL::Calibration::Calibration | ( | const char * | home_str, |
const char * | frame_str | ||
) |
Definition at line 27 of file SIM_Calibration.cpp.
Referenced by create().
|
private |
Definition at line 106 of file SIM_Calibration.cpp.
Referenced by create(), and update().
|
private |
Definition at line 68 of file SIM_Calibration.cpp.
Referenced by create(), and update().
|
private |
Definition at line 79 of file SIM_Calibration.cpp.
Referenced by _attitude_control(), and create().
|
private |
Definition at line 131 of file SIM_Calibration.cpp.
Referenced by create(), and update().
|
private |
Definition at line 57 of file SIM_Calibration.cpp.
Referenced by create(), and update().
|
inlinestatic |
|
virtual |
Implements SITL::Aircraft.
Definition at line 33 of file SIM_Calibration.cpp.