23 #define MAX_ANGULAR_SPEED (2 * M_PI) 37 float switcher_pwm = input.
servos[4];
38 if (switcher_pwm < 1100) {
40 }
else if (switcher_pwm < 1200) {
42 }
else if (switcher_pwm < 1300) {
63 rot_accel = error * (1.0f / dt);
71 float desired_roll = -
M_PI + 2 *
M_PI * (input.
servos[5] - 1000) / 1000.
f;
72 float desired_pitch = -
M_PI + 2 *
M_PI * (input.
servos[6] - 1000) / 1000.
f;
73 float desired_yaw = -
M_PI + 2 *
M_PI * (input.
servos[7] - 1000) / 1000.
f;
75 _attitude_set(desired_roll, desired_pitch, desired_yaw, rot_accel);
85 desired_q.
from_euler(desired_roll, desired_pitch, desired_yaw);
98 Vector3f desired_angvel = angle_differential * (1 / dt);
100 desired_angvel *= .005f;
103 rot_accel = error * (1.0f / dt);
110 (float)(in.
servos[6] - 1500),
111 (float)(in.
servos[7] - 1500)};
115 if (axis.length() > 0) {
119 Vector3f desired_angvel = axis * theta;
122 rot_accel = error * (1.0f / dt);
134 int16_t roll, pitch, yaw;
156 const float secs_per_pose = 6;
157 const float rate =
radians(360 / secs_per_pose);
159 float t_in_pose = fmod(tnow, secs_per_pose);
160 uint8_t pose_num = ((unsigned)(tnow / secs_per_pose)) %
ARRAY_SIZE(poses);
161 const struct pose &pose = poses[pose_num];
170 float rot_angle = rate * t_in_pose;
void to_axis_angle(Vector3f &v)
void from_axis_angle(const Vector3< T > &v, float theta)
void update(const struct sitl_input &input)
void from_euler(float roll, float pitch, float yaw)
void from_euler(float roll, float pitch, float yaw)
void _attitude_set(float desired_roll, float desired_pitch, float desired_yaw, Vector3f &rot_accel)
void from_rotation_matrix(const Matrix3f &m)
void _angular_velocity_control(const struct sitl_input &input, Vector3f &rot_accel)
void _attitude_control(const struct sitl_input &input, Vector3f &rot_accel)
void _stop_control(const struct sitl_input &input, Vector3f &rot_accel)
void _calibration_poses(Vector3f &rot_accel)
void update_mag_field_bf(void)
#define MAX_ANGULAR_SPEED
void update_position(void)
static constexpr float radians(float deg)
void update_dynamics(const Vector3f &rot_accel)
#define error(fmt, args ...)
Calibration(const char *home_str, const char *frame_str)