mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 11:06:04 +08:00
variable rename
This commit is contained in:
@@ -41,10 +41,11 @@
|
|||||||
#include "manual_input.h"
|
#include "manual_input.h"
|
||||||
|
|
||||||
#include <px4/manual_control_setpoint.h>
|
#include <px4/manual_control_setpoint.h>
|
||||||
|
#include <platforms/px4_middleware.h>
|
||||||
|
|
||||||
ManualInput::ManualInput() :
|
ManualInput::ManualInput() :
|
||||||
_n(),
|
_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))
|
_man_ctrl_sp_pub(_n.advertise<px4::manual_control_setpoint>("manual_control_setpoint", 10))
|
||||||
{
|
{
|
||||||
/* Load parameters, default values work for Microsoft XBox Controller */
|
/* 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.acro_switch = 0;
|
||||||
msg_out.offboard_switch = 0;
|
msg_out.offboard_switch = 0;
|
||||||
|
|
||||||
|
msg_out.timestamp = px4::get_time_micros();
|
||||||
|
|
||||||
_man_ctrl_sp_pub.publish(msg_out);
|
_man_ctrl_sp_pub.publish(msg_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,8 +102,6 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
ros::init(argc, argv, "manual_input");
|
ros::init(argc, argv, "manual_input");
|
||||||
ManualInput m;
|
ManualInput m;
|
||||||
|
|
||||||
ros::spin();
|
ros::spin();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ protected:
|
|||||||
void MapAxis(const sensor_msgs::JoyConstPtr& msg, int map_index, double scale, double offset, float &out);
|
void MapAxis(const sensor_msgs::JoyConstPtr& msg, int map_index, double scale, double offset, float &out);
|
||||||
|
|
||||||
ros::NodeHandle _n;
|
ros::NodeHandle _n;
|
||||||
ros::Subscriber _sub_joy;
|
ros::Subscriber joy_sub;
|
||||||
ros::Publisher _man_ctrl_sp_pub;
|
ros::Publisher _man_ctrl_sp_pub;
|
||||||
|
|
||||||
/* Parameters */
|
/* Parameters */
|
||||||
|
|||||||
Reference in New Issue
Block a user