use orb_advertise_multi:

- subscribe to actuator controls after topic has been advertised
This commit is contained in:
tumbili 2015-06-08 19:41:54 +02:00 committed by Mark Charlebois
parent 065ec5b2dc
commit a5c214a7bb
2 changed files with 6 additions and 6 deletions

View File

@ -348,9 +348,9 @@ HIL::task_main()
actuator_outputs_s outputs;
memset(&outputs, 0, sizeof(outputs));
/* advertise the mixed control outputs */
//int dummy;
_t_outputs = orb_advertise(ORB_ID(actuator_outputs),
&outputs);
int dummy;
_t_outputs = orb_advertise_multi(ORB_ID(actuator_outputs),
&outputs, &dummy, ORB_PRIO_LOW);
px4_pollfd_struct_t fds[2];
fds[0].fd = _t_actuators;

View File

@ -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);