WIP, change uorb offboard control sp topic

This commit is contained in:
Thomas Gubler
2014-07-07 13:00:45 +02:00
parent 58adea9469
commit 2d26e91392
3 changed files with 55 additions and 39 deletions
+16 -14
View File
@@ -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;