-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhanced attitude control via scripting #25814
base: master
Are you sure you want to change the base?
Changes from all commits
a5c37b0
35d2a08
338c71e
857183c
42d33af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,6 +156,7 @@ class AP_Motors { | |
float get_yaw_ff() const { return _yaw_in_ff; } | ||
float get_throttle_out() const { return _throttle_out; } | ||
virtual bool get_thrust(uint8_t motor_num, float& thr_out) const { return false; } | ||
float get_throttle_in() const { return _throttle_in; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this needed vs the existing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Motors stuff should probably be its own PR too. |
||
float get_throttle() const { return constrain_float(_throttle_filter.get(), 0.0f, 1.0f); } | ||
float get_throttle_bidirectional() const { return constrain_float(2 * (_throttle_filter.get() - 0.5f), -1.0f, 1.0f); } | ||
float get_throttle_slew_rate() const { return _throttle_slew_rate; } | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1517,6 +1517,10 @@ function motors:get_forward() end | |||||
---@return number | ||||||
function motors:get_throttle() end | ||||||
|
||||||
-- get thrust motor input | ||||||
---@return number | ||||||
function motors:get_throttle_in() end | ||||||
|
||||||
-- get throttle motor output | ||||||
---@return integer | ||||||
---| '0' # Shut down | ||||||
|
@@ -2384,10 +2388,22 @@ function vehicle:get_circle_radius() end | |||||
---@return boolean | ||||||
function vehicle:set_target_angle_and_climbrate(roll_deg, pitch_deg, yaw_deg, climb_rate_ms, use_yaw_rate, yaw_rate_degs) end | ||||||
|
||||||
-- desc | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Full description please. |
||||||
---@param roll_deg number | ||||||
---@param pitch_deg number | ||||||
---@param yaw_deg number | ||||||
---@param thrust number | ||||||
---@param use_yaw_rate boolean | ||||||
---@param yaw_rate_degs number | ||||||
---@return boolean | ||||||
function vehicle:set_target_angle_and_thrust(roll_deg, pitch_deg, yaw_deg, thrust, use_yaw_rate, yaw_rate_degs) end | ||||||
|
||||||
-- desc | ||||||
-- Sets the target velocity using a Vector3f object in a guided mode. | ||||||
---@param vel_ned Vector3f_ud -- North, East, Down meters / second | ||||||
---@param align_yaw_to_target? boolean | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
It is not optional in lua. |
||||||
---@return boolean -- true on success | ||||||
function vehicle:set_target_velocity_NED(vel_ned) end | ||||||
function vehicle:set_target_velocity_NED(vel_ned, align_yaw_to_target) end | ||||||
|
||||||
-- desc | ||||||
---@param target_vel Vector3f_ud | ||||||
|
@@ -3574,6 +3590,30 @@ function fence:get_breach_time() end | |||||
---| 8 # Minimum altitude | ||||||
function fence:get_breaches() end | ||||||
|
||||||
-- Returns minimum safe altitude (i.e. alt_min + margin) | ||||||
---@return number | ||||||
function fence:get_safe_alt_min() end | ||||||
|
||||||
-- Returns maximum safe altitude (i.e. alt_max - margin) | ||||||
---@return number | ||||||
function fence:get_safe_alt_max() end | ||||||
|
||||||
-- Returns configured fences | ||||||
---@return integer fence_type bitmask | ||||||
---| 1 # Maximim altitude | ||||||
---| 2 # Circle | ||||||
---| 4 # Polygon | ||||||
---| 8 # Minimum altitude | ||||||
function fence:present() end | ||||||
|
||||||
-- Returns enabled fences | ||||||
---@return integer fence_type bitmask | ||||||
---| 1 # Maximim altitude | ||||||
---| 2 # Circle | ||||||
---| 4 # Polygon | ||||||
---| 8 # Minimum altitude | ||||||
function fence:get_enabled_fences() end | ||||||
|
||||||
-- desc | ||||||
---@class (exact) stat_t_ud | ||||||
local stat_t_ud = {} | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -327,8 +327,9 @@ singleton AP_Vehicle method set_target_pos_NED boolean Vector3f boolean float -3 | |
singleton AP_Vehicle method set_target_posvel_NED boolean Vector3f Vector3f | ||
singleton AP_Vehicle method set_target_posvelaccel_NED boolean Vector3f Vector3f Vector3f boolean float -360 +360 boolean float'skip_check boolean | ||
singleton AP_Vehicle method set_target_velaccel_NED boolean Vector3f Vector3f boolean float -360 +360 boolean float'skip_check boolean | ||
singleton AP_Vehicle method set_target_velocity_NED boolean Vector3f | ||
singleton AP_Vehicle method set_target_velocity_NED boolean Vector3f boolean | ||
singleton AP_Vehicle method set_target_angle_and_climbrate boolean float -180 180 float -90 90 float -360 360 float'skip_check boolean float'skip_check | ||
singleton AP_Vehicle method set_target_angle_and_thrust boolean float -180 180 float -90 90 float -360 360 float'skip_check boolean float'skip_check | ||
singleton AP_Vehicle method get_circle_radius boolean float'Null | ||
singleton AP_Vehicle method set_circle_rate boolean float'skip_check | ||
singleton AP_Vehicle method set_steering_and_throttle boolean float -1 1 float -1 1 | ||
|
@@ -713,6 +714,7 @@ singleton AP::motors() method get_pitch_ff float | |
singleton AP::motors() method get_yaw float | ||
singleton AP::motors() method get_yaw_ff float | ||
singleton AP::motors() method get_throttle float | ||
singleton AP::motors() method get_throttle_in float | ||
singleton AP::motors() method get_forward float | ||
singleton AP::motors() method get_lateral float | ||
singleton AP::motors() method get_spool_state uint8_t | ||
|
@@ -936,6 +938,10 @@ singleton AC_Fence depends AP_FENCE_ENABLED | |
singleton AC_Fence rename fence | ||
singleton AC_Fence method get_breaches uint8_t | ||
singleton AC_Fence method get_breach_time uint32_t | ||
singleton AC_Fence method get_safe_alt_min float | ||
singleton AC_Fence method get_safe_alt_max float | ||
singleton AC_Fence method present uint8_t | ||
singleton AC_Fence method get_enabled_fences uint8_t | ||
Comment on lines
+941
to
+944
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the fence stuff should be a separate PR. |
||
|
||
andyp1per marked this conversation as resolved.
Show resolved
Hide resolved
|
||
include AP_Filesystem/AP_Filesystem.h depends AP_FILESYSTEM_FILE_READING_ENABLED | ||
include AP_Filesystem/AP_Filesystem_config.h | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would definitely be nice to be able to control the yaw better from scripting
won't this break the API though for existing users?