mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-06 10:51:35 +08:00
Fix an architectural issue with the ORB that prevented publication from interrupt context.
ORB topic advertisements are now global handles that can be used in any context. It is still possible to open a topic node as a publisher, but it's not the default. As a consequence, the type of the handle returned from orb_advertise has changed; all other API remains the same.
This commit is contained in:
@@ -154,7 +154,7 @@ int attitude_estimator_bm_main(int argc, char *argv[])
|
||||
bool publishing = false;
|
||||
|
||||
/* advertise attitude */
|
||||
int pub_att = orb_advertise(ORB_ID(vehicle_attitude), &att);
|
||||
orb_advert_t pub_att = orb_advertise(ORB_ID(vehicle_attitude), &att);
|
||||
publishing = true;
|
||||
|
||||
struct pollfd fds[] = {
|
||||
|
||||
@@ -89,7 +89,7 @@ private:
|
||||
int _task;
|
||||
int _t_actuators;
|
||||
int _t_armed;
|
||||
int _t_outputs;
|
||||
orb_advert_t _t_outputs;
|
||||
unsigned _num_outputs;
|
||||
|
||||
volatile bool _task_should_exit;
|
||||
@@ -566,15 +566,13 @@ fake(int argc, char *argv[])
|
||||
|
||||
ac.control[3] = strtol(argv[4], 0, 0) / 100.0f;
|
||||
|
||||
int handle = orb_advertise(ORB_ID_VEHICLE_ATTITUDE_CONTROLS, &ac);
|
||||
orb_advert_t handle = orb_advertise(ORB_ID_VEHICLE_ATTITUDE_CONTROLS, &ac);
|
||||
|
||||
if (handle < 0) {
|
||||
puts("advertise failed");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
close(handle);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ protected:
|
||||
void set_channels(unsigned count, const servo_position_t *data);
|
||||
|
||||
private:
|
||||
int _publication;
|
||||
orb_advert_t _publication;
|
||||
struct rc_input_values _input;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user