Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

andyp1per
Copy link
Collaborator

@andyp1per andyp1per commented Dec 21, 2023

Based on #25698

@andyp1per andyp1per force-pushed the pr-attitude-scripting branch 2 times, most recently from 38ef3e8 to c616ec2 Compare August 15, 2024 08:34
@@ -2345,10 +2349,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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Full description please.

-- 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
---@param align_yaw_to_target? boolean
---@param align_yaw_to_target boolean

It is not optional in lua.

Comment on lines +932 to +944
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the fence stuff should be a separate PR.

@@ -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; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed vs the existing get_throttle binding?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Motors stuff should probably be its own PR too.

@@ -347,16 +347,24 @@ bool Copter::set_target_posvelaccel_NED(const Vector3f& target_pos, const Vector
return mode_guided.set_destination_posvelaccel(pos_neu_cm, vel_neu_cms, accel_neu_cms, use_yaw, yaw_deg * 100.0, use_yaw_rate, yaw_rate_degs * 100.0, yaw_relative);
}

bool Copter::set_target_velocity_NED(const Vector3f& vel_ned)
bool Copter::set_target_velocity_NED(const Vector3f& vel_ned, bool align_yaw_to_target)
Copy link
Contributor

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?

allow vehicles to yaw to target
docs for set_target_velocity_NED()
add set_target_angle_and_thrust() and get_throttle_in()
add set_target_angle_and_thrust()
allow scripting to call set_angle with thrust
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants