diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2014-12-30 12:34:18 +0100 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2014-12-30 12:34:18 +0100 |
commit | 2623ec156f30bf6f5734fc965724d5d6f1d3f8ce (patch) | |
tree | fa95eda346239b344b8204558d2b7257d69ff5d5 /src/platforms/ros/nodes/manual_input | |
parent | f968e7355d62bbf8df426c51dc2aba98d2bc72b7 (diff) | |
parent | 838f8603475def949646ececc8059e6b924bda28 (diff) | |
download | px4-firmware-2623ec156f30bf6f5734fc965724d5d6f1d3f8ce.tar.gz px4-firmware-2623ec156f30bf6f5734fc965724d5d6f1d3f8ce.tar.bz2 px4-firmware-2623ec156f30bf6f5734fc965724d5d6f1d3f8ce.zip |
Merge branch 'dev_ros_commander' into dev_ros
Conflicts:
CMakeLists.txt
Diffstat (limited to 'src/platforms/ros/nodes/manual_input')
-rw-r--r-- | src/platforms/ros/nodes/manual_input/manual_input.cpp | 7 | ||||
-rw-r--r-- | src/platforms/ros/nodes/manual_input/manual_input.h | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/platforms/ros/nodes/manual_input/manual_input.cpp b/src/platforms/ros/nodes/manual_input/manual_input.cpp index 2ee2dadbc..b125bb180 100644 --- a/src/platforms/ros/nodes/manual_input/manual_input.cpp +++ b/src/platforms/ros/nodes/manual_input/manual_input.cpp @@ -41,10 +41,11 @@ #include "manual_input.h" #include <px4/manual_control_setpoint.h> +#include <platforms/px4_middleware.h> ManualInput::ManualInput() : _n(), - _sub_joy(_n.subscribe("joy", 10, &ManualInput::JoyCallback, this)), + joy_sub(_n.subscribe("joy", 10, &ManualInput::JoyCallback, this)), _man_ctrl_sp_pub(_n.advertise<px4::manual_control_setpoint>("manual_control_setpoint", 10)) { /* Load parameters, default values work for Microsoft XBox Controller */ @@ -87,6 +88,8 @@ void ManualInput::JoyCallback(const sensor_msgs::JoyConstPtr& msg) msg_out.acro_switch = 0; msg_out.offboard_switch = 0; + msg_out.timestamp = px4::get_time_micros(); + _man_ctrl_sp_pub.publish(msg_out); } @@ -99,8 +102,6 @@ int main(int argc, char **argv) { ros::init(argc, argv, "manual_input"); ManualInput m; - ros::spin(); - return 0; } diff --git a/src/platforms/ros/nodes/manual_input/manual_input.h b/src/platforms/ros/nodes/manual_input/manual_input.h index fbe635cf2..22a158985 100644 --- a/src/platforms/ros/nodes/manual_input/manual_input.h +++ b/src/platforms/ros/nodes/manual_input/manual_input.h @@ -59,7 +59,7 @@ protected: void MapAxis(const sensor_msgs::JoyConstPtr& msg, int map_index, double scale, double offset, float &out); ros::NodeHandle _n; - ros::Subscriber _sub_joy; + ros::Subscriber joy_sub; ros::Publisher _man_ctrl_sp_pub; /* Parameters */ |