vmount: Store offset in radians and calculated scale factor in OutputConfig instead of raw parameters.

This commit is contained in:
Matthew Edwards
2017-10-21 10:29:37 +13:00
committed by Beat Küng
parent ccf3e71b56
commit fdf4eb0bd6
4 changed files with 25 additions and 24 deletions
+3 -6
View File
@@ -74,12 +74,9 @@ int OutputRC::update(const ControlData *control_data)
actuator_controls_s actuator_controls;
actuator_controls.timestamp = hrt_absolute_time();
// _angle_outputs are in radians, actuator_controls are in [-1, 1]
actuator_controls.control[0] = (_angle_outputs[0] + _config.roll_offset * M_DEG_TO_RAD_F) /
(_config.roll_range * (M_DEG_TO_RAD_F / 2.0f));
actuator_controls.control[1] = (_angle_outputs[1] + _config.pitch_offset * M_DEG_TO_RAD_F) /
(_config.pitch_range * (M_DEG_TO_RAD_F / 2.0f));
actuator_controls.control[2] = (_angle_outputs[2] + _config.yaw_offset * M_DEG_TO_RAD_F) /
(_config.yaw_range * (M_DEG_TO_RAD_F / 2.0f));
actuator_controls.control[0] = (_angle_outputs[0] + _config.roll_offset) * _config.roll_scale;
actuator_controls.control[1] = (_angle_outputs[1] + _config.pitch_offset) * _config.pitch_scale;
actuator_controls.control[2] = (_angle_outputs[2] + _config.yaw_offset) * _config.yaw_scale;
actuator_controls.control[3] = _retract_gimbal ? _config.gimbal_retracted_mode_value : _config.gimbal_normal_mode_value;
int instance;