PX4 Firmware
PX4 Autopilot Software http://px4.io
RoverPositionControl.cpp
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright (c) 2017 PX4 Development Team. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in
13  * the documentation and/or other materials provided with the
14  * distribution.
15  * 3. Neither the name PX4 nor the names of its contributors may be
16  * used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
26  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  *
32  ****************************************************************************/
33 
34 /**
35  *
36  * This module is a modification of the fixed wing module and it is designed for ground rovers.
37  * It has been developed starting from the fw module, simplified and improved with dedicated items.
38  *
39  * All the acknowledgments and credits for the fw wing app are reported in those files.
40  *
41  * @author Marco Zorzi <mzorzi@student.ethz.ch>
42  */
43 
44 
45 #include "RoverPositionControl.hpp"
46 #include <lib/ecl/geo/geo.h>
47 
48 #define ACTUATOR_PUBLISH_PERIOD_MS 4
49 
50 using matrix::Eulerf;
51 using matrix::Quatf;
52 using matrix::Vector3f;
53 
54 /**
55  * L1 control app start / stop handling function
56  *
57  * @ingroup apps
58  */
59 extern "C" __EXPORT int rover_pos_control_main(int argc, char *argv[]);
60 
62  ModuleParams(nullptr),
63  /* performance counters */
64  _loop_perf(perf_alloc(PC_ELAPSED, "rover position control")) // TODO : do we even need these perf counters
65 {
66 }
67 
69 {
71 }
72 
74 {
75  // check for parameter updates
76  if (_parameter_update_sub.updated() || force) {
77  // clear update
78  parameter_update_s pupdate;
79  _parameter_update_sub.copy(&pupdate);
80 
81  // update parameters from storage
82  updateParams();
83 
84  _gnd_control.set_l1_damping(_param_l1_damping.get());
85  _gnd_control.set_l1_period(_param_l1_period.get());
87 
90  _param_speed_p.get(),
91  _param_speed_d.get(),
92  _param_speed_i.get(),
93  _param_speed_imax.get(),
94  _param_gndspeed_max.get());
95  }
96 }
97 
98 void
100 {
101  bool updated;
102  orb_check(_control_mode_sub, &updated);
103 
104  if (updated) {
105  orb_copy(ORB_ID(vehicle_control_mode), _control_mode_sub, &_control_mode);
106  }
107 }
108 
109 void
111 {
112  bool manual_updated;
113  orb_check(_manual_control_sub, &manual_updated);
114 
115  if (manual_updated) {
116  orb_copy(ORB_ID(manual_control_setpoint), _manual_control_sub, &_manual);
117  }
118 }
119 
120 void
122 {
123  bool pos_sp_triplet_updated;
124  orb_check(_pos_sp_triplet_sub, &pos_sp_triplet_updated);
125 
126  if (pos_sp_triplet_updated) {
127  orb_copy(ORB_ID(position_setpoint_triplet), _pos_sp_triplet_sub, &_pos_sp_triplet);
128  }
129 }
130 
131 void
133 {
134  bool att_sp_updated;
135  orb_check(_att_sp_sub, &att_sp_updated);
136 
137  if (att_sp_updated) {
138  orb_copy(ORB_ID(vehicle_attitude_setpoint), _att_sp_sub, &_att_sp);
139  }
140 }
141 
142 void
144 {
145  bool att_updated;
146  orb_check(_vehicle_attitude_sub, &att_updated);
147 
148  if (att_updated) {
149  orb_copy(ORB_ID(vehicle_attitude), _vehicle_attitude_sub, &_vehicle_att);
150  }
151 }
152 
153 bool
155  const matrix::Vector3f &ground_speed, const position_setpoint_triplet_s &pos_sp_triplet)
156 {
157  float dt = 0.01; // Using non zero value to a avoid division by zero
158 
161  }
162 
164 
165  bool setpoint = true;
166 
169  /* AUTONOMOUS FLIGHT */
170 
171  _control_mode_current = UGV_POSCTRL_MODE_AUTO;
172 
173  /* get circle mode */
174  //bool was_circle_mode = _gnd_control.circle_mode();
175 
176  /* current waypoint (the one currently heading for) */
177  matrix::Vector2f curr_wp((float)pos_sp_triplet.current.lat, (float)pos_sp_triplet.current.lon);
178 
179  /* previous waypoint */
180  matrix::Vector2f prev_wp = curr_wp;
181 
182  if (pos_sp_triplet.previous.valid) {
183  prev_wp(0) = (float)pos_sp_triplet.previous.lat;
184  prev_wp(1) = (float)pos_sp_triplet.previous.lon;
185  }
186 
187  matrix::Vector2f ground_speed_2d(ground_speed);
188 
189  float mission_throttle = _param_throttle_cruise.get();
190 
191  /* Just control the throttle */
192  if (_param_speed_control_mode.get() == 1) {
193  /* control the speed in closed loop */
194 
195  float mission_target_speed = _param_gndspeed_trim.get();
196 
197  if (PX4_ISFINITE(_pos_sp_triplet.current.cruising_speed) &&
199  mission_target_speed = _pos_sp_triplet.current.cruising_speed;
200  }
201 
202  // Velocity in body frame
203  const Dcmf R_to_body(Quatf(_vehicle_att.q).inversed());
204  const Vector3f vel = R_to_body * Vector3f(ground_speed(0), ground_speed(1), ground_speed(2));
205 
206  const float x_vel = vel(0);
207  const float x_acc = _vehicle_acceleration_sub.get().xyz[0];
208 
209  // Compute airspeed control out and just scale it as a constant
210  mission_throttle = _param_throttle_speed_scaler.get()
211  * pid_calculate(&_speed_ctrl, mission_target_speed, x_vel, x_acc, dt);
212 
213  // Constrain throttle between min and max
214  mission_throttle = math::constrain(mission_throttle, _param_throttle_min.get(), _param_throttle_max.get());
215 
216  } else {
217  /* Just control throttle in open loop */
218  if (PX4_ISFINITE(_pos_sp_triplet.current.cruising_throttle) &&
220 
221  mission_throttle = _pos_sp_triplet.current.cruising_throttle;
222  }
223  }
224 
226  pos_sp_triplet.current.lat, pos_sp_triplet.current.lon);
227 
228  bool should_idle = true;
229 
230  if (pos_sp_triplet.current.type == position_setpoint_s::SETPOINT_TYPE_LOITER) {
231  // Because of noise in measurements, if the rover was always trying to reach an exact point, it would
232  // move around when it should be parked. So, I try to get the rover within loiter_radius/2, but then
233  // once I reach that point, I don't move until I'm outside of loiter_radius.
234  // TODO: Find out if there's a better measurement to use than loiter_radius.
235  if (dist > pos_sp_triplet.current.loiter_radius) {
236  _waypoint_reached = false;
237 
238  } else if (dist <= pos_sp_triplet.current.loiter_radius / 2) {
239  _waypoint_reached = true;
240  }
241 
242  should_idle = _waypoint_reached;
243 
244  } else if (pos_sp_triplet.current.type == position_setpoint_s::SETPOINT_TYPE_POSITION ||
245  pos_sp_triplet.current.type == position_setpoint_s::SETPOINT_TYPE_TAKEOFF ||
246  pos_sp_triplet.current.type == position_setpoint_s::SETPOINT_TYPE_LAND) {
247  should_idle = false;
248  }
249 
250 
251  if (should_idle) {
252  _act_controls.control[actuator_controls_s::INDEX_YAW] = 0.0f;
253  _act_controls.control[actuator_controls_s::INDEX_THROTTLE] = 0.0f;
254 
255  } else {
256 
257  /* waypoint is a plain navigation waypoint or the takeoff waypoint, does not matter */
258  _gnd_control.navigate_waypoints(prev_wp, curr_wp, current_position, ground_speed_2d);
259 
260  _act_controls.control[actuator_controls_s::INDEX_THROTTLE] = mission_throttle;
261 
262  float desired_r = ground_speed_2d.norm_squared() / math::abs_t(_gnd_control.nav_lateral_acceleration_demand());
263  float desired_theta = (0.5f * M_PI_F) - atan2f(desired_r, _param_wheel_base.get());
264  float control_effort = (desired_theta / _param_max_turn_angle.get()) * math::sign(
266  control_effort = math::constrain(control_effort, -1.0f, 1.0f);
267  _act_controls.control[actuator_controls_s::INDEX_YAW] = control_effort;
268 
269  }
270 
271  } else {
272  _control_mode_current = UGV_POSCTRL_MODE_OTHER;
273  setpoint = false;
274  }
275 
276  return setpoint;
277 }
278 
279 void
281  const position_setpoint_triplet_s &pos_sp_triplet)
282 {
283 
284  float dt = 0.01; // Using non zero value to a avoid division by zero
285 
286  const float mission_throttle = _param_throttle_cruise.get();
287  const matrix::Vector3f desired_velocity{pos_sp_triplet.current.vx, pos_sp_triplet.current.vy, pos_sp_triplet.current.vz};
288  const float desired_speed = desired_velocity.norm();
289 
290  if (desired_speed > 0.01f) {
291 
292  const Dcmf R_to_body(Quatf(_vehicle_att.q).inversed());
293  const Vector3f vel = R_to_body * Vector3f(current_velocity(0), current_velocity(1), current_velocity(2));
294 
295  const float x_vel = vel(0);
296  const float x_acc = _vehicle_acceleration_sub.get().xyz[0];
297 
298  const float control_throttle = pid_calculate(&_speed_ctrl, desired_speed, x_vel, x_acc, dt);
299 
300  //Constrain maximum throttle to mission throttle
301  _act_controls.control[actuator_controls_s::INDEX_THROTTLE] = math::constrain(control_throttle, 0.0f, mission_throttle);
302 
303  Vector3f desired_body_velocity;
304 
305  if (pos_sp_triplet.current.velocity_frame == position_setpoint_s::VELOCITY_FRAME_BODY_NED) {
306  desired_body_velocity = desired_velocity;
307 
308  } else {
309  // If the frame of the velocity setpoint is unknown, assume it is in local frame
310  desired_body_velocity = R_to_body * desired_velocity;
311 
312  }
313 
314  const float desired_theta = atan2f(desired_body_velocity(1), desired_body_velocity(0));
315  float control_effort = desired_theta / _param_max_turn_angle.get();
316  control_effort = math::constrain(control_effort, -1.0f, 1.0f);
317 
318  _act_controls.control[actuator_controls_s::INDEX_YAW] = control_effort;
319 
320  } else {
321 
322  _act_controls.control[actuator_controls_s::INDEX_THROTTLE] = 0.0f;
323  _act_controls.control[actuator_controls_s::INDEX_YAW] = 0.0f;
324 
325  }
326 }
327 
328 void
330 {
331  // quaternion attitude control law, qe is rotation from q to qd
332  const Quatf qe = Quatf(att.q).inversed() * Quatf(att_sp.q_d);
333  const Eulerf euler_sp = qe;
334 
335  float control_effort = euler_sp(2) / _param_max_turn_angle.get();
336  control_effort = math::constrain(control_effort, -1.0f, 1.0f);
337 
338  const float control_throttle = math::constrain(att_sp.thrust_body[0], -1.0f, 1.0f);
339 
340  if (control_throttle >= 0.0f) {
341  _act_controls.control[actuator_controls_s::INDEX_YAW] = control_effort;
342 
343  } else {
344  // reverse steering, if driving backwards
345  _act_controls.control[actuator_controls_s::INDEX_YAW] = -control_effort;
346  }
347 
348  _act_controls.control[actuator_controls_s::INDEX_THROTTLE] = control_throttle;
349 
350 }
351 
352 void
354 {
355  _control_mode_sub = orb_subscribe(ORB_ID(vehicle_control_mode));
356  _global_pos_sub = orb_subscribe(ORB_ID(vehicle_global_position));
357  _local_pos_sub = orb_subscribe(ORB_ID(vehicle_local_position));
358  _manual_control_sub = orb_subscribe(ORB_ID(manual_control_setpoint));
359  _pos_sp_triplet_sub = orb_subscribe(ORB_ID(position_setpoint_triplet));
360  _att_sp_sub = orb_subscribe(ORB_ID(vehicle_attitude_setpoint));
361 
362  _vehicle_attitude_sub = orb_subscribe(ORB_ID(vehicle_attitude));
363  _sensor_combined_sub = orb_subscribe(ORB_ID(sensor_combined));
364 
365  /* rate limit control mode updates to 5Hz */
367 
368  /* rate limit position updates to 50 Hz */
371 
372  parameters_update(true);
373 
374  /* wakeup source(s) */
375  px4_pollfd_struct_t fds[4];
376 
377  /* Setup of loop */
378  fds[0].fd = _global_pos_sub;
379  fds[0].events = POLLIN;
380  fds[1].fd = _manual_control_sub;
381  fds[1].events = POLLIN;
382  fds[2].fd = _sensor_combined_sub;
383  fds[2].events = POLLIN;
384  fds[3].fd = _vehicle_attitude_sub;
385  fds[3].events = POLLIN;
386 
387  while (!should_exit()) {
388 
389  /* wait for up to 500ms for data */
390  int pret = px4_poll(&fds[0], (sizeof(fds) / sizeof(fds[0])), 500);
391 
392  /* this is undesirable but not much we can do - might want to flag unhappy status */
393  if (pret < 0) {
394  warn("poll error %d, %d", pret, errno);
395  continue;
396  }
397 
398  /* check vehicle control mode for changes to publication state */
401  //manual_control_setpoint_poll();
402 
404 
405  /* update parameters from storage */
407 
408  bool manual_mode = _control_mode.flag_control_manual_enabled;
409 
410  /* only run controller if position changed */
411  if (fds[0].revents & POLLIN) {
413 
414  /* load local copies */
415  orb_copy(ORB_ID(vehicle_global_position), _global_pos_sub, &_global_pos);
416  orb_copy(ORB_ID(vehicle_local_position), _local_pos_sub, &_local_pos);
417 
419 
420  //Convert Local setpoints to global setpoints
425 
426  } else {
429 
430  }
431  }
432 
433  // update the reset counters in any case
435 
437  matrix::Vector2f current_position((float)_global_pos.lat, (float)_global_pos.lon);
439 
440  if (!manual_mode && _control_mode.flag_control_position_enabled) {
441 
442  if (control_position(current_position, ground_speed, _pos_sp_triplet)) {
443 
444  //TODO: check if radius makes sense here
445  float turn_distance = _param_l1_distance.get(); //_gnd_control.switch_distance(100.0f);
446 
447  // publish status
448  position_controller_status_s pos_ctrl_status = {};
449 
450  pos_ctrl_status.nav_roll = 0.0f;
451  pos_ctrl_status.nav_pitch = 0.0f;
452  pos_ctrl_status.nav_bearing = _gnd_control.nav_bearing();
453 
454  pos_ctrl_status.target_bearing = _gnd_control.target_bearing();
455  pos_ctrl_status.xtrack_error = _gnd_control.crosstrack_error();
456 
459 
460  pos_ctrl_status.acceptance_radius = turn_distance;
461  pos_ctrl_status.yaw_acceptance = NAN;
462 
463  pos_ctrl_status.timestamp = hrt_absolute_time();
464 
465  _pos_ctrl_status_pub.publish(pos_ctrl_status);
466 
467  }
468 
469  } else if (!manual_mode && _control_mode.flag_control_velocity_enabled) {
470 
471  control_velocity(current_velocity, _pos_sp_triplet);
472 
473  }
474 
475 
477  }
478 
479  if (fds[3].revents & POLLIN) {
480 
482 
483  if (!manual_mode && _control_mode.flag_control_attitude_enabled
486 
488 
489  }
490 
491  }
492 
493  if (fds[1].revents & POLLIN) {
494 
495  // This should be copied even if not in manual mode. Otherwise, the poll(...) call will keep
496  // returning immediately and this loop will eat up resources.
497  orb_copy(ORB_ID(manual_control_setpoint), _manual_control_sub, &_manual);
498 
499  if (manual_mode) {
500  /* manual/direct control */
501  //PX4_INFO("Manual mode!");
502  _act_controls.control[actuator_controls_s::INDEX_ROLL] = _manual.y;
503  _act_controls.control[actuator_controls_s::INDEX_PITCH] = -_manual.x;
504  _act_controls.control[actuator_controls_s::INDEX_YAW] = _manual.r; //TODO: Readd yaw scale param
505  _act_controls.control[actuator_controls_s::INDEX_THROTTLE] = _manual.z;
506  }
507  }
508 
509  if (fds[2].revents & POLLIN) {
510 
512 
513  //orb_copy(ORB_ID(vehicle_attitude), _vehicle_attitude_sub, &_vehicle_att);
515 
516  /* Only publish if any of the proper modes are enabled */
519  manual_mode) {
520  /* publish the actuator controls */
522  }
523  }
524 
525  }
526 
534 
535  warnx("exiting.\n");
536 }
537 
538 int RoverPositionControl::task_spawn(int argc, char *argv[])
539 {
540  /* start the task */
541  _task_id = px4_task_spawn_cmd("rover_pos_ctrl",
542  SCHED_DEFAULT,
543  SCHED_PRIORITY_POSITION_CONTROL,
544  1700,
545  (px4_main_t)&RoverPositionControl::run_trampoline,
546  nullptr);
547 
548  if (_task_id < 0) {
549  warn("task start failed");
550  return -errno;
551  }
552 
553  return OK;
554 }
555 
557 {
558 
559  if (argc > 0) {
560  PX4_WARN("Command 'start' takes no arguments.");
561  return nullptr;
562  }
563 
565 
566  if (instance == nullptr) {
567  PX4_ERR("Failed to instantiate RoverPositionControl object");
568  }
569 
570  return instance;
571 }
572 
573 int RoverPositionControl::custom_command(int argc, char *argv[])
574 {
575  return print_usage("unknown command");
576 }
577 
578 int RoverPositionControl::print_usage(const char *reason)
579 {
580  if (reason) {
581  PX4_WARN("%s\n", reason);
582  }
583 
584  PRINT_MODULE_DESCRIPTION(
585  R"DESCR_STR(
586 ### Description
587 Controls the position of a ground rover using an L1 controller.
588 
589 Publishes `actuator_controls_0` messages at a constant 250Hz.
590 
591 ### Implementation
592 Currently, this implementation supports only a few modes:
593 
594  * Full manual: Throttle and yaw controls are passed directly through to the actuators
595  * Auto mission: The rover runs missions
596  * Loiter: The rover will navigate to within the loiter radius, then stop the motors
597 
598 ### Examples
599 CLI usage example:
600 $ rover_pos_control start
601 $ rover_pos_control status
602 $ rover_pos_control stop
603 
604 )DESCR_STR");
605 
606  PRINT_MODULE_USAGE_NAME("rover_pos_control", "controller");
607  PRINT_MODULE_USAGE_COMMAND("start")
608  PRINT_MODULE_USAGE_DEFAULT_COMMANDS();
609 
610  return 0;
611 }
612 
613 int rover_pos_control_main(int argc, char *argv[])
614 {
615  return RoverPositionControl::main(argc, argv);
616 }
void control_attitude(const vehicle_attitude_s &att, const vehicle_attitude_setpoint_s &att_sp)
constexpr _Tp constrain(_Tp val, _Tp min_val, _Tp max_val)
Definition: Limits.hpp:66
__EXPORT void pid_init(PID_t *pid, pid_mode_t mode, float dt_min)
Definition: pid.cpp:57
int globallocalconverter_init(double lat_0, double lon_0, float alt_0, uint64_t timestamp)
Initialize the global mapping between global position (spherical) and local position (NED)...
Definition: geo.cpp:211
int orb_copy(const struct orb_metadata *meta, int handle, void *buffer)
Definition: uORB.cpp:90
void control_velocity(const matrix::Vector3f &current_velocity, const position_setpoint_triplet_s &pos_sp_triplet)
float nav_bearing()
The current target bearing.
measure the time elapsed performing an event
Definition: perf_counter.h:56
void set_l1_damping(float damping)
Set the L1 damping factor.
Definition of geo / math functions to perform geodesic calculations.
vehicle_local_position_s _local_pos
global vehicle position
Dcm< float > Dcmf
Definition: Dcm.hpp:185
__EXPORT int rover_pos_control_main(int argc, char *argv[])
L1 control app start / stop handling function.
float get_distance_to_next_waypoint(double lat_now, double lon_now, double lat_next, double lon_next)
Returns the distance to the next waypoint in meters.
Definition: geo.cpp:270
int main(int argc, char **argv)
Definition: main.cpp:3
sensor_combined_s _sensor_combined
int orb_set_interval(int handle, unsigned interval)
Definition: uORB.cpp:126
Definition: I2C.hpp:51
int px4_poll(px4_pollfd_struct_t *fds, nfds_t nfds, int timeout)
uORB::Subscription _parameter_update_sub
ECL_L1_Pos_Controller _gnd_control
vehicle_global_position_s _global_pos
global vehicle position
struct position_setpoint_s previous
Type norm_squared() const
Definition: Vector.hpp:78
LidarLite * instance
Definition: ll40ls.cpp:65
bool control_position(const matrix::Vector2f &global_pos, const matrix::Vector3f &ground_speed, const position_setpoint_triplet_s &_pos_sp_triplet)
Control position.
__EXPORT float pid_calculate(PID_t *pid, float sp, float val, float val_dot, float dt)
Definition: pid.cpp:113
manual_control_setpoint_s _manual
r/c channel data
actuator_controls_s _act_controls
direct control of actuators
float crosstrack_error()
Get the current crosstrack error.
enum RoverPositionControl::UGV_POSCTRL_MODE UGV_POSCTRL_MODE_OTHER
used to check the mode in the last control loop iteration. Use to check if the last iteration was in ...
int orb_subscribe(const struct orb_metadata *meta)
Definition: uORB.cpp:75
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
Definition: uORB.h:87
struct position_setpoint_s current
vehicle_attitude_s _vehicle_att
bool publish(const T &data)
Publish the struct.
Definition: Publication.hpp:68
static void parameters_update()
update all parameters
void perf_free(perf_counter_t handle)
Free a counter.
vehicle_control_mode_s _control_mode
control mode
float target_bearing()
Bearing from aircraft to current target.
#define perf_alloc(a, b)
Definition: px4io.h:59
int orb_unsubscribe(int handle)
Definition: uORB.cpp:85
constexpr T radians(T degrees)
Definition: Limits.hpp:85
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
Definition: integration.cpp:8
static hrt_abstime hrt_elapsed_time(const hrt_abstime *then)
Compute the delta between a timestamp taken in the past and now.
Definition: drv_hrt.h:102
Euler< float > Eulerf
Definition: Euler.hpp:156
float nav_lateral_acceleration_demand()
Get lateral acceleration demand.
#define warnx(...)
Definition: err.h:95
hrt_abstime _control_position_last_called
last call of control_position
uORB::Publication< position_controller_status_s > _pos_ctrl_status_pub
perf_counter_t _loop_perf
loop performance counter
void perf_end(perf_counter_t handle)
End a performance event.
bool updated()
Check if there is a new update.
void set_l1_period(float period)
Set the L1 period.
const T & get() const
position_setpoint_triplet_s _pos_sp_triplet
triplet of mission items
SubscriptionData< vehicle_acceleration_s > _vehicle_acceleration_sub
_Tp abs_t(_Tp val)
Definition: SearchMin.hpp:49
int sign(T val)
Definition: Functions.hpp:49
Vector3< float > Vector3f
Definition: Vector3.hpp:136
int _control_mode_sub
control mode subscription
void navigate_waypoints(const matrix::Vector2f &vector_A, const matrix::Vector2f &vector_B, const matrix::Vector2f &vector_curr_position, const matrix::Vector2f &ground_speed)
Navigate between two waypoints.
__EXPORT int pid_set_parameters(PID_t *pid, float kp, float ki, float kd, float integral_limit, float output_limit)
Definition: pid.cpp:71
int globallocalconverter_toglobal(float x, float y, float z, double *lat, double *lon, float *alt)
Convert from local position coordinates to global position coordinates using the global reference...
Definition: geo.cpp:241
static int print_usage(const char *reason=nullptr)
void set_l1_roll_limit(float roll_lim_rad)
Set the maximum roll angle output in radians.
static int task_spawn(int argc, char *argv[])
Quaternion< float > Quatf
Definition: Quaternion.hpp:544
float dt
Definition: px4io.c:73
int orb_check(int handle, bool *updated)
Definition: uORB.cpp:95
static RoverPositionControl * instantiate(int argc, char *argv[])
uORB::Publication< actuator_controls_s > _actuator_controls_pub
bool globallocalconverter_initialized()
Checks if globallocalconverter was initialized.
Definition: geo.cpp:224
#define OK
Definition: uavcan_main.cpp:71
#define M_PI_F
Definition: ashtech.cpp:44
int _manual_control_sub
notification of manual control updates
bool copy(void *dst)
Copy the struct.
#define warn(...)
Definition: err.h:94
void perf_begin(perf_counter_t handle)
Begin a performance event.
__EXPORT hrt_abstime hrt_absolute_time(void)
Get absolute time in [us] (does not wrap).
static int custom_command(int argc, char *argv[])
vehicle_attitude_setpoint_s _att_sp
attitude setpoint >