Skip to content

Commit 865ab6f

Browse files
camera_def: add parameter ranges (#553)
* camera_def: add parameter ranges This is just reflecting what's implemented in QGC and MAVSDK. Also see: - https://github.com/mavlink/MAVSDK/blob/v2.12/src/mavsdk/plugins/camera/camera_definition.cpp#L368-L413 - https://github.com/mavlink/qgroundcontrol/blob/be1e2d46c95812d3ad700bdc4807eca95829be6b/src/Camera/VehicleCameraControl.cc#L968-L1014 * Apply suggestions from code review * Show equivalence and state restrictions --------- Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
1 parent e190a68 commit 865ab6f

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

en/services/camera_def.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ There are cases where an option change requires a parameter to be updated. For e
195195

196196
This tells the GCS that when the `CAM_EXPMODE` parameter changes, the `CAM_APERTURE`, `CAM_SHUTTERSPD` and the `CAM_ISO` parameters must be updated (requested from the camera).
197197

198-
#### Range Limit
198+
#### Option Range Limit
199199

200200
Suppose your camera has the following ISO options:
201201

@@ -248,6 +248,34 @@ This indicates to the GCS that when the `CAM_MODE` parameter is set to _Video_,
248248

249249
This example also tells the GCS not to display this parameter to the user (`control=“0”`). Camera Mode is a standard parameter defined in the [CAMERA_INFORMATION](../messages/common.md#CAMERA_INFORMATION) message and it’s handled by the GCS in that way. The parameter definition above was created in order to tell the GCS the rules that are applied when changes to the camera mode occur.
250250

251+
#### Param Ranges
252+
253+
It is also possible to define param ranges without individual options, but by specifiying the minimum, maximum, and optionally a step size:
254+
255+
```xml
256+
<parameter name="CAM_APERTURE" type="float" default="2.8" min="2.8" max="14.0" step="0.1">
257+
<description>Aperture</description>
258+
</parameter>
259+
```
260+
261+
This would be equivalent to:
262+
263+
```xml
264+
<parameter name="CAM_APERTURE" type="float" default="2.8">
265+
<description>Aperture</description>
266+
<options>
267+
<roption name="2.8" value="2.8" />
268+
<roption name="2.9" value="2.9" />
269+
...
270+
<roption name="13.9" value="13.9" />
271+
<roption name="14" value="14" />
272+
</options>
273+
</parameter>
274+
```
275+
276+
Note that this approach cannot be used in conjunction with exclusions or option range limits (defined with `parameterrange`).
277+
Therefore it is recommended for cases where the range of allowed values does not vary with any other camera mode or setting.
278+
251279
### Localization
252280

253281
The `localization` element is used for defining localized strings for display to users. If found, the GCS will use to replace all `description` and options `name` values found in the file with the strings defined here. Here is an example for German localization (de_DE):

0 commit comments

Comments
 (0)