mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-01 09:50:34 +08:00
use orb_advertise_multi:
- subscribe to actuator controls after topic has been advertised
This commit is contained in:
@@ -310,9 +310,6 @@ void Simulator::updateSamples()
|
||||
struct mag_report mag;
|
||||
memset(&mag, 0 ,sizeof(mag));
|
||||
|
||||
// subscribe to topics
|
||||
_actuator_outputs_sub = orb_subscribe(ORB_ID(actuator_outputs));
|
||||
|
||||
// try to setup udp socket for communcation with simulator
|
||||
memset((char *)&_myaddr, 0, sizeof(_myaddr));
|
||||
_myaddr.sin_family = AF_INET;
|
||||
@@ -381,6 +378,9 @@ void Simulator::updateSamples()
|
||||
send_controls();
|
||||
}
|
||||
|
||||
// subscribe to topics
|
||||
_actuator_outputs_sub = orb_subscribe_multi(ORB_ID(actuator_outputs), 0);
|
||||
|
||||
// got data from simulator, now activate the sending thread
|
||||
pthread_create(&sender_thread, &sender_thread_attr, Simulator::sending_trampoline, NULL);
|
||||
pthread_attr_destroy(&sender_thread_attr);
|
||||
|
||||
Reference in New Issue
Block a user