AP_MotorsUGV: pre arm check if regular and skid steering configured

This commit is contained in:
Randy Mackay 2017-12-09 15:54:22 +09:00
parent 78f732c380
commit ebe3ec88a7
2 changed files with 33 additions and 0 deletions

View File

@ -299,6 +299,36 @@ bool AP_MotorsUGV::output_test_pwm(motor_test_order motor_seq, float pwm)
return true;
}
// returns true if checks pass, false if they fail. report should be true to send text messages to GCS
bool AP_MotorsUGV::pre_arm_check(bool report) const
{
// check if both regular and skid steering functions have been defined
if (SRV_Channels::function_assigned(SRV_Channel::k_throttleLeft) &&
SRV_Channels::function_assigned(SRV_Channel::k_throttleRight) &&
SRV_Channels::function_assigned(SRV_Channel::k_throttle) &&
SRV_Channels::function_assigned(SRV_Channel::k_steering)) {
if (report) {
gcs().send_text(MAV_SEVERITY_CRITICAL, "PreArm: regular AND skid steering configured");
}
return false;
}
// check if only one of skid-steering output has been configured
if (SRV_Channels::function_assigned(SRV_Channel::k_throttleLeft) != SRV_Channels::function_assigned(SRV_Channel::k_throttleRight)) {
if (report) {
gcs().send_text(MAV_SEVERITY_CRITICAL, "PreArm: check skid steering config");
}
return false;
}
// check if only one of throttle or steering outputs has been configured
if (SRV_Channels::function_assigned(SRV_Channel::k_throttle) != SRV_Channels::function_assigned(SRV_Channel::k_steering)) {
if (report) {
gcs().send_text(MAV_SEVERITY_CRITICAL, "PreArm: check steering and throttle config");
}
return false;
}
return true;
}
// setup pwm output type
void AP_MotorsUGV::setup_pwm_type()
{

View File

@ -55,6 +55,9 @@ public:
// test steering or throttle output using a pwm value
bool output_test_pwm(motor_test_order motor_seq, float pwm);
// returns true if checks pass, false if they fail. display_failure argument should be true to send text messages to GCS
bool pre_arm_check(bool report) const;
// structure for holding motor limit flags
struct AP_MotorsUGV_limit {
uint8_t steer_left : 1; // we have reached the steering controller's left most limit