mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-05 07:28:29 -04:00
Rover: balancebot_pitch_control method removes unused armed arg
Also remove constraint on throttle output (this is handle in the AP_MotorsUGV library Also move balance bot declarations to alphabetical order within Rover.h
This commit is contained in:
parent
961aab7425
commit
a5e28f0729
@ -388,6 +388,10 @@ private:
|
|||||||
void update_GPS(void);
|
void update_GPS(void);
|
||||||
void update_current_mode(void);
|
void update_current_mode(void);
|
||||||
|
|
||||||
|
// balance_bot.cpp
|
||||||
|
void balancebot_pitch_control(float &throttle);
|
||||||
|
bool is_balancebot() const;
|
||||||
|
|
||||||
// capabilities.cpp
|
// capabilities.cpp
|
||||||
void init_capabilities(void);
|
void init_capabilities(void);
|
||||||
|
|
||||||
@ -552,11 +556,6 @@ private:
|
|||||||
public:
|
public:
|
||||||
void mavlink_delay_cb();
|
void mavlink_delay_cb();
|
||||||
void failsafe_check();
|
void failsafe_check();
|
||||||
|
|
||||||
// BalanceBot.cpp
|
|
||||||
void balancebot_pitch_control(float &, bool);
|
|
||||||
bool is_balancebot() const;
|
|
||||||
|
|
||||||
void update_soft_armed();
|
void update_soft_armed();
|
||||||
// Motor test
|
// Motor test
|
||||||
void motor_test_output();
|
void motor_test_output();
|
||||||
|
@ -2,16 +2,13 @@
|
|||||||
#include "Rover.h"
|
#include "Rover.h"
|
||||||
|
|
||||||
// Function to set a desired pitch angle according to throttle
|
// Function to set a desired pitch angle according to throttle
|
||||||
void Rover::balancebot_pitch_control(float &throttle, bool armed)
|
void Rover::balancebot_pitch_control(float &throttle)
|
||||||
{
|
{
|
||||||
// calculate desired pitch angle
|
// calculate desired pitch angle
|
||||||
const float demanded_pitch = radians(-throttle * 0.01f * g2.bal_pitch_max);
|
const float demanded_pitch = radians(-throttle * 0.01f * g2.bal_pitch_max);
|
||||||
|
|
||||||
// calculate required throttle using PID controller
|
// calculate required throttle using PID controller
|
||||||
const float balance_throttle = g2.attitude_control.get_throttle_out_from_pitch(demanded_pitch, g2.motors.limit.throttle_lower, g2.motors.limit.throttle_upper, G_Dt) * 100.0f;
|
throttle = g2.attitude_control.get_throttle_out_from_pitch(demanded_pitch, g2.motors.limit.throttle_lower, g2.motors.limit.throttle_upper, G_Dt) * 100.0f;
|
||||||
|
|
||||||
// constrain throttle between -100 and 100
|
|
||||||
throttle = constrain_float(balance_throttle, -100.0f, 100.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true if vehicle is a balance bot
|
// returns true if vehicle is a balance bot
|
||||||
|
@ -267,7 +267,7 @@ void Mode::calc_throttle(float target_speed, bool nudge_allowed, bool avoidance_
|
|||||||
|
|
||||||
// if vehicle is balance bot, calculate actual throttle required for balancing
|
// if vehicle is balance bot, calculate actual throttle required for balancing
|
||||||
if (rover.is_balancebot()) {
|
if (rover.is_balancebot()) {
|
||||||
rover.balancebot_pitch_control(throttle_out, rover.arming.is_armed());
|
rover.balancebot_pitch_control(throttle_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
// send to motor
|
// send to motor
|
||||||
@ -283,7 +283,7 @@ bool Mode::stop_vehicle()
|
|||||||
|
|
||||||
// if vehicle is balance bot, calculate actual throttle required for balancing
|
// if vehicle is balance bot, calculate actual throttle required for balancing
|
||||||
if (rover.is_balancebot()) {
|
if (rover.is_balancebot()) {
|
||||||
rover.balancebot_pitch_control(throttle_out, rover.arming.is_armed());
|
rover.balancebot_pitch_control(throttle_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
// send to motor
|
// send to motor
|
||||||
|
@ -7,7 +7,7 @@ void ModeHold::update()
|
|||||||
|
|
||||||
// if vehicle is balance bot, calculate actual throttle required for balancing
|
// if vehicle is balance bot, calculate actual throttle required for balancing
|
||||||
if (rover.is_balancebot()) {
|
if (rover.is_balancebot()) {
|
||||||
rover.balancebot_pitch_control(throttle, rover.arming.is_armed());
|
rover.balancebot_pitch_control(throttle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// hold position - stop motors and center steering
|
// hold position - stop motors and center steering
|
||||||
|
@ -15,7 +15,7 @@ void ModeManual::update()
|
|||||||
|
|
||||||
// if vehicle is balance bot, calculate actual throttle required for balancing
|
// if vehicle is balance bot, calculate actual throttle required for balancing
|
||||||
if (rover.is_balancebot()) {
|
if (rover.is_balancebot()) {
|
||||||
rover.balancebot_pitch_control(desired_throttle, rover.arming.is_armed());
|
rover.balancebot_pitch_control(desired_throttle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy RC scaled inputs to outputs
|
// copy RC scaled inputs to outputs
|
||||||
|
Loading…
Reference in New Issue
Block a user