Commit Graph

281 Commits

Author SHA1 Message Date
Peter Barker 2d0a23fcc8 Rover: call ins's periodic function 2017-10-27 16:33:45 +11:00
Lucas De Marchi e98ccb9ae6 ArduRover: use static method to construct controllers 2017-09-26 03:01:21 +01:00
Lucas De Marchi bfd13dfe87 global: use static method to construct AP_AHRS_DCM 2017-09-26 03:01:21 +01:00
Lucas De Marchi beabae6a98 global: use static method to construct AP_AHRS_NavEKF 2017-09-26 03:01:21 +01:00
Lucas De Marchi c9fbf7b722 global: use static method to construct AP_NavEKF3 2017-09-26 03:01:21 +01:00
Lucas De Marchi e2fe36357a global: use static method to construct AP_NavEKF2 2017-09-26 03:01:21 +01:00
Lucas De Marchi eadd650d78 global: use static method to construct AP_RSSI 2017-09-26 03:01:21 +01:00
Lucas De Marchi 18aa88b329 global: use static method to construct AP_Mount 2017-09-26 03:01:21 +01:00
Lucas De Marchi c3647f0185 global: use static method to construct AP_Camera 2017-09-26 03:01:21 +01:00
Lucas De Marchi cc53e7bc4b global: use static method to construct AP_ServoRelayEvents 2017-09-26 03:01:21 +01:00
Lucas De Marchi 13d7f58036 global: use static method to construct AP_Relay 2017-09-26 03:01:21 +01:00
Lucas De Marchi 9ce6019138 global: use static method to construct AP_Frsky_Telem 2017-09-26 03:01:21 +01:00
Lucas De Marchi b022c02029 global: use static method to construct AP_BattMonitor 2017-09-26 03:01:21 +01:00
Lucas De Marchi 69b6d95cb2 global: use static method to construct AP_Board_Config{,_CAN} 2017-09-26 03:01:21 +01:00
Lucas De Marchi a74e700006 global: use static method to construct RCMapper 2017-09-26 03:01:21 +01:00
Lucas De Marchi 72fd2d6f05 global: use static method to construct AP_SerialManager 2017-09-26 03:01:21 +01:00
Lucas De Marchi fbe0d9761c global: use static method to construct AP_OpticalFlow 2017-09-26 03:01:21 +01:00
Lucas De Marchi 5ec1430726 APMrover2: use static method to construct AP_Arming_Rover 2017-09-26 03:01:21 +01:00
Lucas De Marchi b36a5919f5 global: use static method to construct AP_Mission
This also move the initialization to be in the header for those that
weren't already to maintain consistency.
2017-09-26 03:01:21 +01:00
Lucas De Marchi 40fd1b346c global: remove rangefinder from AP_AHRS_NavEKF
AP_AHRS_NavEKF doesn't use the rangefinder, it just delegates the
calls to the right estimator.

For libraries/AP_AHRS/examples/AHRS_Test/AHRS_Test.cpp the initialization
order has also been modified to match the order on vehicles. It's more
correct since it passes a reference when EKF2/EKF3 are already
constructed, while thos constructors use a pointer.  Ideally these
should be moved to an init() method though, or use a get_instance().
2017-09-26 03:01:21 +01:00
Lucas De Marchi 9027a55696 global: use static method to construct RangeFinder 2017-09-26 03:01:21 +01:00
Lucas De Marchi 62ac0ab8aa global: use static method to construct AP_Notify 2017-09-26 03:01:21 +01:00
Lucas De Marchi de680dac5b global: use static method to construct AP_Scheduler 2017-09-26 03:01:21 +01:00
Lucas De Marchi 8094482f21 global: use static method to construct AP_GPS 2017-09-26 03:01:21 +01:00
Lucas De Marchi 87b30b4552 global: use static method to construct AP_InertialSensor 2017-09-26 03:01:21 +01:00
Lucas De Marchi c1a957fbf3 global: use static method to construct Compass 2017-09-26 03:01:21 +01:00
Lucas De Marchi 91feec0e14 global: use static method to construct AP_Baro 2017-09-26 03:01:21 +01:00
Lucas De Marchi 0c49b7a973 APMrover2: move version to a static member
We should never include version.h or ap_version.h headers directly
on a header since this will trigger a complete rebuild of the
codebase when we commit to the repository. The ap_version.h header
is auto-generated containing information from the current commit.

If we include it in a header, every other file that ends up including
that header (directly or indirectly) will need to be rebuilt. No
ccache's cache beats having to do nothing when the header is just
not included.

version.h contains information that is kept on a struct inside
each vehicle. Rather than using the macros from each vehicle,
the getter should be preferred, which returns an AP_FWVersion
referente.
2017-09-23 21:37:45 -07:00
Randy Mackay 894bf2a23f Rover: support SET_GPS_GLOBAL_ORIGIN message 2017-09-19 10:30:15 +09:00
Peter Barker 25a32c93f2 Rover: move gcs_out_of_time into GCS object 2017-09-12 18:28:07 +01:00
Peter Barker d98c427514 Rover: add constant structure holding firmware version 2017-08-30 15:54:46 +01:00
Randy Mackay 1600823b12 Rover: aux switch to learn cruise throttle and speed 2017-08-25 14:05:23 +09:00
Randy Mackay 14c74a5967 Rover: remove learning mode
saving waypoints can be done in manual or steering mode
2017-08-25 14:05:23 +09:00
Randy Mackay 524fe4cd82 Rover: aux switch saves waypoint in manual or steering modes
Also refactor aux switch methods
rename LEARN_CH to AUX_CH
2017-08-25 14:05:23 +09:00
Randy Mackay 82e61d7198 Rover: remove unused throttle_failsafe_active method 2017-08-25 14:05:23 +09:00
khancyr 4ab11027a7 Rover: remove unused mavlink_delay(uint32_t ms) 2017-08-24 20:41:16 +09:00
khancyr ed19db7188 Rover: set_mode arg name to match implementation
definition and implementation used different argument name
2017-08-17 09:46:19 +09:00
Randy Mackay 492fe40f93 Rover: re-organise private member declarations
declarations are grouped by file (which are in turn organised alphabetically) and in the order they appear within each file
non-functional change
2017-08-15 20:47:19 +09:00
Randy Mackay 6c7db05207 Rover: re-organise includes
non-functional change
2017-08-15 20:47:19 +09:00
Randy Mackay 0b917cfd36 Rover: mode auto guided and rtl slow before destination
new mode class member _desired_speed_final holds target speed at destination

main vehicle code passes heading to next waypoint into auto mode.
we do not provide heading when delaying at waypoint which signals we wish

auto-mode calculates final speed at destination which allows vehicle to
make turn within value of WP_OVERSHOOT parameter assuming vehicle turns at
maximum lateral acceleration.
2017-08-15 20:47:19 +09:00
Randy Mackay d99108f3bc Rover: use AR_AttitudeControl for throttle control
also direct throttle nudge replaced with speed nudge
calc_speed_max estimates vehicle's top speed based on cruise-speed and
cruise-throttle
steering mode now provides total target speed instead of using speed plug
throttle nudge
motor limits provided to attitude control to stop i-term buildup
uses negative desired speed instead of reversed flag
reporting to GCS uses new throttle controller
braking is simply enabled and allows a reverse motor output regardless of vehicle
speed
2017-08-15 20:47:19 +09:00
Randy Mackay 9097269d6d Rover: use AR_AttitudeControl for steering control 2017-08-15 20:47:19 +09:00
Peter Barker fa2b500e93 Rover: remove CLI 2017-08-14 10:23:50 +09:00
Randy Mackay 59a1f260d1 Rover: remove unused compat.h 2017-08-12 14:46:46 +09:00
Randy Mackay bff74115bc Rover: remove unused distance_past_wp 2017-08-12 13:05:01 +09:00
Randy Mackay 30852d4713 Rover: auto-reversed moved to mode 2017-08-05 11:20:58 +09:00
Randy Mackay 66f1437e4f Rover: remove unused throttle variable 2017-08-05 11:20:58 +09:00
Randy Mackay e88b1572b6 Rover: remove navigate 2017-08-05 11:20:58 +09:00
Randy Mackay fe6465b748 Rover: remove next_WP, wp_distance, navigate
Also remove prev_WP, wp_totalDistance which are all handled within mode class
2017-08-05 11:20:58 +09:00
Randy Mackay b4af441eb9 Rover: remove unused update_navigation 2017-08-05 11:20:58 +09:00
Randy Mackay 2640ec9ed9 Rover: rename update_commands to update_mission 2017-08-05 11:20:58 +09:00
Randy Mackay 56b0621994 Rover: verify_RTL calls rtl mode
also remove unused rtl_complete
2017-08-05 11:20:58 +09:00
Randy Mackay 1b19ee865d Rover: remove active-loiter and set-auto-wp
these are now handled by auto mode
2017-08-05 11:20:58 +09:00
Randy Mackay 974453607e Rover: replace do-yaw with nav-set-yaw-speed 2017-08-05 11:20:58 +09:00
Randy Mackay b9db9229d9 Rover: replace vehicle code guided methods with calls to guided mode class
set_guided_WP replaced by mode_guided.set_desired_location
nav_set_yaw_speed replaced with mode_guided.set_desired_heading_and_speed
set_guided_velocity replaced with mode_guided.set_desired_turn_rate_and_speed
guided_control structure replaced with mode_guided members
use_pivot_steering accepts yaw-error argument instead of calculating it itself internally
2017-08-05 11:20:58 +09:00
Randy Mackay 783f8243df Rover: use mode class's get_distance_to_destination and speed_error
used for reporting to GCS and logging
2017-08-05 11:20:58 +09:00
Peter Barker dbac7447d6 Rover: move try_send_message send_hwstatus up 2017-08-03 14:34:33 +01:00
Peter Barker 4da89a948a Rover: move try_send_message mission handling up 2017-08-03 14:33:37 +01:00
khancyr 23532bf45c Rover: add reason to set_mode 2017-07-31 18:01:17 +09:00
Peter Barker 81d52c282c Rover: camera is responsible for taking distance-based-images and logging 2017-07-28 14:27:53 +01:00
Randy Mackay ddc70058d5 Rover: reporting wheel encoder rpm 2017-07-27 16:52:29 +09:00
Randy Mackay 72d35593d8 Rover: send wheel encoder data to EKF 2017-07-27 16:52:28 +09:00
Randy Mackay f17f56dea4 Rover: move throttle nudge to Mode class 2017-07-21 10:13:20 +09:00
Peter Barker 07f4603533 Rover: integrate mode class 2017-07-21 10:13:20 +09:00
Peter Barker 9173c7caaf Rover: move starting of new logs into DataFlash 2017-07-19 16:37:28 +01:00
khancyr 918992eb10 Rover: remove unimplemented functions 2017-07-19 11:00:34 +09:00
Randy Mackay 8a86b64776 Rover: motor test accepts negative percentages 2017-07-18 10:15:44 +09:00
Randy Mackay ebeb0923cb Rover: motor test gets improved failure explanations
Also fix pass through for steering channel
2017-07-18 10:15:44 +09:00
khancyr 5208466629 Rover: add motor test 2017-07-18 10:15:44 +09:00
Michael du Breuil a077eac6a9 Rover: Document max loop time as being in microseconds 2017-07-15 17:27:04 +09:00
khancyr 40b860e240 Rover: rename sonar to rangefinder 2017-07-14 17:40:05 +01:00
Randy Mackay 5fc30c763e Rover: move Log_GuidedTarget declaration
No functional change
2017-07-14 07:27:26 +09:00
Randy Mackay ebbbe0584a Rover: integrate wheel encoder 2017-07-14 07:27:26 +09:00
Peter Barker adb89c5ca6 Rover: remove unneeded telemetry_delayed parameter 2017-07-12 17:01:36 +01:00
Peter Barker 2692ee22d3 Rover: eliminate gcs_send_mission_item_reached wrapper 2017-07-11 23:45:16 +01:00
Peter Barker 130ad52a22 Rover: eliminate gcs_send_message wrapper 2017-07-11 23:45:16 +01:00
Peter Barker 9509f7f1bf Rover: use send_text method on the GCS singleton 2017-07-09 17:17:29 -04:00
Pierre Kancir 267a1532b9 Rover: integrate motors library
move throttle_slew_limit and THR_SLEWRATE parameter
move have_skid_steering to library
move mix_skid_steering to library's output_skid_steering method
move radio.cpp's output channel initialisation to motor's init method
use motors.get_throttle and get_steering instead of getting from Servo objects
use motors.set_throttle and set_steering instead of setting to Servo object
AP_Arming::arming_required is replaced with SAFE_DISARM parameter
2017-07-08 16:07:13 +09:00
Peter Barker cfeb449979 Rover: create GCS subclass, use inheritted methods 2017-07-07 16:18:37 +01:00
Eugene Shamaev b6c397c85a APMrover2: move of CAN parameters into separate group 2017-07-03 11:44:32 +01:00
Randy Mackay f036b1f92c Rover: pivot steering stays active until within 10deg of target heading
Previously the vehicle would pop out of pivot-steering once it was within PIVOT_TURN_ANGLE degrees of the target heading.  This meant that it would give up on the pivot steer long before it was actually pointing at the target.
2017-07-01 19:48:01 +09:00
Randy Mackay 351b37fc31 Rover: only report system status after init has completed
This reduces errors reported to the GCS during startup
2017-06-28 11:32:01 +09:00
Peter Barker 3a85d8ed39 Rover: handle knowledge of in_log_download in DataFlash 2017-06-27 03:10:43 +01:00
Pierre Kancir 32dc59baec Rover: fix throttle slew limit for skid steer out 2017-06-24 13:16:40 +09:00
Andrew Tridgell 79f7cc5779 Rover: implement new style skid steering
use throttleLeft and throttleRight servo functions. This gives much
greater flexibility and control over motor trims and limits
2017-06-21 10:30:39 +09:00
Randy Mackay a07920c5b2 Rover: add init_compass method
no functional change
2017-06-14 09:12:20 +09:00
Randy Mackay eb2aa80fca Rover: compass set-initial-location uses ahrs location
Previously it could attempt to use a gps location even if gps was not being used
Also compass-accumulate moved to sensors.cpp
2017-06-14 09:12:20 +09:00
Randy Mackay 584974fd74 Rover: set home from ekf position 2017-06-14 09:12:20 +09:00
Randy Mackay 0da6e73d76 Rover: add support for visual odometry 2017-06-14 09:12:20 +09:00
Dr.-Ing. Amilcar Do Carmo Lucas f004f4b499 Rover: Spell in comments 2017-05-18 09:29:55 +09:00
Pierre Kancir 670e7b7914 ROVER: put all guided param in one structure 2017-05-04 19:53:21 +10:00
Pierre Kancir 045d171ab9 Rover: add Guided velocity controller 2017-05-04 19:53:21 +10:00
Randy Mackay c1d3384835 Rover: rename set_next_WP to set_auto_WP to clarify usage 2017-05-04 19:53:21 +10:00
Randy Mackay d6b55b2d09 Rover: set_guided_WP accepts location 2017-05-04 19:53:21 +10:00
Pierre Kancir 27e52695fe APMRover2: add initial support for MAV_CMD_CONDITION_YAW 2017-04-28 12:01:47 +10:00
karthik.desai 47ff9ddeec Rover: Added Beacon implementation
Enabled beacon parameters
beacon updates at 50hz
Use dataflash library to log AP_Beacon msg
2017-04-26 11:59:11 +09:00
Pierre Kancir c41e695c98 APMRover2: correct some style 2017-04-26 08:43:09 +10:00
Grant Morphett 304c9b6e72 Rover: Fixed a bug in reverse
If a user was driving in reverse and when into an auto mission the
rover would try to do the whole mission in reverse.  This fixes that.
2017-03-15 17:24:35 +11:00
Randy Mackay f29fe8bb88 Rover: always specify rangefinder instance 2017-02-27 15:18:32 +09:00
Peter Barker 45e0765b97 Rover: Support for a GCS singleton 2017-02-13 09:32:01 +11:00
Peter Barker 407e251e1d Rover: rename gcs[] to gcs_chan[]
Wish to use gcs() to return the gcs singleton
2017-02-13 09:32:01 +11:00
Pierre Kancir 99ba8bdc08 APMRover2: add advance failsafe 2017-01-31 17:12:37 +11:00
Randy Mackay 0b8ebe36dd Rover: send flight mode string to Notify 2017-01-23 15:07:21 -08:00
Peter Barker ddf172c75b Rover: AP_Arming: use callback in place of variable reference for home state 2017-01-17 11:45:08 +09:00
Andrew Tridgell 93d6b012c2 Rover: convert to new SRV_Channel API 2017-01-12 17:39:37 +11:00
Peter Barker 61430a51b3 Rover: correct compilation when camera disabled 2017-01-02 16:17:43 +11:00
Pierre Kancir 84f70f722d Rover: Rover.h correct whitespace, remove tabs 2016-12-30 09:20:24 +09:00
priseborough 2facebff80 Rover: Add EKF3 and remove EKF1 2016-12-19 08:07:10 +11:00
Pierre Kancir dec954bb0c Rover: added crash check 2016-12-07 12:46:02 +11:00
Randy Mackay 55f316034c Rover: include AP_Beacon 2016-11-30 17:57:04 +09:00
Peter Barker dab0d8e6e2 Rover: inform dataflash of vehicle arm state 2016-11-28 09:42:09 -08:00
Grant Morphett 515ceb3ccd Rover: Added logging of the guided commands 2016-11-28 12:00:03 +11:00
Pierre Kancir 8c0de11d6d APMrover2: remove double include stdarg.h 2016-11-23 18:47:34 +00:00
Grant Morphett 5b411aef65 Rover: Fixed LOITER_UNLIM to be an active loiter
This changes brings the LOITER commands in line so both LOITER_UNLIM
and LOITER_TIME are actively loitering.
2016-11-13 08:26:33 +11:00
Grant Morphett 86d4fcfb32 Rover: Station Keeping is implemented via NAV_LOITER_COMMAND
It is a very simply form of station keeping.  If a boat is
loitering on a waypoint and it gets blown off a distance
past the WAYPOINT_RADIUS it will automaticlly drive back to
the waypoint.
2016-10-30 22:50:03 +11:00
Peter Barker 36c0bacada Rover: support for AP_Stats (flight time, bootcount, runtime) 2016-10-29 14:53:25 +09:00
Peter Barker cfee3b6c0e Rover: add support for ParametersG2 2016-10-29 14:53:25 +09:00
floaledm 629af84ca1 Rover: update sensor status error flags independently of sending a sys_status message 2016-10-28 15:11:44 +11:00
Grant Morphett 2d09db4ecb Rover: added a new form of GUIDED mode
Rover now accepts a new message MAV_CMD_NAV_SET_YAW_SPEED
which has an angle in centidegrees and a speed scale and the rover
will drive based on these inputs.
2016-10-25 08:04:01 +11:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Andrew Tridgell 08b0ba99db Rover: fixes for AP_FrSky_Telem API change 2016-08-25 10:16:19 +10:00
floaledm b5f75459f2 Rover: compatibility with revised AP_Frsky_Telem class 2016-08-25 10:16:18 +10:00
floaledm 4030851207 Rover: removed frsky_telemetry_send scheduled task 2016-08-25 10:16:17 +10:00
Andrew Tridgell a4270b1bb6 APMrover2: adjust for 16 channels in SERVO_OUTPUT_RAW 2016-07-25 10:06:02 +10:00
Andrew Tridgell fd0f31dc44 Rover: added AP_Button support 2016-07-22 15:01:21 +10:00
Grant Morphett 57c23c7fe3 Rover: Adding support for rovers driving in Reverse. 2016-07-17 08:15:34 +10:00
Grant Morphett d1799884b2 Rover: Implemented MAV_CMD_NAV_LOITER_UNLIM 2016-07-14 11:34:22 +10:00
Peter Barker a1c97f4585 Rover: subclass GCS_MAVLink in place of defining its functions for it 2016-05-29 16:21:21 +10:00
Andrew Tridgell f61ba903dd Rover: don't stall EKF during baro cal 2016-05-24 17:00:55 +10:00
Lucas De Marchi d3ee998fa6 APMrover2: use separate header for version macro
Having the version macro in the config.h and consequently in the main
vehicle header means that whenever the version changes we need to
compiler the whole vehicle again. This would not be so bad if we weren't
also appending the git hash in the version. In this case, whenever we
commit to the repository we would need to recompile everything.

Move to a separate header that is include only by its users. Then
instead of compiling everything we will compile just a few files.
2016-05-06 13:11:28 -03:00
Ricardo de Almeida Gonzaga 5bd034a5a8 Global: start using cmath instead of math.h 2016-04-05 21:06:19 -07:00
Grant Morphett 2c4aaf7cb3 Rover: Commit for Rover release 3.0.0 2016-04-05 15:45:18 +10:00
Lucas De Marchi dd8014dd2f APMrover2: replace header guard with pragma once 2016-03-16 18:40:44 +11:00
Michael du Breuil b6378e2827 Rover: Use arming voltage 2016-03-14 09:07:34 -07:00
Tom Pittenger 0372b52378 Rover: convert to using static send_statustext
- no more MSG_STATUSTEXT
- TODO: replace calls to gcs_send_text and gcs_send_text_fmt to GCS_MAVLINK::send_statustext()
2016-02-24 09:18:05 +11:00
Dario Lindo Andres f731a0dc53 APMrover2: Added precise camera trigger logging
included update_trigger function
added camera trigger precise time mark
detect camera feedback pin status
added support for TRIGGER MSG
corrected according to defines.h
2016-01-29 09:19:43 +11:00
Siddharth Bharat Purohit 53d3e7dc61 Rover: wire up accel calibrator for Rover 2015-12-29 10:46:35 -08:00
Andrew Tridgell 7daab1ee62 Rover: convert to Hz based task table 2015-12-27 14:57:24 +09:00
Andrew Tridgell c94b30b7bc Rover: fixed flymaple build 2015-12-22 11:35:31 +11:00
Julien BERAUD c28a71ec63 Rover: Update Optical Flow declaration
Pass ahrs as param
2015-12-18 17:56:06 +11:00
Lucas De Marchi 767f126eaa APMrover2: remove unused AP_ADC_AnalogSource 2015-12-03 13:32:44 +11:00
Peter Barker 5d46a9add0 Rover: support multiple simultaneous backends 2015-12-03 13:21:51 +11:00
Caio Marcelo de Oliveira Filho ee073787c8 Rover: use millis/micros/panic functions
Instead of going through 'hal' then 'scheduler', use directly the AP_HAL
functions. Besides removing indirection that is not necessary for such
functions, this patch ends up reducing the code size in the call sites.

For example, building ArduCopter for PX4 with this change (compared to
before introduction of the functions) yields almost 3k bytes of code
size.

    # ArduCopter build before the functions (1b29a1af46)
       text	   data	    bss	    dec	    hex	filename
     895264	   2812	  62732	 960808	  ea928	/.../px4fmu-v2_APM.build/firmware.elf

    # ArduCopter build after this patch
       text	   data	    bss	    dec	    hex	filename
     892264	   2812	  62732	 957808	  e9d70	/.../px4fmu-v2_APM.build/firmware.elf

A later patch will remove the unused functions in the Schedulers.
2015-11-20 12:26:14 +09:00
Grant Morphett bbbbd07935 Rover: GPS fix to ensure we only look at new GPS messages 2015-11-11 13:39:39 +11:00
Grant Morphett e81973cd29 Rover: motor_active method similar to the plane is_flying but simpler 2015-11-11 13:39:39 +11:00
Grant Morphett 3636b53313 Rover: Implementation of the ARMING functionality 2015-11-11 13:39:38 +11:00
Grant Morphett 2d1745ab6a Rover: Implemented the HOME state update from Plane 2015-11-11 13:39:38 +11:00
lvale a64689600f Rover: text message severity uniformization
Global revision of message severity values.

Required also change to the low priority function gcs_send_text_fmt()
on GCS_Mavlink.cpp to disable the automatic setting of priority on
messages sent by this function
2015-11-05 12:33:56 +09:00
Lucas De Marchi 5244559010 Minimize AP_Progmem.h includes
Most of AP_Progmem is already gone so we can stop including it in most
of the places. The only places that need it are the ones using
pgm_read_*() APIs.

In some cases the header needed to be added in the .cpp since it was
removed from the .h to reduce scope. In those cases the headers were
also reordered.
2015-10-30 14:35:32 +09:00
Lucas De Marchi 1b07dabeb7 Replace prog_char and prog_char_t with char
prog_char and prog_char_t are now the same as char on supported
platforms. So, just change all places that use them and prefer char
instead.

AVR-specific places were not changed.
2015-10-30 14:35:30 +09:00