mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-06 11:38:54 +08:00
- changes to allow for multi-uav support
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
|
||||
using namespace px4;
|
||||
|
||||
Mavlink::Mavlink() :
|
||||
Mavlink::Mavlink(std::string mavlink_fcu_url) :
|
||||
_n(),
|
||||
_v_att_sub(_n.subscribe("vehicle_attitude", 1, &Mavlink::VehicleAttitudeCallback, this)),
|
||||
_v_local_pos_sub(_n.subscribe("vehicle_local_position", 1, &Mavlink::VehicleLocalPositionCallback, this)),
|
||||
@@ -55,7 +55,7 @@ Mavlink::Mavlink() :
|
||||
_offboard_control_mode_pub(_n.advertise<offboard_control_mode>("offboard_control_mode", 1)),
|
||||
_force_sp_pub(_n.advertise<vehicle_force_setpoint>("vehicle_force_setpoint", 1))
|
||||
{
|
||||
_link = mavconn::MAVConnInterface::open_url("udp://localhost:14565@localhost:14560");
|
||||
_link = mavconn::MAVConnInterface::open_url(mavlink_fcu_url);
|
||||
_link->message_received.connect(boost::bind(&Mavlink::handle_msg, this, _1, _2, _3));
|
||||
_att_sp = {};
|
||||
_offboard_control_mode = {};
|
||||
@@ -64,7 +64,10 @@ Mavlink::Mavlink() :
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
ros::init(argc, argv, "mavlink");
|
||||
Mavlink m;
|
||||
ros::NodeHandle privateNh("~");
|
||||
std::string mavlink_fcu_url;
|
||||
privateNh.param<std::string>("mavlink_fcu_url", mavlink_fcu_url, std::string("udp://localhost:14565@localhost:14560"));
|
||||
Mavlink m(mavlink_fcu_url);
|
||||
ros::spin();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace px4
|
||||
class Mavlink
|
||||
{
|
||||
public:
|
||||
Mavlink();
|
||||
Mavlink(std::string mavlink_fcu_url);
|
||||
|
||||
~Mavlink() {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user