|
|
|
@ -33,6 +33,10 @@ void Tracker::update_pitch_servo(float pitch)
@@ -33,6 +33,10 @@ void Tracker::update_pitch_servo(float pitch)
|
|
|
|
|
update_pitch_onoff_servo(pitch); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case SERVO_TYPE_CR: |
|
|
|
|
update_pitch_cr_servo(pitch); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case SERVO_TYPE_POSITION: |
|
|
|
|
default: |
|
|
|
|
update_pitch_position_servo(pitch); |
|
|
|
@ -135,6 +139,16 @@ void Tracker::update_pitch_onoff_servo(float pitch)
@@ -135,6 +139,16 @@ void Tracker::update_pitch_onoff_servo(float pitch)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
update the pitch for continuous rotation servo |
|
|
|
|
*/ |
|
|
|
|
void Tracker::update_pitch_cr_servo(float pitch) |
|
|
|
|
{ |
|
|
|
|
float ahrs_pitch = degrees(ahrs.pitch); |
|
|
|
|
float err_cd = (ahrs_pitch - pitch) * 100.0f; |
|
|
|
|
channel_pitch.servo_out = g.pidPitch2Srv.get_pid(err_cd); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
update the yaw (azimuth) servo. |
|
|
|
|
*/ |
|
|
|
@ -145,6 +159,10 @@ void Tracker::update_yaw_servo(float yaw)
@@ -145,6 +159,10 @@ void Tracker::update_yaw_servo(float yaw)
|
|
|
|
|
update_yaw_onoff_servo(yaw); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case SERVO_TYPE_CR: |
|
|
|
|
update_yaw_cr_servo(yaw); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case SERVO_TYPE_POSITION: |
|
|
|
|
default: |
|
|
|
|
update_yaw_position_servo(yaw); |
|
|
|
@ -307,3 +325,15 @@ void Tracker::update_yaw_onoff_servo(float yaw)
@@ -307,3 +325,15 @@ void Tracker::update_yaw_onoff_servo(float yaw)
|
|
|
|
|
channel_yaw.servo_out = 18000; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
update the yaw continuous rotation servo |
|
|
|
|
*/ |
|
|
|
|
void Tracker::update_yaw_cr_servo(float yaw) |
|
|
|
|
{ |
|
|
|
|
int32_t ahrs_yaw_cd = wrap_180_cd(ahrs.yaw_sensor); |
|
|
|
|
float yaw_cd = wrap_180_cd_float(yaw*100.0f); |
|
|
|
|
float err_cd = wrap_180_cd((float)ahrs_yaw_cd - yaw_cd); |
|
|
|
|
|
|
|
|
|
channel_yaw.servo_out = g.pidYaw2Srv.get_pid(err_cd); |
|
|
|
|
} |
|
|
|
|