AP_RangeFinder_Params.cpp 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #include "AP_RangeFinder_Params.h"
  2. #include "AP_RangeFinder.h"
  3. // table of user settable parameters
  4. const AP_Param::GroupInfo AP_RangeFinder_Params::var_info[] = {
  5. // @Param: TYPE
  6. // @DisplayName: Rangefinder type
  7. // @Description: What type of rangefinder device that is connected
  8. // @Values: 0:None,1:Analog,2:MaxbotixI2C,3:LidarLiteV2-I2C,5:PWM,6:BBB-PRU,7:LightWareI2C,8:LightWareSerial,9:Bebop,10:MAVLink,11:uLanding,12:LeddarOne,13:MaxbotixSerial,14:TeraRangerI2C,15:LidarLiteV3-I2C,16:VL53L0X,17:NMEA,18:WASP-LRF,19:BenewakeTF02,20:BenewakeTFmini,21:LidarLightV3HP,22:PWM,23:BlueRoboticsPing,24:UAVCAN,25:BenewakeTFMiniPlus
  9. // @User: Standard
  10. AP_GROUPINFO("TYPE", 1, AP_RangeFinder_Params, type, 0),
  11. // @Param: PIN
  12. // @DisplayName: Rangefinder pin
  13. // @Description: Analog pin that rangefinder is connected to. Set to 11 on PX4 for the analog 'airspeed' port. Set to 15 on the Pixhawk for the analog 'airspeed' port.
  14. // @Values: -1:Not Used, 11:PX4-airspeed port, 15:Pixhawk-airspeed port
  15. // @User: Standard
  16. AP_GROUPINFO("PIN", 2, AP_RangeFinder_Params, pin, -1),
  17. // @Param: SCALING
  18. // @DisplayName: Rangefinder scaling
  19. // @Description: Scaling factor between rangefinder reading and distance. For the linear and inverted functions this is in meters per volt. For the hyperbolic function the units are meterVolts.
  20. // @Units: m/V
  21. // @Increment: 0.001
  22. // @User: Standard
  23. AP_GROUPINFO("SCALING", 3, AP_RangeFinder_Params, scaling, 3.0f),
  24. // @Param: OFFSET
  25. // @DisplayName: rangefinder offset
  26. // @Description: Offset in volts for zero distance for analog rangefinders. Offset added to distance in centimeters for PWM and I2C Lidars
  27. // @Units: V
  28. // @Increment: 0.001
  29. // @User: Standard
  30. AP_GROUPINFO("OFFSET", 4, AP_RangeFinder_Params, offset, 0.0f),
  31. // @Param: FUNCTION
  32. // @DisplayName: Rangefinder function
  33. // @Description: Control over what function is used to calculate distance. For a linear function, the distance is (voltage-offset)*scaling. For a inverted function the distance is (offset-voltage)*scaling. For a hyperbolic function the distance is scaling/(voltage-offset). The functions return the distance in meters.
  34. // @Values: 0:Linear,1:Inverted,2:Hyperbolic
  35. // @User: Standard
  36. AP_GROUPINFO("FUNCTION", 5, AP_RangeFinder_Params, function, 0),
  37. // @Param: MIN_CM
  38. // @DisplayName: Rangefinder minimum distance
  39. // @Description: Minimum distance in centimeters that rangefinder can reliably read
  40. // @Units: cm
  41. // @Increment: 1
  42. // @User: Standard
  43. AP_GROUPINFO("MIN_CM", 6, AP_RangeFinder_Params, min_distance_cm, 20),
  44. // @Param: MAX_CM
  45. // @DisplayName: Rangefinder maximum distance
  46. // @Description: Maximum distance in centimeters that rangefinder can reliably read
  47. // @Units: cm
  48. // @Increment: 1
  49. // @User: Standard
  50. AP_GROUPINFO("MAX_CM", 7, AP_RangeFinder_Params, max_distance_cm, 700),
  51. // @Param: STOP_PIN
  52. // @DisplayName: Rangefinder stop pin
  53. // @Description: Digital pin that enables/disables rangefinder measurement for the pwm rangefinder. A value of -1 means no pin. If this is set, then the pin is set to 1 to enable the rangefinder and set to 0 to disable it. This is used to enable powersaving when out of range.
  54. // @Values: -1:Not Used,50:Pixhawk AUXOUT1,51:Pixhawk AUXOUT2,52:Pixhawk AUXOUT3,53:Pixhawk AUXOUT4,54:Pixhawk AUXOUT5,55:Pixhawk AUXOUT6,111:PX4 FMU Relay1,112:PX4 FMU Relay2,113:PX4IO Relay1,114:PX4IO Relay2,115:PX4IO ACC1,116:PX4IO ACC2
  55. // @User: Standard
  56. AP_GROUPINFO("STOP_PIN", 8, AP_RangeFinder_Params, stop_pin, -1),
  57. // 9 was SETTLE
  58. // @Param: RMETRIC
  59. // @DisplayName: Ratiometric
  60. // @Description: This parameter sets whether an analog rangefinder is ratiometric. Most analog rangefinders are ratiometric, meaning that their output voltage is influenced by the supply voltage. Some analog rangefinders (such as the SF/02) have their own internal voltage regulators so they are not ratiometric.
  61. // @Values: 0:No,1:Yes
  62. // @User: Standard
  63. AP_GROUPINFO("RMETRIC", 10, AP_RangeFinder_Params, ratiometric, 1),
  64. // @Param: PWRRNG
  65. // @DisplayName: Powersave range
  66. // @Description: This parameter sets the estimated terrain distance in meters above which the sensor will be put into a power saving mode (if available). A value of zero means power saving is not enabled
  67. // @Units: m
  68. // @Range: 0 32767
  69. // @User: Standard
  70. AP_GROUPINFO("PWRRNG", 11, AP_RangeFinder_Params, powersave_range, 0),
  71. // @Param: GNDCLEAR
  72. // @DisplayName: Distance (in cm) from the range finder to the ground
  73. // @Description: This parameter sets the expected range measurement(in cm) that the range finder should return when the vehicle is on the ground.
  74. // @Units: cm
  75. // @Range: 5 127
  76. // @Increment: 1
  77. // @User: Standard
  78. AP_GROUPINFO("GNDCLEAR", 12, AP_RangeFinder_Params, ground_clearance_cm, RANGEFINDER_GROUND_CLEARANCE_CM_DEFAULT),
  79. // @Param: ADDR
  80. // @DisplayName: Bus address of sensor
  81. // @Description: This sets the bus address of the sensor, where applicable. Used for the I2C and UAVCAN sensors to allow for multiple sensors on different addresses. A value of 0 disables the sensor.
  82. // @Range: 0 127
  83. // @Increment: 1
  84. // @User: Standard
  85. AP_GROUPINFO("ADDR", 23, AP_RangeFinder_Params, address, 0),
  86. // @Param: POS_X
  87. // @DisplayName: X position offset
  88. // @Description: X position of the first rangefinder in body frame. Positive X is forward of the origin. Use the zero range datum point if supplied.
  89. // @Units: m
  90. // @User: Advanced
  91. // @Param: POS_Y
  92. // @DisplayName: Y position offset
  93. // @Description: Y position of the first rangefinder in body frame. Positive Y is to the right of the origin. Use the zero range datum point if supplied.
  94. // @Units: m
  95. // @User: Advanced
  96. // @Param: POS_Z
  97. // @DisplayName: Z position offset
  98. // @Description: Z position of the first rangefinder in body frame. Positive Z is down from the origin. Use the zero range datum point if supplied.
  99. // @Units: m
  100. // @User: Advanced
  101. AP_GROUPINFO("POS", 49, AP_RangeFinder_Params, pos_offset, 0.0f),
  102. // @Param: ORIENT
  103. // @DisplayName: Rangefinder orientation
  104. // @Description: Orientation of rangefinder
  105. // @Values: 0:Forward, 1:Forward-Right, 2:Right, 3:Back-Right, 4:Back, 5:Back-Left, 6:Left, 7:Forward-Left, 24:Up, 25:Down
  106. // @User: Advanced
  107. AP_GROUPINFO("ORIENT", 53, AP_RangeFinder_Params, orientation, ROTATION_PITCH_270),
  108. AP_GROUPEND
  109. };
  110. AP_RangeFinder_Params::AP_RangeFinder_Params(void) {
  111. AP_Param::setup_object_defaults(this, var_info);
  112. }