2013-10-13 04:14:13 -03:00
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
2015-06-01 02:04:25 -03:00
# include "Tracker.h"
2013-10-13 04:14:13 -03:00
/*
* AntennaTracker parameter definitions
*
*/
2015-06-01 02:04:25 -03:00
# define GSCALAR(v, name, def) { tracker.g.v.vtype, name, Parameters::k_param_ ## v, &tracker.g.v, {def_value : def} }
# define ASCALAR(v, name, def) { tracker.aparm.v.vtype, name, Parameters::k_param_ ## v, (const void *)&tracker.aparm.v, {def_value : def} }
# define GGROUP(v, name, class) { AP_PARAM_GROUP, name, Parameters::k_param_ ## v, &tracker.g.v, {group_info : class::var_info} }
# define GOBJECT(v, name, class) { AP_PARAM_GROUP, name, Parameters::k_param_ ## v, (const void *)&tracker.v, {group_info : class::var_info} }
# define GOBJECTN(v, pname, name, class) { AP_PARAM_GROUP, name, Parameters::k_param_ ## pname, (const void *)&tracker.v, {group_info : class::var_info} }
2013-10-13 04:14:13 -03:00
2015-06-01 02:04:25 -03:00
const AP_Param : : Info Tracker : : var_info [ ] PROGMEM = {
2013-10-13 04:14:13 -03:00
GSCALAR ( format_version , " FORMAT_VERSION " , 0 ) ,
GSCALAR ( software_type , " SYSID_SW_TYPE " , Parameters : : k_software_type ) ,
// @Param: SYSID_THISMAV
2015-05-10 21:22:01 -03:00
// @DisplayName: MAVLink system ID of this vehicle
// @Description: Allows setting an individual system id for this vehicle to distinguish it from others on the same network
2013-10-13 04:14:13 -03:00
// @Range: 1 255
// @User: Advanced
GSCALAR ( sysid_this_mav , " SYSID_THISMAV " , MAV_SYSTEM_ID ) ,
// @Param: SYSID_MYGCS
// @DisplayName: Ground station MAVLink system ID
// @Description: The identifier of the ground station in the MAVLink protocol. Don't change this unless you also modify the ground station to match.
// @Range: 1 255
// @User: Advanced
GSCALAR ( sysid_my_gcs , " SYSID_MYGCS " , 255 ) ,
2015-04-27 04:44:32 -03:00
// @Param: SYSID_TARGET
// @DisplayName: Target vehicle's MAVLink system ID
// @Description: The identifier of the vehicle being tracked. This should be zero (to auto detect) or be the same as the SYSID_THISMAV parameter of the vehicle being tracked.
// @Range: 1 255
// @User: Advanced
GSCALAR ( sysid_target , " SYSID_TARGET " , 0 ) ,
2013-10-13 04:14:13 -03:00
// @Param: MAG_ENABLE
// @DisplayName: Enable Compass
// @Description: Setting this to Enabled(1) will enable the compass. Setting this to Disabled(0) will disable the compass. Note that this is separate from COMPASS_USE. This will enable the low level senor, and will enable logging of magnetometer data. To use the compass for navigation you must also set COMPASS_USE to 1.
// @Values: 0:Disabled,1:Enabled
// @User: Standard
GSCALAR ( compass_enabled , " MAG_ENABLE " , 1 ) ,
2014-03-22 05:08:00 -03:00
// @Param: YAW_SLEW_TIME
// @DisplayName: Time for yaw to slew through its full range
// @Description: This controls how rapidly the tracker will change the servo output for yaw. It is set as the number of seconds to do a full rotation. You can use this parameter to slow the trackers movements, which may help with some types of trackers. A value of zero will allow for unlimited servo movement per update.
// @Units: seconds
// @Increment: 0.1
// @Range: 0 20
2014-08-14 17:19:55 -03:00
// @User: Standard
2014-03-22 05:08:00 -03:00
GSCALAR ( yaw_slew_time , " YAW_SLEW_TIME " , 2 ) ,
// @Param: PITCH_SLEW_TIME
// @DisplayName: Time for pitch to slew through its full range
// @Description: This controls how rapidly the tracker will change the servo output for pitch. It is set as the number of seconds to do a full range of pitch movement. You can use this parameter to slow the trackers movements, which may help with some types of trackers. A value of zero will allow for unlimited servo movement per update.
// @Units: seconds
// @Increment: 0.1
// @Range: 0 20
2014-08-14 17:19:55 -03:00
// @User: Standard
2014-03-22 05:08:00 -03:00
GSCALAR ( pitch_slew_time , " PITCH_SLEW_TIME " , 2 ) ,
2014-04-09 02:27:56 -03:00
// @Param: SCAN_SPEED
// @DisplayName: Speed at which to rotate in scan mode
// @Description: This controls how rapidly the tracker will move the servos in SCAN mode
// @Units: degrees/second
// @Increment: 1
// @Range: 0 100
2014-08-14 17:19:55 -03:00
// @User: Standard
2014-04-09 02:27:56 -03:00
GSCALAR ( scan_speed , " SCAN_SPEED " , 5 ) ,
2014-03-22 05:08:00 -03:00
// @Param: MIN_REVERSE_TIME
// @DisplayName: Minimum time to apply a yaw reversal
// @Description: When the tracker detects it has reached the limit of servo movement in yaw it will reverse and try moving to the other extreme of yaw. This parameter controls the minimum time it should reverse for. It is used to cope with trackers that have a significant lag in movement to ensure they do move all the way around.
// @Units: seconds
// @Increment: 1
// @Range: 0 20
2014-08-14 17:19:55 -03:00
// @User: Standard
2014-03-22 05:08:00 -03:00
GSCALAR ( min_reverse_time , " MIN_REVERSE_TIME " , 1 ) ,
// @Param: START_LATITUDE
// @DisplayName: Initial Latitude before GPS lock
// @Description: Combined with START_LONGITUDE this parameter allows for an initial position of the tracker to be set. This position will be used until the GPS gets lock. It can also be used to run a stationary tracker with no GPS attached.
// @Units: degrees
// @Increment: 0.000001
// @Range: -90 90
2014-08-14 17:19:55 -03:00
// @User: Standard
2014-03-22 05:08:00 -03:00
GSCALAR ( start_latitude , " START_LATITUDE " , 0 ) ,
// @Param: START_LONGITUDE
// @DisplayName: Initial Longitude before GPS lock
// @Description: Combined with START_LATITUDE this parameter allows for an initial position of the tracker to be set. This position will be used until the GPS gets lock. It can also be used to run a stationary tracker with no GPS attached.
// @Units: degrees
// @Increment: 0.000001
// @Range: -180 180
2014-08-14 17:19:55 -03:00
// @User: Standard
2014-03-22 05:08:00 -03:00
GSCALAR ( start_longitude , " START_LONGITUDE " , 0 ) ,
// @Param: STARTUP_DELAY
// @DisplayName: Delay before first servo movement from trim
// @Description: This parameter can be used to force the servos to their trim value for a time on startup. This can help with some servo types
// @Units: seconds
// @Increment: 0.1
// @Range: 0 10
2014-08-14 17:19:55 -03:00
// @User: Standard
2014-03-22 05:08:00 -03:00
GSCALAR ( startup_delay , " STARTUP_DELAY " , 0 ) ,
2014-07-23 05:41:25 -03:00
// @Param: SERVO_TYPE
// @DisplayName: Type of servo system being used
// @Description: This allows selection of position servos or on/off servos
2015-06-03 11:05:58 -03:00
// @Values: 0:Position,1:OnOff,2:ContinuousRotation
2014-08-14 17:19:55 -03:00
// @User: Standard
2014-07-23 05:41:25 -03:00
GSCALAR ( servo_type , " SERVO_TYPE " , SERVO_TYPE_POSITION ) ,
// @Param: ONOFF_YAW_RATE
// @DisplayName: Yaw rate for on/off servos
// @Description: Rate of change of yaw in degrees/second for on/off servos
// @Units: degrees/second
// @Increment: 0.1
// @Range: 0 50
2014-08-14 17:19:55 -03:00
// @User: Standard
2014-07-23 05:41:25 -03:00
GSCALAR ( onoff_yaw_rate , " ONOFF_YAW_RATE " , 9.0f ) ,
// @Param: ONOFF_PITCH_RATE
// @DisplayName: Pitch rate for on/off servos
// @Description: Rate of change of pitch in degrees/second for on/off servos
// @Units: degrees/second
// @Increment: 0.1
// @Range: 0 50
2014-08-14 17:19:55 -03:00
// @User: Standard
2014-07-23 05:41:25 -03:00
GSCALAR ( onoff_pitch_rate , " ONOFF_PITCH_RATE " , 1.0f ) ,
// @Param: ONOFF_YAW_MINT
// @DisplayName: Yaw minimum movement time
// @Description: Minimum amount of time in seconds to move in yaw
// @Units: seconds
// @Increment: 0.01
// @Range: 0 2
2014-08-14 17:19:55 -03:00
// @User: Standard
2014-07-23 05:41:25 -03:00
GSCALAR ( onoff_yaw_mintime , " ONOFF_YAW_MINT " , 0.1f ) ,
// @Param: ONOFF_PITCH_MINT
// @DisplayName: Pitch minimum movement time
// @Description: Minimim amount of time in seconds to move in pitch
// @Units: seconds
// @Increment: 0.01
// @Range: 0 2
2014-08-14 17:19:55 -03:00
// @User: Standard
2014-07-23 05:41:25 -03:00
GSCALAR ( onoff_pitch_mintime , " ONOFF_PITCH_MINT " , 0.1f ) ,
2014-08-03 05:16:37 -03:00
// @Param: YAW_TRIM
// @DisplayName: Yaw trim
// @Description: Amount of extra yaw to add when tracking. This allows for small adjustments for an out of trim compass.
// @Units: degrees
// @Increment: 0.1
// @Range: -10 10
2014-08-14 17:19:55 -03:00
// @User: Standard
2014-08-03 05:16:37 -03:00
GSCALAR ( yaw_trim , " YAW_TRIM " , 0 ) ,
// @Param: PITCH_TRIM
// @DisplayName: Pitch trim
// @Description: Amount of extra pitch to add when tracking. This allows for small adjustments for a badly calibrated barometer.
// @Units: degrees
// @Increment: 0.1
// @Range: -10 10
2014-08-14 17:19:55 -03:00
// @User: Standard
2014-08-03 05:16:37 -03:00
GSCALAR ( pitch_trim , " PITCH_TRIM " , 0 ) ,
2014-10-06 02:51:53 -03:00
// @Param: YAW_RANGE
// @DisplayName: Yaw Angle Range
// @Description: Yaw axis total range of motion in degrees
// @Units: degrees
// @Increment: 0.1
// @Range: 0 360
// @User: Standard
GSCALAR ( yaw_range , " YAW_RANGE " , YAW_RANGE_DEFAULT ) ,
// @Param: PITCH_RANGE
// @DisplayName: Pitch Range
// @Description: Pitch axis total range of motion in degrees
// @Units: degrees
// @Increment: 0.1
// @Range: 0 180
// @User: Standard
GSCALAR ( pitch_range , " PITCH_RANGE " , PITCH_RANGE_DEFAULT ) ,
2015-04-26 23:24:47 -03:00
// @Param: DISTANCE_MIN
// @DisplayName: Distance minimum to target
// @Description: Tracker will track targets at least this distance away
// @Units: meters
// @Increment: 1
// @Range: 0 100
// @User: Standard
GSCALAR ( distance_min , " DISTANCE_MIN " , DISTANCE_MIN_DEFAULT ) ,
2013-10-13 04:14:13 -03:00
// barometer ground calibration. The GND_ prefix is chosen for
// compatibility with previous releases of ArduPlane
// @Group: GND_
// @Path: ../libraries/AP_Baro/AP_Baro.cpp
GOBJECT ( barometer , " GND_ " , AP_Baro ) ,
// @Group: COMPASS_
// @Path: ../libraries/AP_Compass/Compass.cpp
GOBJECT ( compass , " COMPASS_ " , Compass ) ,
// @Group: SCHED_
// @Path: ../libraries/AP_Scheduler/AP_Scheduler.cpp
GOBJECT ( scheduler , " SCHED_ " , AP_Scheduler ) ,
// @Group: SR0_
2015-06-15 20:59:27 -03:00
// @Path: GCS_Mavlink.cpp
2014-03-05 02:38:22 -04:00
GOBJECTN ( gcs [ 0 ] , gcs0 , " SR0_ " , GCS_MAVLINK ) ,
// @Group: SR1_
2015-06-15 20:59:27 -03:00
// @Path: GCS_Mavlink.cpp
2014-03-05 02:38:22 -04:00
GOBJECTN ( gcs [ 1 ] , gcs1 , " SR1_ " , GCS_MAVLINK ) ,
2013-10-13 04:14:13 -03:00
2014-03-05 02:38:22 -04:00
# if MAVLINK_COMM_NUM_BUFFERS > 2
// @Group: SR2_
2015-06-15 20:59:27 -03:00
// @Path: GCS_Mavlink.cpp
2014-03-05 02:38:22 -04:00
GOBJECTN ( gcs [ 2 ] , gcs2 , " SR2_ " , GCS_MAVLINK ) ,
# endif
2013-10-13 04:14:13 -03:00
2015-05-02 09:38:58 -03:00
# if MAVLINK_COMM_NUM_BUFFERS > 3
// @Group: SR3_
2015-06-15 20:59:27 -03:00
// @Path: GCS_Mavlink.cpp
2015-05-02 09:38:58 -03:00
GOBJECTN ( gcs [ 3 ] , gcs3 , " SR3_ " , GCS_MAVLINK ) ,
# endif
2013-10-13 04:14:13 -03:00
// @Group: INS_
// @Path: ../libraries/AP_InertialSensor/AP_InertialSensor.cpp
GOBJECT ( ins , " INS_ " , AP_InertialSensor ) ,
// @Group: AHRS_
// @Path: ../libraries/AP_AHRS/AP_AHRS.cpp
GOBJECT ( ahrs , " AHRS_ " , AP_AHRS ) ,
2015-05-04 03:18:37 -03:00
# if CONFIG_HAL_BOARD == HAL_BOARD_SITL
2013-10-13 04:14:13 -03:00
// @Group: SIM_
// @Path: ../libraries/SITL/SITL.cpp
GOBJECT ( sitl , " SIM_ " , SITL ) ,
# endif
2014-03-26 18:06:50 -03:00
// @Group: BRD_
// @Path: ../libraries/AP_BoardConfig/AP_BoardConfig.cpp
GOBJECT ( BoardConfig , " BRD_ " , AP_BoardConfig ) ,
2014-03-31 16:18:07 -03:00
// GPS driver
// @Group: GPS_
// @Path: ../libraries/AP_GPS/AP_GPS.cpp
GOBJECT ( gps , " GPS_ " , AP_GPS ) ,
2013-10-13 04:14:13 -03:00
// RC channel
//-----------
// @Group: RC1_
// @Path: ../libraries/RC_Channel/RC_Channel.cpp
GOBJECT ( channel_yaw , " RC1_ " , RC_Channel ) ,
// @Group: RC2_
// @Path: ../libraries/RC_Channel/RC_Channel.cpp
GOBJECT ( channel_pitch , " RC2_ " , RC_Channel ) ,
2015-01-28 01:27:03 -04:00
// @Group: SERIAL
// @Path: ../libraries/AP_SerialManager/AP_SerialManager.cpp
GOBJECT ( serial_manager , " SERIAL " , AP_SerialManager ) ,
2013-10-13 04:14:13 -03:00
GGROUP ( pidPitch2Srv , " PITCH2SRV_ " , PID ) ,
GGROUP ( pidYaw2Srv , " YAW2SRV_ " , PID ) ,
2014-03-02 03:00:37 -04:00
// @Param: CMD_TOTAL
// @DisplayName: Number of loaded mission items
// @Description: Set to 1 if HOME location has been loaded by the ground station. Do not change this manually.
// @Range: 1 255
// @User: Advanced
GSCALAR ( command_total , " CMD_TOTAL " , 0 ) ,
2013-10-13 04:14:13 -03:00
AP_VAREND
} ;
2015-06-01 02:04:25 -03:00
void Tracker : : load_parameters ( void )
2013-10-13 04:14:13 -03:00
{
if ( ! g . format_version . load ( ) | |
g . format_version ! = Parameters : : k_format_version ) {
// erase all parameters
2015-06-01 02:04:25 -03:00
hal . console - > printf_P ( PSTR ( " Firmware change: erasing EEPROM... \n " ) ) ;
2013-10-13 04:14:13 -03:00
AP_Param : : erase_all ( ) ;
// save the current format version
g . format_version . set_and_save ( Parameters : : k_format_version ) ;
2015-06-01 02:04:25 -03:00
hal . console - > println_P ( PSTR ( " done. " ) ) ;
2013-10-13 04:14:13 -03:00
} else {
uint32_t before = hal . scheduler - > micros ( ) ;
// Load all auto-loaded EEPROM variables
AP_Param : : load_all ( ) ;
2015-06-01 02:04:25 -03:00
hal . console - > printf_P ( PSTR ( " load_all took %luus \n " ) , ( unsigned long ) ( hal . scheduler - > micros ( ) - before ) ) ;
2013-10-13 04:14:13 -03:00
}
}