Commit Graph

282 Commits

Author SHA1 Message Date
Lucas De Marchi a096703b06 Global: don't link with AP_Progmem
AP_Progmem is not used anymore.
2015-12-27 15:58:12 -02:00
DonLakeFlyer 7cd3d8bfdc AP_Mission: better mission errors 2015-12-21 16:02:23 +11:00
Lucas De Marchi 3818a8a703 AP_Mission: remove unused AP_ADC_AnalogSource 2015-12-03 13:32:43 +11:00
Caio Marcelo de Oliveira Filho 6e7b73610d waf: add waf support 2015-12-03 07:54:30 +11:00
Caio Marcelo de Oliveira Filho 01e4265ce1 AP_Mission: example uses millis/micros/panic functions 2015-11-20 12:32:09 +09:00
Caio Marcelo de Oliveira Filho f20a4e413c AP_Mission: use millis/micros/panic functions 2015-11-20 12:32:03 +09:00
Lucas De Marchi 3941bb7347 AP_Mission: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1 2015-11-04 12:14:12 +11:00
Lucas De Marchi 20c6ffc5e3 Replace use of UARTDriver::printf_P() with UARTDriver::printf()
This also starts to show warnings on places that were already using
wrong printf format strings.
2015-10-30 14:35:25 +09:00
Lucas De Marchi a964ac38ec Replace use of print_P() with print() 2015-10-30 14:35:21 +09:00
Lucas De Marchi 831d8acca5 Remove use of PROGMEM
Now variables don't have to be declared with PROGMEM anymore, so remove
them. This was automated with:

    git grep -l -z PROGMEM | xargs -0 sed -i 's/ PROGMEM / /g'
    git grep -l -z PROGMEM | xargs -0 sed -i 's/PROGMEM//g'

The 2 commands were done so we don't leave behind spurious spaces.

AVR-specific places were not changed.
2015-10-30 14:35:16 +09:00
Lucas De Marchi 2c38e31c93 Remove use of PSTR
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.

This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.

AVR-specific places were not changed.
2015-10-30 14:35:04 +09:00
Caio Marcelo de Oliveira Filho 118de8d01f AP_Mission: remove unnecessary includes from example 2015-10-21 09:16:11 +11:00
Caio Marcelo de Oliveira Filho ec52df991c build: compile only the HAL files needed by the board
Instead of requiring every program to specify the HAL related modules,
let the build system do it (in practice everything we compiled depended
on HAL anyway). This allow including only the necessary files in the
compilation.
2015-10-21 09:16:07 +11:00
Caio Marcelo de Oliveira Filho 2e464a53c2 AP_HAL: make code not depend on concrete HAL implementations
The switching between different AP_HAL was happening by giving different
definitions of AP_HAL_BOARD_DRIVER, and the programs would use it to
instantiate.

A program or library code would have to explicitly include (and depend)
on the concrete implementation of the HAL, even when using it only via
interface.

The proposed change move this dependency to be link time. There is a
AP_HAL::get_HAL() function that is used by the client code. Each
implementation of HAL provides its own definition of this function,
returning the appropriate concrete instance.

Since this replaces the job of AP_HAL_BOARD_DRIVER, the definition was
removed.

The static variables for PX4 and VRBRAIN were named differently to avoid
shadowing the extern symbol 'hal'.
2015-10-21 09:16:07 +11:00
Randy Mackay 756d564b7c Mission: sanity check command altitudes 2015-10-19 16:15:08 +09:00
Tom Pittenger cb20325593 AP_Mission: added flight stage FLIGHT_LAND_ABORT
- add get_prev_nav_cmd_with_wp_index(). This is different than get_prev_nav_cmd_index() in that it only stores the index if there is a valid lat/lng (+1 squashed commits)
- added mission item command to NAV_LAND which is the abort takeoff altitude. If 0 then use last takeoff if available, else use 50m
2015-09-09 09:04:24 +10:00
Tom Pittenger 1026e7df45 AP_Mission: updated comment
altitude and lat/lng are all used
2015-09-08 17:05:54 +10:00
Tom Pittenger 15b242832e AP_Mission: lat/lng == 0 bug fix
was using wrong logic to check for lat/lng == 0
2015-08-29 21:17:35 +10:00
Tom Pittenger 41508457e1 AP_Mission: add get_prev_nav_cmd_with_wp_index()
This is different than get_prev_nav_cmd_index() in that it only stores the index if there is a valid lat/lng
2015-08-29 21:17:35 +10:00
Randy Mackay 1271e531e2 Mission: sanity check location 2015-08-27 15:15:56 +09:00
Michael Day a5e1d8e902 AP_Mission: Give CONINTUE_AND_CHANGE_ALT a parameter: climb/descend
Param 1 denotes which direction the user expects the plane to
travel when changing altitude:

0 = no expectation, command completes when within 5 m of altitude.
1 = climb expected, command completes at or above altitude.
2 = descent expected, command completes at or below altitude.
2015-08-20 11:37:17 +10:00
Gustavo Jose de Sousa 34d1a29ec1 AP_Mission: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-11 16:38:19 +10:00
Randy Mackay 766ccea3be Mission: fix bug causing first do-cmd to be run many times
The symptom was that if the very first command in the mission was a
do-command, it would be run after every nav-command that didn't have
another do-command before it.
2015-07-17 12:15:08 +09:00
Randy Mackay 429346f4bc AP_Mission: add missing breaks to case statement 2015-07-17 12:15:06 +09:00
Tom Pittenger e6122d1a4e AP_Mission: ensure cache coherence on mission resume
- when resuming a mission we should read the value from storage of the same index to ensure we're not continuing an old cached version of the mission item.
- inherent problem: DO commands will continue and will be unaffected unless the new mission has a different DO_ command structure. If so, a set_current_cmd() or reset() should be issued by the GCS.
2015-06-25 10:21:06 +10:00
Andrew Tridgell 9bd8e215b2 AP_Mission: enable DO_AUTOTUNE_ENABLE 2015-06-15 09:20:54 +10:00
Andrew Tridgell 08acde2766 AP_Mission: added ALTITUDE_WAIT NAV command
used for HAB launch
2015-06-15 09:20:54 +10:00
Randy Mackay 9c28d61a5c Mission: protect against endless loops of do-commands 2015-06-01 18:11:54 +09:00
Andrew Tridgell 767aeedf01 AP_Mission: fixed example sketch 2015-06-01 18:05:38 +10:00
Andrew Tridgell d1ed4c863c AP_Mission: convert example from .pde to .cpp 2015-06-01 17:07:04 +10:00
Andrew Tridgell ec2d429513 AP_Mission: all vehicles now use functors 2015-06-01 15:18:31 +10:00
Andrew Tridgell e3f8e22fc6 AP_Mission: removed BUILD_DELEGATES code
no longer needed
2015-05-26 14:34:51 +10:00
Lucas De Marchi 384a3bfcc3 AP_Mission: allow to use functor 2015-05-26 13:46:50 +10:00
Andrew Tridgell e7ba2c8d93 AP_Mission: use APM_BUILD_DELEGATES 2015-05-21 07:48:51 +10:00
Andrew Tridgell 12cbf7888f AP_Mission: support member functions for rover 2015-05-21 07:48:46 +10:00
Tom Pittenger 79605de8f5 AP_Mission: replace fabs() with fabsf() 2015-05-09 09:57:27 +10:00
Andrew Tridgell 0c142bb25a AP_Mission: fix for HAL_SITL rename 2015-05-05 09:45:55 +10:00
Randy Mackay ed61d961c3 Mission: fix example sketch 2015-05-01 20:58:06 +09:00
Randy Mackay dfadcad69d Mission: allow zoom_step to be negative 2015-04-29 14:36:25 +09:00
Michael Day 3d3267d472 AP_Mission: Now support mission item MAV_CMD_NAV_LOITER_TO_ALT 2015-04-25 09:12:16 +10:00
Randy Mackay 87e6452ee9 Mission: bug fix when jump target is zero
This would result in copter flying to a waypoint high above home
2015-04-21 20:42:49 +09:00
Randy Mackay 888c2289ce Mission: support do-digicam-control parameters 2015-04-20 13:50:01 +09:00
Randy Mackay f6021010c5 Mission: support do-mount-control 2015-03-21 21:52:19 +09:00
Randy Mackay b01f9505b1 Mission: fix example sketch
Also replace printf with print where possible
2015-03-16 20:29:05 +09:00
Andrew Tridgell 3a1cbaeb25 AP_Mission: fix for new compass API 2015-03-13 18:46:18 +11:00
Randy Mackay 4772fd338c Mission: fix example sketch 2015-03-13 16:40:59 +09:00
Randy Mackay 355a92aff4 Mission: fix example sketch 2015-01-28 17:15:44 +09:00
Andrew Tridgell 3d433d2106 AP_Mission: loop check is only needed in one place 2015-01-23 13:48:45 +11:00
Andrew Tridgell 540cadc086 AP_Mission: prevent infinite loop with linked jump commands
this prevents a "jump loop" from causing a firmware lockup. Thanks to
dellarb for reporting this!
2015-01-23 13:14:27 +11:00
Andrew Tridgell 8aa1a89081 AP_Mission: updates for new AP_Baro API 2015-01-09 11:50:56 +11:00
Randy Mackay a44b4b5e87 Mission: allow 15 do-jump commands on Pixhawk 2014-12-18 17:02:48 +09:00
Andrew Tridgell ede920f293 AP_Mission: ensure location options are zero at start of mavlink conversion 2014-12-03 18:29:43 +11:00
Michael Day b3e693daa4 AP_Mission: Support MAV_CMD_DO_FENCE_ENABLE as a mission item. 2014-11-25 13:02:47 +11:00
Michael Day b36c1b2c3d AP_Mission: support for MAV_CMD_CONTINUE_AND_CHANGE_ALT 2014-11-25 10:43:15 +11:00
Michael Day 83c2f497a3 AP_Mission: Change jump_to_landing_sequence to get_landing_sequence_start 2014-10-24 21:42:06 +11:00
Andrew Tridgell 868ee3af23 AP_Mission: fixed example build 2014-10-24 12:10:40 +11:00
Andrew Tridgell 15a661e17a AP_Mission: fixed logic in jump_to_landing_sequence()
see comments on drones-discuss
2014-10-20 08:36:20 +11:00
Andrew Tridgell 8c6b875dcc AP_Mission: avoid the AP_AHRS cast
get_position() is now const
2014-10-20 08:36:20 +11:00
Michael Day ea91f4d47b AP_Mission: Added support for MAV_CMD_DO_LAND_START 2014-10-20 08:36:19 +11:00
Randy Mackay be1621877f Mission: support GUIDED_ENABLE and GUIDED_LIMITS
This replaces the ardupilot only NAV_GUIDED command.
Also remove support for NAV_VELOCITY mission command which will be
replaced by SET_POSITION_TARGET non-mission command.
2014-10-13 21:40:23 +09:00
Randy Mackay 5ca3c4baf6 Mission: fix CHANGE_ALT to store climb rate in lat param
The slightly confusing storage of climb rate in the lat field led to a
bug fix a few months ago that actually created a bug.
2014-09-26 23:23:04 +09:00
Randy Mackay 1ce8e453c2 Mission: add support for DO_GRIPPER 2014-09-17 21:14:17 +09:00
Andrew Tridgell effccacf46 AP_Mission: fixed acceptance radius outgoing
this needs to match incoming
2014-09-03 21:15:56 +10:00
Andrew Tridgell 3a5e960fe5 AP_Mission: revert APM_BUILD_TYPE change 2014-09-03 13:28:17 +10:00
Andrew Tridgell 36b854fa98 AP_Mission: fixed build for arduino IDE 2014-09-03 13:20:31 +10:00
Andrew Tridgell c4f84232e2 AP_Mission: make cmd.p1 be radius on plane for NAV_WAYPOINT 2014-09-03 12:38:30 +10:00
Randy Mackay d6aa868cac Mission: start next nav cmd immediately after prev completes 2014-08-27 18:05:49 +10:00
Andrew Tridgell 3357df9529 AP_Mission: fixed example sketch 2014-08-14 10:48:31 +10:00
Andrew Tridgell ce193f5c5c AP_Mission: fixed example build 2014-08-13 21:48:35 +10:00
Andrew Tridgell 7a12ff0271 AP_Mission: convert to using StorageManager 2014-08-13 18:46:43 +10:00
Daniel Frenzel 1c7e8f8fb2 AP_Mission: Consecutive return, break, continue, goto or throw statements are unnecessary.
Signed-off-by: Daniel Frenzel <dgdanielf@gmail.com>
2014-08-11 09:24:26 +10:00
Andrew Tridgell df55ae86c4 AP_Mission: added last_change_time_ms() call
will be used by terrain lib for scanning waypoints
2014-08-06 17:59:19 +10:00
Randy Mackay 621cc2b953 Mission: bug fix to condition-change-alt
Fix contributed by oniondream, thanks!
2014-08-01 12:51:50 +09:00
Andrew Tridgell 50f67dd57d AP_Mission: fixed example build 2014-07-25 17:54:45 +10:00
Andrew Tridgell 34cbaa6f17 AP_Mission: added support for MAV_FRAME_GLOBAL_TERRAIN_ALT 2014-07-25 08:33:44 +10:00
Andrew Tridgell feaf9751cc AP_Mission: removed use of MAV_CMD_NAV_VELOCITY and MAV_CMD_NAV_GUIDED 2014-07-24 21:38:31 +10:00
Randy Mackay fe8a5be802 AP_Mission: support MAV_CMD_NAV_VELOCITY msg 2014-07-06 17:01:00 +09:00
Randy Mackay f4c9d58051 AP_Mission: add support for MAV_CMD_NAV_GUIDED 2014-07-06 17:00:26 +09:00
Randy Mackay 2f7dee3ba5 AP_Mission: squeeze loiter turns radius into high byte of p1 2014-06-17 20:53:50 +10:00
Andrew Tridgell f0df912a11 AP_Mission: added support for MAV_CMD_DO_INVERTED_FLIGHT 2014-06-05 15:44:18 +10:00
Randy Mackay 05f5164dfa Mission: rename AUTORESET to RESTART 2014-05-09 11:31:37 +09:00
Andrew Tridgell 818e500509 AP_Mission: improve the AP_Mission docs
DisplayName isn't a description
2014-04-29 11:46:06 +10:00
Andrew Chapman 782fbe1ec5 AP_Mission: added reset() function 2014-04-29 11:46:06 +10:00
Andrew Chapman a80e72ff82 AP_Mission: added MIS_AUTORESTART parameter
- added MIS_AUTORESTART parameter, defaults to 0
- added start_or_resume() function to either start or resume a mission
based on that parameter value
2014-04-29 11:46:06 +10:00
Andrew Tridgell e10542dcae AP_Mission: added get_current_nav_index() function
this will return 0 when there is no current command, which is what is
expected in MAVLink when there is no mission

(it prevents the text to speech announcing "65 thousand 6 hundred and
thirty five", which is quite annoying!)
2014-04-22 11:40:18 +10:00
Randy Mackay 5322093475 Mission: fix example sketch after GPS lib changes 2014-04-17 16:41:38 +09:00
Randy Mackay d8f9a1c6c6 Mission: add support for MAV_CMD_DO_PARACHUTE 2014-04-07 13:36:55 +09:00
Andrew Tridgell cc212be41e AP_Mission: added get_next_ground_course_cd() API
this gives the ground course of the next navigation leg, which can be
used to calculate the amount of steering required
2014-04-07 09:29:54 +10:00
Andrew Tridgell 31082f4ce2 AP_Mission: fixed a bug re-entering AUTO
this fixes a bug found by Marco where we would continue in CRUISE mode
with no waypoint if we re-entered AUTO after a mission reset
2014-03-31 06:18:07 +11:00
Randy Mackay 93f8d53d1b Mission: make get_prev_nav_cmd_index const 2014-03-30 23:09:54 +09:00
Randy Mackay ac339a0289 Mission: add decoding of NAV_SPLINE command 2014-03-28 09:23:30 +09:00
Randy Mackay f2d9ad41aa Mission: minor comment update 2014-03-28 09:22:56 +09:00
Andrew Tridgell 0af35bd636 AP_Mission: fixed some compiler warnings 2014-03-24 12:52:27 +11:00
Andrew Tridgell 3bdc22d672 AP_Mission: make p1 16 bit
this gives us a 16 bit value for extra data on a location, allowing
for an accurate angle in centi-degrees.

Also add validation of the size of the union arms in Content
2014-03-20 16:57:09 +11:00
Randy Mackay c520cb789c Mission: cmd field types to match mavlink commands
Split Set-Servo and Repeat-Servo command structures
Split Set-Relay and Repeat-Relay command structures
2014-03-19 12:14:22 +09:00
Randy Mackay 37cff752c8 Mission: handle Loiter direction
loiter-unlimited, loiter-turns and loiter-time cms specify the turn
direction in Param3.  This is stored in the location's loiter_ccw flag.
Previously supported only in Plane, moving here allows us to share more
code with Plane, Copter, Rover.
2014-03-19 12:13:16 +09:00
Randy Mackay c75560218d Mission: command specific structures 2014-03-19 12:12:51 +09:00
Andrew Tridgell 3a6698f54b AP_Mission: fixed typo 2014-03-19 12:12:42 +09:00
Andrew Tridgell 3538621c48 AP_Mission: doc updates 2014-03-19 12:12:40 +09:00
Randy Mackay 48329c1bba Mission: bug fix for loading consecutive do-cmds
The verify step was not being run for the 2nd consecutive do-command in
a mission list
2014-03-19 12:12:37 +09:00
Randy Mackay ece02b0c9a Mission: get_prev_nav_cmd returns int16 2014-03-19 12:12:34 +09:00
Randy Mackay 266a1ce9af Mission: bug fix set_current_cmd
If mission had completed desired command index was ignored
2014-03-19 12:12:27 +09:00
Andrew Tridgell 107cc2c126 AP_Mission: added truncate() function
Used when loading a mission while flying

Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2014-03-19 12:12:21 +09:00
Andrew Tridgell acdaf561c8 AP_Mission: fixed typo 2014-03-19 12:12:15 +09:00
Randy Mackay 8e117d29eb Mission: test exceeding command storage size 2014-03-19 12:11:55 +09:00
Randy Mackay 9e07070d86 Mission: pass eeprom start into constructor
This allows different storage locations for ArduCopter, Plane and Rover
2014-03-19 12:11:53 +09:00
Randy Mackay ddc4cd4f18 Mission: add init and check_eeprom_version methods 2014-03-19 12:11:46 +09:00
Randy Mackay 4c0a31a9dc Mission: init home to zero before writing to eeprom 2014-03-19 12:11:37 +09:00
Randy Mackay df339c05fc Mission: num_commands returns uint16 2014-03-19 12:11:25 +09:00
Randy Mackay e60865b715 Mission: example sketch test for set_current_cmd 2014-03-19 12:11:12 +09:00
Randy Mackay 512b378c4a Mission: allow set_current_cmd when mission is not running
Can now be run when mission is complete or stopped.  When mission is
resumed it will begin at the set command.  This command can be either a
nav or do command
2014-03-19 12:11:10 +09:00
Andrew Tridgell eaf34bba9a AP_Mission: fixed reset using set mission item to 0
this causes a mission reset
2014-03-19 12:11:07 +09:00
Randy Mackay 8dd301b0c2 Mission: set_current_cmd to use uint16 2014-03-19 12:11:06 +09:00
Randy Mackay a6e422333e Mission: remove alt_in_cm from mavlink to cmd conversion 2014-03-19 12:11:01 +09:00
Randy Mackay 5dd86bd7d7 Mission: update example sketch for p1's move to cmd structure 2014-03-19 12:10:49 +09:00
Randy Mackay 0dc3c9ab42 Mission: add p1 to command structure
mavlink_to_mission_cmd method extended to support plane including adding
parameter to allow the alt to be expressed in cm or meters
2014-03-19 12:10:45 +09:00
Randy Mackay 4c0ae63169 Mission: example sketch test replace_cmd method 2014-03-19 12:10:42 +09:00
Randy Mackay 61cc5e6b72 Mission: add replace_cmd method 2014-03-19 12:10:40 +09:00
Randy Mackay ef21e32fbc Mission: example sketch tests set current command 2014-03-19 12:10:37 +09:00
Randy Mackay 3cbbd4ebb9 Mission: add set current command method 2014-03-19 12:10:36 +09:00
Randy Mackay c7ffd2db90 Mission: reduce unnecessary search for do-commands
do_cmd_all_done flag is set after all do-commands are complete
2014-03-19 12:10:33 +09:00
Randy Mackay 0c92d60406 Mission: command index increase to int16
Once more eeprom space is allocated this will allow more than 255
commands
2014-03-19 12:10:31 +09:00
Randy Mackay 85b979ede9 Mission: support do-jump num_times is -1
do-jump loops forever when num times is set to -1
2014-03-19 12:10:29 +09:00
Randy Mackay c6c43847b6 Mission: example sketch tests set home command 2014-03-19 12:10:27 +09:00
Randy Mackay cc8554fa2b Mission: fix example sketch 2014-03-19 12:10:18 +09:00
Randy Mackay f4d8ccc128 Mission: add mavlink to cmd conversion methods 2014-03-19 12:10:17 +09:00
Randy Mackay 87c7d19f83 AP_Mission: special handling for cmd 2014-03-19 12:10:14 +09:00
Randy Mackay e8db57ced3 AP_Mission: replace block read/write for eeprom
Also reserve command #0 for home position
2014-03-19 12:10:00 +09:00
Randy Mackay fd009d0704 AP_Mission: tests added to example sketch 2014-03-19 12:09:59 +09:00
Randy Mackay 84b3497a82 AP_Mission: fixes to protect against endless loops 2014-03-19 12:09:57 +09:00
Randy Mackay 6086bc14be AP_Mission: mostly working draft 2014-03-19 12:09:56 +09:00
Randy Mackay 4285eba297 AP_Mission: initial draft library 2014-03-19 12:09:54 +09:00