48 #include <px4_platform_common/defines.h> 49 #include <px4_platform_common/posix.h> 89 *control_data =
nullptr;
91 const int num_poll = 2;
92 px4_pollfd_struct_t polls[num_poll];
94 polls[0].events = POLLIN;
96 polls[1].events = POLLIN;
98 int ret =
px4_poll(polls, num_poll, timeout_ms);
108 if (polls[0].revents & POLLIN) {
114 if (vehicle_roi.
mode == vehicle_roi_s::ROI_NONE) {
119 }
else if (vehicle_roi.
mode == vehicle_roi_s::ROI_WPNEXT) {
130 }
else if (vehicle_roi.
mode == vehicle_roi_s::ROI_LOCATION) {
135 }
else if (vehicle_roi.
mode == vehicle_roi_s::ROI_TARGET) {
142 for (
int i = 0; i < 3; ++i) {
148 if (polls[1].revents & POLLIN) {
174 PX4_INFO(
"Input: Mavlink (ROI)");
179 : _stabilize {stabilize, stabilize, stabilize}
219 *control_data =
nullptr;
221 const int num_poll = 1;
222 px4_pollfd_struct_t polls[num_poll];
224 polls[0].events = POLLIN;
226 int poll_timeout = (int)timeout_ms;
228 bool exit_loop =
false;
230 while (!exit_loop && poll_timeout >= 0) {
233 int ret =
px4_poll(polls, num_poll, poll_timeout);
248 if (polls[0].revents & POLLIN) {
257 if (!sysid_correct || !compid_correct) {
262 for (
int i = 0; i < 3; ++i) {
268 if (vehicle_command.
command == vehicle_command_s::VEHICLE_CMD_DO_MOUNT_CONTROL) {
270 switch ((
int)vehicle_command.
param7) {
271 case vehicle_command_s::VEHICLE_MOUNT_MODE_RETRACT:
276 case vehicle_command_s::VEHICLE_MOUNT_MODE_NEUTRAL:
282 case vehicle_command_s::VEHICLE_MOUNT_MODE_MAVLINK_TARGETING:
302 case vehicle_command_s::VEHICLE_MOUNT_MODE_RC_TARGETING:
305 case vehicle_command_s::VEHICLE_MOUNT_MODE_GPS_POINT:
314 }
else if (vehicle_command.
command == vehicle_command_s::VEHICLE_CMD_DO_MOUNT_CONFIGURE) {
339 vehicle_command_ack.command = cmd->
command;
340 vehicle_command_ack.result = vehicle_command_s::VEHICLE_CMD_RESULT_ACCEPTED;
345 cmd_ack_pub.publish(vehicle_command_ack);
350 PX4_INFO(
"Input: Mavlink (CMD_MOUNT)");
struct vmount::ControlData::TypeData::TypeLonLat lonlat
#define PARAM_INVALID
Handle returned when a parameter cannot be found.
float yaw_angle_offset
angular offset for yaw [rad]
int orb_copy(const struct orb_metadata *meta, int handle, void *buffer)
double lon
longitude in [deg]
__EXPORT int param_get(param_t param, void *val)
Copy the value of a parameter.
float pitch_angle_offset
angular offset for pitch [rad]
float pitch_fixed_angle
ignored if < -pi, otherwise use a fixed pitch angle instead of the altitude
int orb_set_interval(int handle, unsigned interval)
float altitude
altitude in [m]
float roll_angle
roll is set to a fixed angle.
High-resolution timer with callouts and timekeeping.
Global flash based parameter store.
int orb_subscribe(const struct orb_metadata *meta)
bool gimbal_shutter_retract
whether to lock the gimbal (only in RC output mode)
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
struct position_setpoint_s current
double lat
latitude in [deg]
int orb_unsubscribe(int handle)
float angles[3]
attitude angles (roll, pitch, yaw) in rad, [-pi, +pi] if is_speed[i] == false
__BEGIN_DECLS typedef uint64_t hrt_abstime
Absolute time, in microsecond units.
This defines the common API between an input and an output of the vmount driver.
__EXPORT param_t param_find(const char *name)
Look up a parameter by name.
bool is_speed[3]
if true, the angle is the angular speed in rad/s
control the roll, pitch & yaw angle directly
struct vmount::ControlData::TypeData::TypeAngle angle
bool stabilize_axis[3]
whether the vmount driver should stabilize an axis (if the output supports it, this can also be done ...
__EXPORT hrt_abstime hrt_absolute_time(void)
Get absolute time in [us] (does not wrap).
uint32_t param_t
Parameter handle.
union vmount::ControlData::TypeData type_data