These are chat archives for PX4/Hardware

3rd
Jan 2017
Justin Huntington
@Corusco
Jan 03 2017 00:34

I'm sorry to do this, but would anyone mind doing an "Explain to to me like I'm 5" regarding internally triggering a servo? Thus far I've been able to use

#include <drivers/camera_trigger/interfaces/src/relay.h>

CameraInterfaceRelay camera_relay;
camera_relay.trigger(true)

to get an LED to light very briefly. I'm worried that the pulse won't move the servo enough to do what I need it to do, though I should mention it is only momentary. What I'm thinking I need is roughly a .5sec pulse to move the servo to the point I need it, then move it back. I'm also assuming I'll need a BEC in the circuit, which I do conveniently have on my GPIO rails.

Mark Whitehorn
@kd0aij
Jan 03 2017 13:39
Are you talking about a standard RC servo, which requires a PWM input?
Justin Huntington
@Corusco
Jan 03 2017 16:21
@kd0aij I didn't actually know it requires a PWM input, but yes, it's a standard 3-wire RC servo
that explains how the signal is interpreted by the servo; a single camera trigger pulse probably won't result in useful behavior
Justin Huntington
@Corusco
Jan 03 2017 16:39
Thanks as always, Mark. This does help me remember about the appropriate pulse widths. As I imagine you noticed, I had a much larger pulse in my head. As regards the code, is it appropriate to use the enable method on
/drivers/camera_trigger/interfaces/src/camera_interface or, as I'm reading how that code uses it, just hit the up_pwm_servo_set() with the appropriate pins as the first argument and my pulse width as the second?
Mark Whitehorn
@kd0aij
Jan 03 2017 16:57
you should definitely use a PWM output. I'm not familiar with the method you mention though
Justin Huntington
@Corusco
Jan 03 2017 17:02
Roger that. Thanks again. @mhkabir was one of the authors of the CameraInterface class. If you'll forgive me for calling you, Mohammed, could you shed any light on this existing code? I'd definitely prefer something already available on the firmware and written by better programmers than I.
Kabir Mohammed
@mhkabir
Jan 03 2017 17:53
What are you trying to achieve with the servo?
Justin Huntington
@Corusco
Jan 03 2017 17:53
it's pulling a mechanical switch to release a pressure valve.
Kabir Mohammed
@mhkabir
Jan 03 2017 17:54
OK, so no point using camera trigger
You can however use it as a reference to generate pwms
Justin Huntington
@Corusco
Jan 03 2017 18:00
Utilizing the camera trigger passthrough is just how our clients did what they've been doing when using ardupilot. Given the convenience of the existing framework, that's what I was hoping to continue at least for the time being. I'm still good to generate the PWMs on my own, though. Is the function inside CameraInterfacePWMwhich I mentioned above, up_pwm_servo_set() an appropriate spot to start?
Tiktiki
@Tiktiki
Jan 03 2017 18:04
If you want to manually control from the radio, just set a RC passthrough and adjust your endpoints on the remote-side.
Alternatively, you can use the mixers to configure an AUX output with a range. There is an input for the "gimbal shutter" which is basically a camera trigger.
You could also use the "payload" control group, but I have not tried it yet.
Kabir Mohammed
@mhkabir
Jan 03 2017 18:31
You can just passthrough as @Tiktiki says if you don't need any autonomy over the servo and can just use RC
Justin Huntington
@Corusco
Jan 03 2017 18:36
Thanks very much, @Tiktiki and @mhkabir. I do actually need both RC and autonomy, though autonomy is the priority right now. I set up the RC passthrough but had trouble getting the servo to move. That's not as big a deal right now, however.
Kabir Mohammed
@mhkabir
Jan 03 2017 19:08
The proper way to do it would be via the payload control group
Then you can pass RC plus command it automatically
See how the mount driver works
It's for controlling a gimbal with pwm
Justin Huntington
@Corusco
Jan 03 2017 19:12
I'll do that. Thanks again!
Mohamed Abdelkader Zahana
@mzahana
Jan 03 2017 19:14
So if I would like to control a gimbal using px4, what are the steps to activate it?
Nathaniel Noussias
@cosmonate
Jan 03 2017 19:18
Are there docs that cover the control groups a little more in depth?
Justin Huntington
@Corusco
Jan 03 2017 19:18
http://dev.px4.io/concept-mixing.html These are the ones I'm looking at right now
Nathaniel Noussias
@cosmonate
Jan 03 2017 19:25
I’ve seen those, but they don’t really go in depth on some of the details. I’m making a mixer for a fixed wing plane right now, and can’t really tell the difference between the flaps and airbrake mixers (Othen then one responds to FW_FLAPERON_SCL and ther other responds to FW_FLAPS_SCL).
But thats really just in manual mode, and I have no way of knowing if they behave differently in other modes.