-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: Add info about pin 7/8 usage #781
Conversation
@bkueng In addition, a lot of the rest of the doc appears to be either wrong or confused - and I can't seem to test it. For example, I used Gazebo with a camera option and tried to set GPIO. As you can see TRIG_PINS does not seem to be offered following reboot, so I can't check if the image for QGC is up to date Upshot - how do I test this (is the QGC image still correct at that link). |
Co-authored-by: Beat Küng <[email protected]>
en/peripherals/camera.md
Outdated
@@ -33,17 +33,19 @@ Mode | Description | |||
|
|||
## Trigger Hardware Configuration {#hardware_setup} | |||
|
|||
You can choose which pins to use for triggering using the [TRIG_PINS](../advanced_config/parameter_reference.md#TRIG_PINS) parameter. | |||
On Pixhawk FMUv5x boards use the board-specific camera capture pin (PI0) to signal PX4 that an image has been captured (this is not available on earlier Pixhawk FMU versions). |
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.
@bkueng Updated this to make it clear what capture is, and (my assumption) that camera capture indication is only supported on FMUv5. I know this was planned to also be indicated in MAVLink but I don't think Daniele ever finished the implemetation - correct?
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.
Other boards use the FMU PWM pin 6 (hardcoded).
From the code, the CAMERA_TRIGGER
mavlink message is sent out as well, so should be all there.
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.
@bkueng OK, I updated the capture info for FMU PWM pin 6.
the CAMERA_TRIGGER mavlink message is sent out as well, so should be all there.
Yes, but we're talking about camera capture, not trigger. That message should be sent by the camera and processed by PX4 (not "sent"). I have a feeling that we don't yet process that signal.
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.
See https://github.com/PX4/Firmware/blob/master/src/drivers/camera_capture/camera_capture.cpp#L159. I'm not sure how this is supposed to work, but that's how it is currently.
There's also a CAMERA_CAPTURE
message. Quite confusing.
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 was discussed in PX4/PX4-Autopilot#10295 but eventually merged in PX4/PX4-Autopilot#11395 (for some reason I though it got abandoned). Anyway the theory here is that you publish the trigger message after you get the capture (from a hotshoe say), and this gives you a better timestamp for geotagging.
But I really don't get this. I mean I understand how it will work for a camera attached to the FC, but if you have a mavlink camera then the CAMERA_TRIGGER is what sets off triggering, so this becomes recursive.
Perhaps @DanielePettenuzzo can explain, but I think the mavlink case is an omission/enhancement that should not block this right?
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.
But I really don't get this. I mean I understand how it will work for a camera attached to the FC, but if you have a mavlink camera then the CAMERA_TRIGGER is what sets off triggering, so this becomes recursive.
Exactly, my main point of confusion as well.
OK, I updated the capture info for FMU PWM pin 6.
I don't see this?
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.
But I really don't get this. I mean I understand how it will work for a camera attached to the FC, but if you have a mavlink camera then the CAMERA_TRIGGER is what sets off triggering, so this becomes recursive.
Exactly, my main point of confusion as well.
Arrgg, I got this wrong, and am sorry to have confused you/us. CAMERA_TRIGGER is always a notification. It is emitted by either the camera driver or the camera capture driver. It will also be emitted by a MAVLink camera.
If you use a camera capture there will be multiples of this flying around, with the same sequence number and different timestamp. So essentially you'll have some component that is smart enough to resolve this, as described in PX4/PX4-Autopilot#10295 (comment)
@bkueng Thanks, ready for another review. Next time you do anything with a hardwired camera can you regenerate the UI diagram for me as per #781 (comment) ? |
Otherwise good to go? |
en/peripherals/camera.md
Outdated
- Pixhawk FMUv5x boards use the board-specific camera capture pin (PI0). | ||
- Other board use FMU PWM pin 6 (hardcoded) for camera capture. | ||
|
||
> **Note** The camera driver and camera capture driver emit the MAVLink [CAMERA_TRIGGER](https://mavlink.io/en/messages/common.html#CAMERA_TRIGGER) message (with timestamp and image sequence number) when image capture is triggered and signaled, respectively. |
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.
@bkueng FYI here I added info abut the camera trigger. Seem correct to you? Looking at the code it looks like the camera driver just updates the uorb topic and that ultimately causes the message to be omitted.
It seems to me that a MAVLink camera should emit CAMERA_TRIGGER to.
Anyway, this make sense?
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.
Yes that helps, thanks.
The fmu will emit CAMERA_TRIGGER in any case though: https://github.com/PX4/Firmware/blob/master/src/drivers/camera_trigger/camera_trigger.cpp#L330.
Probably worth clarifying in the mavlink spec as well.
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.
Hmmm. On further thought and reading I think the behaviour here will remain undefined - the commands that PX4 uses are not deprcated - do_trigger_control etc - but they are very much "old style". The new camera API uses new ones.
The good news here is that I think it doesn't matter. A MAVLink camera should emit CAMERA_IMAGE_CAPTURED on every capture, with a timestamp. A geotagging system should simply use that by preference if both messages are present. Make sense?
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 really lack the background on all these messages to give you a good answer, but you're probably right. Daniele should have the overview, but he's out this week.
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. Gus pretty much said that the behaviour for the old commands on a mavlink camera is undefined. That said, he did indicate that if the camera did obey the command then it would emit CAMERA_IMAGE_CAPTURED
. I think we need to get those old commands deprecated and support for the new commands added to PX4.
en/peripherals/camera.md
Outdated
- Pixhawk FMUv5x boards use the board-specific camera capture pin (PI0). | ||
- Other board use FMU PWM pin 6 (hardcoded) for camera capture. | ||
|
||
> **Note** The camera driver and camera capture driver emit the MAVLink [CAMERA_TRIGGER](https://mavlink.io/en/messages/common.html#CAMERA_TRIGGER) message (with timestamp and image sequence number) when image capture is triggered and signaled, respectively. |
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.
Yes that helps, thanks.
The fmu will emit CAMERA_TRIGGER in any case though: https://github.com/PX4/Firmware/blob/master/src/drivers/camera_trigger/camera_trigger.cpp#L330.
Probably worth clarifying in the mavlink spec as well.
en/peripherals/camera.md
Outdated
- Other board use FMU PWM pin 6 (hardcoded) for camera capture. | ||
|
||
> **Note** The camera driver and camera capture driver emit the MAVLink [CAMERA_TRIGGER](https://mavlink.io/en/messages/common.html#CAMERA_TRIGGER) message (with timestamp and image sequence number) when image capture is triggered and signaled, respectively. | ||
PX4 determines which instance to use based on the (later) timestamp. |
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.
Where is this coming from?
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.
@bkueng This is coming from PX4/PX4-Autopilot#10295 (comment) . I.e. the intent is clearly that PX4 will determine which value should be used for timestamping, or that another system should be able to work this out from the log.
However I don't truly know if this intent is implemented in code. I would love to be canonical, but I'm not digging in code for this. If you don't either, might this be better "softened" to ...(?)
"A geotagging system can determine which instance to use based on the (later) timestamp (e.g. from the log)."
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 ok, clear now. I would change it then to (or similar):
**Note** PX4 emits the MAVLink [CAMERA_TRIGGER](https://mavlink.io/en/messages/common.html#CAMERA_TRIGGER) message (with timestamp and image sequence number).
If camera capture is configured, the timestamp from the camera capture driver is used, otherwise the triggering timestamp.
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.
Works for me. Changed.
@bkueng I have merged this because I'm pretty sure "it is not wrong", though there is obviously more that could be done with camera docs. That said, PX4/PX4-Autopilot#13980 asked for writing diagrams/docs for camera capture. Do we have any examples? Ie of a real camera with trigger input/output and how it is wired up. I am imagining that a camera that supports triggering via GPIO might have two inputs and one output and you just connect 3 wires. But real example with images removes all ambiguity. |
This attempts to capture info from PX4/PX4-Autopilot#15482
Questions inline.