ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
11.01k stars 17.55k forks source link

Add new camera trigger feature #2672

Closed jakubjon closed 9 years ago

jakubjon commented 9 years ago

Hi, 1) I am totally newbie in Ardupilot stuff, but I would like to use Pixhawk as a controller for Ultra Light plane camera gimbal. I plan to use Arduino instead of Rx and I would like to trigger camera each certain distance. Is there any chance to set CAM_TRIGG_DIST using PWM input? Or in the best case to turn off and on triggering using different PWM input?

2) In case there is no such an option how would you estimate difficulty of adding such feature by my self? I would define my self as a basic C++ programmer with arduino experiences. A was actually able to compile PX4 firmware (without loading it in to Pixhawk). But I found out that I don't understand to the connection between PX4 and APM firmwares. Just a hint or lik in this case will help me..

Thanks Jakub

squilter commented 9 years ago

I would like to trigger camera each certain distance

Try this

Is there any chance to set CAM_TRIGG_DIST using PWM input

Pixhawk doesn't support PWM input, so there isn't really a clean way to do it. The proper way to change the distance is to send a mavlink command called DO_SET_CAM_TRIGG_DIST

estimate difficulty of adding such feature by my self?

That depends on how you end up implementing it. I would recommend not modifying the ardupilot code. Instead, use dronekit to send DO_SET_CAM_TRIGG_DIST or MAV_CMD_DO_DIGICAM_CONTROL or something else like that.

Just a hint or lik in this case will help me.

dev.ardupilot.com is pretty great

rmackay9 commented 9 years ago

A small correction, the Pixhawk does support PWM input, we use it for the lidar-lite driver. http://copter.ardupilot.com/wiki/common-optional-hardware/common-rangefinder-landingpage/common-rangefinder-lidarlite/#connecting_to_pixhawk_via_pwm

I think the rest of @squilter's advice is good. An alternative would be to create a new Ch7/Ch8 auxiliary switch function to enable/disable the camera trigger.

rmackay9 commented 9 years ago

By the way, feel free to email on drones-discuss@googlegroups.com or join gitter (see "How the team works" on this link: http://dev.ardupilot.com)

jakubjon commented 9 years ago

Thank you for your hints. I decided to use PWM to ppm encoder to operate gimbal and Arduino to set CAM_TRIGG_DIST parameter via telemetry using MAVlink library. But after many tries I didn't figure out how to create such a message.. I have added MAVlink c library but I cant find proper command. Please may I ask you to direct me on peace of code for inspiration? Thanks

djnugent commented 9 years ago

@jakubjon mavlink on arduino uno does not work(anymore). It does not have enough SRAM. You will need to use a bigger arduino, like the Mega or a Teensy.