aboutsummaryrefslogtreecommitdiff
path: root/src/modules/navigator/offboard.cpp
diff options
context:
space:
mode:
authorThomas Gubler <thomasgubler@gmail.com>2014-07-07 13:00:45 +0200
committerThomas Gubler <thomasgubler@gmail.com>2014-07-07 13:00:45 +0200
commit2d26e913921ce80e509bd79462319d09d12c2171 (patch)
tree897d69caa948fcdb6e2fde3adbae31e7e2683164 /src/modules/navigator/offboard.cpp
parent58adea94699aa132ee568b9fe61a48f98eb42c78 (diff)
downloadpx4-firmware-2d26e913921ce80e509bd79462319d09d12c2171.tar.gz
px4-firmware-2d26e913921ce80e509bd79462319d09d12c2171.tar.bz2
px4-firmware-2d26e913921ce80e509bd79462319d09d12c2171.zip
WIP, change uorb offboard control sp topic
Diffstat (limited to 'src/modules/navigator/offboard.cpp')
-rw-r--r--src/modules/navigator/offboard.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/modules/navigator/offboard.cpp b/src/modules/navigator/offboard.cpp
index 27ce46a1d..71a14c029 100644
--- a/src/modules/navigator/offboard.cpp
+++ b/src/modules/navigator/offboard.cpp
@@ -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;