mirror of https://github.com/ArduPilot/ardupilot
Rover: enabled sending waypoints from a companion computer to ardupilot for copter and rover
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
This commit is contained in:
parent
a13639d9d8
commit
7701be8209
|
@ -29,6 +29,12 @@ bool AP_ExternalControl_Rover::set_linear_velocity_and_yaw_rate(const Vector3f &
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AP_ExternalControl_Rover::set_global_position(const Location& loc)
|
||||||
|
{
|
||||||
|
// set_target_location only checks if the rover is in guided mode or not
|
||||||
|
return rover.set_target_location(loc);
|
||||||
|
}
|
||||||
|
|
||||||
bool AP_ExternalControl_Rover::ready_for_external_control()
|
bool AP_ExternalControl_Rover::ready_for_external_control()
|
||||||
{
|
{
|
||||||
return rover.control_mode->in_guided_mode() && rover.arming.is_armed();
|
return rover.control_mode->in_guided_mode() && rover.arming.is_armed();
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
|
|
||||||
#if AP_EXTERNAL_CONTROL_ENABLED
|
#if AP_EXTERNAL_CONTROL_ENABLED
|
||||||
|
|
||||||
class AP_ExternalControl_Rover : public AP_ExternalControl {
|
class AP_ExternalControl_Rover : public AP_ExternalControl
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
/*
|
/*
|
||||||
Set linear velocity and yaw rate. Pass NaN for yaw_rate_rads to not control yaw.
|
Set linear velocity and yaw rate. Pass NaN for yaw_rate_rads to not control yaw.
|
||||||
|
@ -15,6 +16,12 @@ public:
|
||||||
Yaw is in earth frame, NED [rad/s].
|
Yaw is in earth frame, NED [rad/s].
|
||||||
*/
|
*/
|
||||||
bool set_linear_velocity_and_yaw_rate(const Vector3f &linear_velocity, float yaw_rate_rads)override WARN_IF_UNUSED;
|
bool set_linear_velocity_and_yaw_rate(const Vector3f &linear_velocity, float yaw_rate_rads)override WARN_IF_UNUSED;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Sets the global position for loiter point
|
||||||
|
*/
|
||||||
|
bool set_global_position(const Location& loc) override WARN_IF_UNUSED;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*
|
/*
|
||||||
Return true if Rover is ready to handle external control data.
|
Return true if Rover is ready to handle external control data.
|
||||||
|
|
|
@ -157,8 +157,8 @@ Rover::Rover(void) :
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if AP_SCRIPTING_ENABLED
|
#if AP_SCRIPTING_ENABLED || AP_EXTERNAL_CONTROL_ENABLED
|
||||||
// set target location (for use by scripting)
|
// set target location (for use by external control and scripting)
|
||||||
bool Rover::set_target_location(const Location& target_loc)
|
bool Rover::set_target_location(const Location& target_loc)
|
||||||
{
|
{
|
||||||
// exit if vehicle is not in Guided mode or Auto-Guided mode
|
// exit if vehicle is not in Guided mode or Auto-Guided mode
|
||||||
|
@ -168,7 +168,9 @@ bool Rover::set_target_location(const Location& target_loc)
|
||||||
|
|
||||||
return mode_guided.set_desired_location(target_loc);
|
return mode_guided.set_desired_location(target_loc);
|
||||||
}
|
}
|
||||||
|
#endif //AP_SCRIPTING_ENABLED || AP_EXTERNAL_CONTROL_ENABLED
|
||||||
|
|
||||||
|
#if AP_SCRIPTING_ENABLED
|
||||||
// set target velocity (for use by scripting)
|
// set target velocity (for use by scripting)
|
||||||
bool Rover::set_target_velocity_NED(const Vector3f& vel_ned)
|
bool Rover::set_target_velocity_NED(const Vector3f& vel_ned)
|
||||||
{
|
{
|
||||||
|
|
|
@ -269,8 +269,11 @@ private:
|
||||||
cruise_learn_t cruise_learn;
|
cruise_learn_t cruise_learn;
|
||||||
|
|
||||||
// Rover.cpp
|
// Rover.cpp
|
||||||
#if AP_SCRIPTING_ENABLED
|
#if AP_SCRIPTING_ENABLED || AP_EXTERNAL_CONTROL_ENABLED
|
||||||
bool set_target_location(const Location& target_loc) override;
|
bool set_target_location(const Location& target_loc) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if AP_SCRIPTING_ENABLED
|
||||||
bool set_target_velocity_NED(const Vector3f& vel_ned) override;
|
bool set_target_velocity_NED(const Vector3f& vel_ned) override;
|
||||||
bool set_steering_and_throttle(float steering, float throttle) override;
|
bool set_steering_and_throttle(float steering, float throttle) override;
|
||||||
bool get_steering_and_throttle(float& steering, float& throttle) override;
|
bool get_steering_and_throttle(float& steering, float& throttle) override;
|
||||||
|
|
Loading…
Reference in New Issue