-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
Fixedwing Add support for offboard velocity setpoints #18495
Conversation
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.
Seems fine beside that small comment on the yaw_setpoint.
3d7798f
to
1af2207
Compare
@@ -757,6 +757,10 @@ FixedwingPositionControl::control_auto(const hrt_abstime &now, const Vector2d &c | |||
control_auto_position(now, curr_pos, ground_speed, pos_sp_prev, pos_sp_curr); | |||
break; | |||
|
|||
case position_setpoint_s::SETPOINT_TYPE_VELOCITY: |
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.
SETPOINT_TYPE_VELOCITY will be purged "soon". #18026
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.
@dagar What would be the alternative to pass velocity setpoints? Should we move away from using position setpoint types all together? (Seems fw pos control is the only place this is being used)
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.
I'm only talking about the position_setpoint_triplet coming from navigator. Everything else using the trajectory_setpoint
is still valid.
@@ -896,6 +900,10 @@ FixedwingPositionControl::control_auto_descend(const hrt_abstime &now) | |||
uint8_t | |||
FixedwingPositionControl::handle_setpoint_type(const uint8_t setpoint_type, const position_setpoint_s &pos_sp_curr) | |||
{ | |||
if (!_control_mode.flag_control_position_enabled && _control_mode.flag_control_velocity_enabled) { | |||
return position_setpoint_s::SETPOINT_TYPE_VELOCITY; |
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.
@dagar We are not using SETPOINT_TYPE_VELOCITY
from the navigator, but we still need SETPOINT_TYPE_VELOCITY
in the fw position controller
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.
If it's easy we can keep it for now, but we'll have to do something about it later.
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.
@dagar I think this needs to be changed all together on moving away from position setpoint as a state machine for the position controller behavior
This commit adds a velocity controller which the setpoint can be passed using offboard setpoints
1af2207
to
e209ba0
Compare
@sfuhrer Rebased and addressed review comments! |
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.
Haven't tested offboard ever myself, but don't see any obvious issue here.
@sfuhrer Thanks! |
Which topic can control velocity, I used mavros/setpoint_raw/global send velocity message ,but it did not work. |
@lichishubao Please do not hijack the topic of this PR. You can post a new issue or a question to the public forum |
This is not my intention,I just want to know which offboard setpoints do you sent by ROS, I might have used the wrong topic |
@lichishubao Feel free to ask questions on the public forum, or on the px4 discord. If you think it is relevant, you can also open a new issue |
Describe problem solved by this pull request
Previously vehicles only supported position setpoints which were tracked using a L1 controller.
While this is sufficient to do waypoint navigation, it is hard do more advanced maneuvers using only a L1 position setpoint.
Describe your solution
This PR adds support for offboard velocity setpoints for fixedwing type vehicles. The velocity can be commanded in the local frame and the vehicle will try to follow the velocity setpoints in 3D.
vx
,vy
will be passed as the target groundspeed.vz
will be mapped to TECS height rate setpointsBeing able to command velocity setpoints in the local frame allows fixedwing vehicles to be used in more robotics oriented tasks such as trajectory tracking, formation flying etc
Test data / coverage
Tested in SITL Gazebo with offboard setpoints sent by ROS
Additional context