mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 07:53:33 +08:00
WIP, change uorb offboard control sp topic
This commit is contained in:
@@ -83,14 +83,15 @@ Offboard::on_active(struct position_setpoint_triplet_s *pos_sp_triplet)
|
||||
/* We accept position control only if none of the directions is ignored (as pos_sp_triplet does not
|
||||
* support deactivation of individual directions) */
|
||||
if (_navigator->get_control_mode()->flag_control_position_enabled &&
|
||||
(!_offboard_control_sp.ignore[0] &&
|
||||
!_offboard_control_sp.ignore[1] &&
|
||||
!_offboard_control_sp.ignore[2])) {
|
||||
(!offboard_control_sp_ignore_position(_offboard_control_sp, 0) &&
|
||||
!offboard_control_sp_ignore_position(_offboard_control_sp, 1) &&
|
||||
!offboard_control_sp_ignore_position(_offboard_control_sp, 2))) {
|
||||
/* position control */
|
||||
pos_sp_triplet->current.x = _offboard_control_sp.p1;
|
||||
pos_sp_triplet->current.y = _offboard_control_sp.p2;
|
||||
pos_sp_triplet->current.yaw = _offboard_control_sp.p3;
|
||||
pos_sp_triplet->current.z = -_offboard_control_sp.p4;
|
||||
pos_sp_triplet->current.x = _offboard_control_sp.position[0];
|
||||
pos_sp_triplet->current.y = _offboard_control_sp.position[1];
|
||||
//pos_sp_triplet->current.yaw = _offboard_control_sp.position[2];
|
||||
//XXX: copy yaw
|
||||
pos_sp_triplet->current.z = -_offboard_control_sp.position[2];
|
||||
|
||||
pos_sp_triplet->current.type = SETPOINT_TYPE_OFFBOARD;
|
||||
pos_sp_triplet->current.valid = true;
|
||||
@@ -102,14 +103,15 @@ Offboard::on_active(struct position_setpoint_triplet_s *pos_sp_triplet)
|
||||
/* We accept velocity control only if none of the directions is ignored (as pos_sp_triplet does not
|
||||
* support deactivation of individual directions) */
|
||||
if (_navigator->get_control_mode()->flag_control_velocity_enabled &&
|
||||
(!_offboard_control_sp.ignore[3] &&
|
||||
!_offboard_control_sp.ignore[4] &&
|
||||
!_offboard_control_sp.ignore[5])) {
|
||||
(!offboard_control_sp_ignore_velocity(_offboard_control_sp, 0) &&
|
||||
!offboard_control_sp_ignore_velocity(_offboard_control_sp, 1) &&
|
||||
!offboard_control_sp_ignore_velocity(_offboard_control_sp, 2))) {
|
||||
/* velocity control */
|
||||
pos_sp_triplet->current.vx = _offboard_control_sp.p2;
|
||||
pos_sp_triplet->current.vy = _offboard_control_sp.p1;
|
||||
pos_sp_triplet->current.yawspeed = _offboard_control_sp.p3;
|
||||
pos_sp_triplet->current.vz = _offboard_control_sp.p4;
|
||||
pos_sp_triplet->current.vx = _offboard_control_sp.velocity[0];
|
||||
pos_sp_triplet->current.vy = _offboard_control_sp.velocity[1];
|
||||
// pos_sp_triplet->current.yawspeed = _offboard_control_sp.velocity[;
|
||||
// //XXX: copy yaw speed
|
||||
pos_sp_triplet->current.vz = _offboard_control_sp.velocity[2];
|
||||
|
||||
pos_sp_triplet->current.type = SETPOINT_TYPE_OFFBOARD;
|
||||
pos_sp_triplet->current.valid = true;
|
||||
|
||||
Reference in New Issue
Block a user