New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Camera Definition #747
Camera Definition #747
Conversation
…raDefintion * 'master' of https://github.com/mavlink/mavlink: Support trigger before/after distance trigger start/stop
message_definitions/v1.0/common.xml
Outdated
@@ -3158,6 +3175,7 @@ | |||
<field type="uint8_t" name="result" enum="MAV_RESULT">See MAV_RESULT enum</field> | |||
<extensions/> | |||
<field type="uint8_t" name="progress">WIP: Needs to be set when MAV_RESULT is MAV_RESULT_IN_PROGRESS, values from 0 to 100 for progress percentage, 255 for unknown progress.</field> | |||
<field type="uint8_t" name="device_id">WIP: Used to identify targeted device when multiple devices use same component ID (i.e. Camera, Storage, etc.)</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hang on. What is this? There is already system ID and component ID, and there are internal camera IDs. And you also want to add a device ID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take for example this message:
MAV_CMD_REQUEST_CAMERA_INFORMATION
Param #1 | Camera ID (0 for all cameras, 1 for first, 2 for second, etc.)
I need to know what Camera ID
this response is for. On a parallel system, sending messages from arbitrary camera controllers, the system needs to know to which (camera) controller to route the message to. In this case, both System ID and Component ID are the same. Only the Camera ID changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this change require existing users of COMMAND_ACK to make corresponding changes in their code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be the same changes that occurred when the progress
field was added. If you don't use the new field, existing code would simply ignore it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a parallel system
For the sake of simplicity, I would not try to parallelize the case of two camera as one mavlink node (with system and component ID). I think this will be confusing for most developers implementing mavlink commands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem I'm trying to solve is to determine which camera is responding to a command when both system and component IDs are the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it based on the fact we decided to remove Camera ID from all camera messages. Separate cameras are to be identified using different Component ID instead.
message_definitions/v1.0/common.xml
Outdated
@@ -4078,33 +4096,36 @@ | |||
<field type="uint8_t" name="camera_count">Number of cameras</field> | |||
<field type="uint8_t[32]" name="vendor_name">Name of the camera vendor</field> | |||
<field type="uint8_t[32]" name="model_name">Name of the camera model</field> | |||
<field type="uint32_t" name="firmware_version">Version of the camera firmware</field> | |||
<field type="uint32_t" name="firmware_version">Version of the camera firmware (v << 24 & 0xff = Dev, v << 16 & 0xff = Patch, v << 8 & 0xff = Minor, v & 0xff = Major)</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if these & will get htmlized anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one way to find out :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good luck :).
<field type="float" name="focal_length" units="mm">Focal length in mm</field> | ||
<field type="float" name="sensor_size_h" units="mm">Image sensor size horizontal in mm</field> | ||
<field type="float" name="sensor_size_v" units="mm">Image sensor size vertical in mm</field> | ||
<field type="uint16_t" name="resolution_h" units="pix">Image resolution in pixels horizontal</field> | ||
<field type="uint16_t" name="resolution_v" units="pix">Image resolution in pixels vertical</field> | ||
<field type="uint8_t" name="lens_id">Reserved for a lens ID</field> | ||
<field type="uint32_t" name="flags" enum="CAMERA_CAP_FLAGS">CAMERA_CAP_FLAGS enum flags (bitmap) describing camera capabilities.</field> | ||
<field type="uint16_t" name="cam_definition_version">Camera definition version (iteration)</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the schema/protocol version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the content version. It will tell if some parameter or option (or rule, localization, etc.) changed. The GCS would have cached the file and there is no reason to fetch it again if it's the same version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I thought the version would be included in the file string. I guess this allows to have one http URI, and then a version number on top.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We decided to use XML instead. Json simply isn't conducive for this. As such, the schema is defined in the file header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
<field type="float" name="focal_length" units="mm">Focal length in mm</field> | ||
<field type="float" name="sensor_size_h" units="mm">Image sensor size horizontal in mm</field> | ||
<field type="float" name="sensor_size_v" units="mm">Image sensor size vertical in mm</field> | ||
<field type="uint16_t" name="resolution_h" units="pix">Image resolution in pixels horizontal</field> | ||
<field type="uint16_t" name="resolution_v" units="pix">Image resolution in pixels vertical</field> | ||
<field type="uint8_t" name="lens_id">Reserved for a lens ID</field> | ||
<field type="uint32_t" name="flags" enum="CAMERA_CAP_FLAGS">CAMERA_CAP_FLAGS enum flags (bitmap) describing camera capabilities.</field> | ||
<field type="uint16_t" name="cam_definition_version">Camera definition version (iteration)</field> | ||
<field type="uint8_t[140]" name="cam_definition_uri">Camera definition URI (if any, otherwise only basic functions will be available).</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't want a local and a remote URI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a reason to have two separate URIs. If the vehicle/camera is able to serve the file, why have an external URI? If it can't, it can't and there would be only one. Not to mention the lack of space within the message. Can you think of a reason why we would need both local and external?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having multiple URI might lead to confusion/mismatch etc at some point in time. Better to have a single URI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok sure.
message_definitions/v1.0/common.xml
Outdated
@@ -4078,33 +4096,36 @@ | |||
<field type="uint8_t" name="camera_count">Number of cameras</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related, what does camera_count mean? Number of sensors in the given camera?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you request camera information and set Camera ID
to 0 (All Cameras), you will receive 0 or more CAMERA_INFORMATION
messages in response. If the vehicle has two cameras, you would receive two CAMERA_INFORMATION
messages where one would have camera_id
set to 1 and the other camera_id
would be set to 2. In this case, camera_count
would be set to 2. That's how you know how many cameras there are and to make sure you received a CAMERA_INFORMATION
for each. If the camera_count
is set to 2 and you only get one CAMERA_INFORMATION
back, it means one of the messages was lost. That would allow you to request again the missing message (and target the request to the missing camera id.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been removed as we discussed.
<field type="float" name="focal_length" units="mm">Focal length in mm</field> | ||
<field type="float" name="sensor_size_h" units="mm">Image sensor size horizontal in mm</field> | ||
<field type="float" name="sensor_size_v" units="mm">Image sensor size vertical in mm</field> | ||
<field type="uint16_t" name="resolution_h" units="pix">Image resolution in pixels horizontal</field> | ||
<field type="uint16_t" name="resolution_v" units="pix">Image resolution in pixels vertical</field> | ||
<field type="uint8_t" name="lens_id">Reserved for a lens ID</field> | ||
<field type="uint32_t" name="flags" enum="CAMERA_CAP_FLAGS">CAMERA_CAP_FLAGS enum flags (bitmap) describing camera capabilities.</field> | ||
<field type="uint16_t" name="cam_definition_version">Camera definition version (iteration)</field> | ||
<field type="uint8_t[140]" name="cam_definition_uri">Camera definition URI (if any, otherwise only basic functions will be available).</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having multiple URI might lead to confusion/mismatch etc at some point in time. Better to have a single URI.
message_definitions/v1.0/common.xml
Outdated
@@ -3158,6 +3175,7 @@ | |||
<field type="uint8_t" name="result" enum="MAV_RESULT">See MAV_RESULT enum</field> | |||
<extensions/> | |||
<field type="uint8_t" name="progress">WIP: Needs to be set when MAV_RESULT is MAV_RESULT_IN_PROGRESS, values from 0 to 100 for progress percentage, 255 for unknown progress.</field> | |||
<field type="uint8_t" name="device_id">WIP: Used to identify targeted device when multiple devices use same component ID (i.e. Camera, Storage, etc.)</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this change require existing users of COMMAND_ACK to make corresponding changes in their code?
message_definitions/v1.0/common.xml
Outdated
<entry value="1" name="CAMERA_CAP_FLAGS_CAPTURE_VIDEO"> | ||
<description>Camera is able to record video.</description> | ||
</entry> | ||
<entry value="2" name="CAMERA_CAP_FLAGS_CAPTURE_PHOTO"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the term IMAGE sounds better than PHOTO (Subjective)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no preference. If this what everybody thinks, I will change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other hand, PHOTO works with PHOTO mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was the reason I used "Photo". But the command to "take pictures" is called "START IMAGE CAPTURE" so we sort of have two different terms for the same thing already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets make them all same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. It's now IMAGE wherever appropriate.
@@ -2586,6 +2585,24 @@ | |||
<description>Landing target represented by a pre-defined visual shape/feature (ex: X-marker, H-marker, square)</description> | |||
</entry> | |||
</enum> | |||
<enum name="CAMERA_CAP_FLAGS"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't all capability definition be subsumed in camera definition file? Or is this only to be used for specific cases where def file isn't available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is for when you don't have the camera definition file. While implementing this, I realized that most of this info within the definition file is redundant and it should not be there (in the definition file). As this is the first call you make for camera discovery, you will receive this message back with the information within. There is no reason to duplicate it within the camera definition as well.
Rename Photo to Image where appropriate Remove device_id from COMMAND_ACK
Speaking of |
Putting this here for now but it has to be documented somewhere more appropriate at some point. How to deal with storage (the various STORAGE messages). When dealing with a camera’s storage unit, we will use the camera’s component ID when sending these messages. That is, if you want to format the storage of a given camera (or query storage status, etc.) you will send that command to the camera’s component ID. If the camera has its own storage, it can just go ahead and format it (faster than erasing files). If the camera shares storage with something else, it’s up to the camera to deal with it. In that case, when it gets a format command, it would erase its files, leaving the storage alone. If it finds the storage is corrupted (and therefore requiring formatting) it would elect to format it instead if appropriate. (I need to add this to the various |
<field type="float" name="focal_length" units="mm">Focal length in mm</field> | ||
<field type="float" name="sensor_size_h" units="mm">Image sensor size horizontal in mm</field> | ||
<field type="float" name="sensor_size_v" units="mm">Image sensor size vertical in mm</field> | ||
<field type="uint16_t" name="resolution_h" units="pix">Image resolution in pixels horizontal</field> | ||
<field type="uint16_t" name="resolution_v" units="pix">Image resolution in pixels vertical</field> | ||
<field type="uint8_t" name="lens_id">Reserved for a lens ID</field> | ||
<field type="uint32_t" name="flags" enum="CAMERA_CAP_FLAGS">CAMERA_CAP_FLAGS enum flags (bitmap) describing camera capabilities.</field> | ||
<field type="uint16_t" name="cam_definition_version">Camera definition version (iteration)</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
* master: Specify that you need to use the command's target_component to target a specific component's storage. Extended parameter handling (#752) Common: Add GPS_FIX_TYPE_PPP message_definitions: add white balance lock message_definitions: improve image capture status # Conflicts: # message_definitions/v1.0/common.xml
* Preparing for camera definition * Removing Camera ID (flagging it as to be removed) Rename Photo to Image where appropriate Remove device_id from COMMAND_ACK * Reserving space for 6 cameras.
* Preparing for camera definition * Removing Camera ID (flagging it as to be removed) Rename Photo to Image where appropriate Remove device_id from COMMAND_ACK * Reserving space for 6 cameras.
This is in preparation for adding support for a Camera Definition File as discussed in discuss.px4.io.
CAMERA_INFORMATION
messageCAMERA_INFORMATION
.CAMERA_CAP_FLAGS
)device_id
field to theCOMMAND_ACK
message to identify target devices that share a component ID (Camera, Storage, etc.)@julianoes Please check and see if the implementation of the
CAMERA_CAP_FLAGS
is correct. This is the first time I define a bitmap.Note that this doesn’t remove any existing functionality yet. Only when the camera definition file is fully implemented and validated will the Experimental messages and commands be removed.