From 86ad696c2c37a19a7d3f18766d97a1cd4b4b7ae4 Mon Sep 17 00:00:00 2001 From: James Jackson Date: Fri, 17 Jun 2016 09:12:58 -0600 Subject: [PATCH 1/3] added extended message for ROSflight2 --- include/controller_base.h | 2 ++ src/controller_base.cpp | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/controller_base.h b/include/controller_base.h index 09d8191..3200f56 100644 --- a/include/controller_base.h +++ b/include/controller_base.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -100,6 +101,7 @@ class controller_base ros::Subscriber _vehicle_state_sub; ros::Subscriber _controller_commands_sub; ros::Publisher _actuators_pub; + ros::Publisher _extended_actuators_pub; ros::Publisher _att_cmd_pub; ros::Timer _act_pub_timer; diff --git a/src/controller_base.cpp b/src/controller_base.cpp index 2b0375f..9878ee0 100644 --- a/src/controller_base.cpp +++ b/src/controller_base.cpp @@ -54,6 +54,7 @@ controller_base::controller_base(): _server.setCallback(_func); _actuators_pub = nh_.advertise("command",10); + _extended_actuators_pub = nh_.advertise("extended_command", 10); _att_cmd_pub = nh_.advertise("attitude_commands",10); _act_pub_timer = nh_.createTimer(ros::Duration(1.0/100.0), &controller_base::actuator_controls_publish, this); @@ -148,6 +149,17 @@ void controller_base::actuator_controls_publish(const ros::TimerEvent&) _actuators_pub.publish(actuators); + fcu_common::ExtendedCommand extended_actuators; + extended_actuators.ignore = 0; + extended_actuators.mode = fcu_common::ExtendedCommand::MODE_PASS_THROUGH; + extended_actuators.value1 = output.delta_a; + extended_actuators.value2 = output.delta_e; + extended_actuators.value3 = output.delta_r; + extended_actuators.value4 = output.delta_t; + + _extended_actuators_pub.publish(extended_actuators); + + if(_att_cmd_pub.getNumSubscribers() > 0) { fcu_common::FW_Attitude_Commands attitudes; From ff048e24362954d2445caebd5279a0889558c77b Mon Sep 17 00:00:00 2001 From: James Jackson Date: Thu, 21 Jul 2016 23:41:26 -0600 Subject: [PATCH 2/3] updated to new extended command --- src/controller_base.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/controller_base.cpp b/src/controller_base.cpp index 9878ee0..9bb7223 100644 --- a/src/controller_base.cpp +++ b/src/controller_base.cpp @@ -152,10 +152,10 @@ void controller_base::actuator_controls_publish(const ros::TimerEvent&) fcu_common::ExtendedCommand extended_actuators; extended_actuators.ignore = 0; extended_actuators.mode = fcu_common::ExtendedCommand::MODE_PASS_THROUGH; - extended_actuators.value1 = output.delta_a; - extended_actuators.value2 = output.delta_e; - extended_actuators.value3 = output.delta_r; - extended_actuators.value4 = output.delta_t; + extended_actuators.x = output.delta_a; + extended_actuators.y = output.delta_e; + extended_actuators.z = output.delta_r; + extended_actuators.F = output.delta_t; _extended_actuators_pub.publish(extended_actuators); From 78722be7a5c35bed3590e287cb01fdcd80c2084f Mon Sep 17 00:00:00 2001 From: James Jackson Date: Fri, 26 Aug 2016 16:28:44 -0600 Subject: [PATCH 3/3] moved to xyzF --- src/controller_base.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/controller_base.cpp b/src/controller_base.cpp index 9878ee0..9bb7223 100644 --- a/src/controller_base.cpp +++ b/src/controller_base.cpp @@ -152,10 +152,10 @@ void controller_base::actuator_controls_publish(const ros::TimerEvent&) fcu_common::ExtendedCommand extended_actuators; extended_actuators.ignore = 0; extended_actuators.mode = fcu_common::ExtendedCommand::MODE_PASS_THROUGH; - extended_actuators.value1 = output.delta_a; - extended_actuators.value2 = output.delta_e; - extended_actuators.value3 = output.delta_r; - extended_actuators.value4 = output.delta_t; + extended_actuators.x = output.delta_a; + extended_actuators.y = output.delta_e; + extended_actuators.z = output.delta_r; + extended_actuators.F = output.delta_t; _extended_actuators_pub.publish(extended_actuators);