Pan & Tilt with retraction running on Arduino 2560 (not APM) with some quick test code - 480i version

 


With Ardupilot Mega now in full swing and my brain going haywire thanks to the rubbish weather I have been taking distractions where I can (IR radar system for my computer desk, a segway for my action man, web enabled curtain opener and more).

Over a few hours I had my scribble pad out with some vernier calipers and a Cirrus CS301 servo. The result was a fairly small fully retractable camera system (at least in doodles). Wanting to create a quad from CF a friend offered his laser cutter (free of charge) but wanted a test subject to see how it cut. A few days later the doodle was CAD'd and then lasercut out of CF. I had three fit on a single sheet which leaves room for when I break it.


The entire mechanism is 120mm x 35mm x 35mm when "retracted" (these settings are yet to be finalised on plane) while when extended the assembly is  65mm below the plane. Unfortunately the camera must then be added to the bottom making it larger but as my camera (eBay keychain camera £4 each :D) is 34mm x 12mm x 55mm its quite nice.

Only thing left to do was the coding which I'd already started thinking about anyway. It uses lots of pre-existing code from within the APM sketches (so I know it works and if not I broke it). As long as the camera is on the bottom of the plane (level XY) it can be rotated in any direction (so if centered the camera will face right at 90°) and still track a GPS position. Using a few defines and a bit of math any limited movement servos can be used to track a GPS position.

As Ardupilot has been moving in this direction I undertook this myself with a hope of creating something worthy of general release later after I and the bosses had tested (why I haven't given out some details). This was saved to my drafts so it would not be published until I had finished writing the blurp explaining all of this but apparently "Save as Draft" means publish immediately. It is very flexible thanks to the variables changing servo output direction and matching center facing direction with flight bearing its limitation is just the level downwards mounting. That is my next task after testing this.

Edit: New code loaded with proof of concept spreadsheet. Here is hoping for some good weather.

Views: 630

Tags: camera, pan, tilt, tracking

Comment by James F. on February 2, 2011 at 2:04pm
How did you manage to cut CF with a laser cutter? What laser cutter did you use?
Comment by DaveyWaveyBunsenBurner on February 2, 2011 at 3:19pm
Hi Ritchie,

I think this is exactly what Im looking for but do you have a diagram of the built mount?

Cheers!
Comment by DaveyWaveyBunsenBurner on February 2, 2011 at 4:17pm
Thats an amazing coincidence Ritchie, I've spent today designing almost exactly this! I want to be able to swing an FPV camera over the nose of an Easystar and back up for landing. Anyway I shall PM you!
Comment by Ritchie on February 2, 2011 at 4:35pm

Laser cutter is a friends in a school, 100w is all I actually know.

@DaveyWaveyBunsenBurner

No idea of it built unless you call my idiot scribble a diagram.

The pan and tilt is pretty much the same as everyone elses (meaning the code can be used with everyone elses - except pan and tilt channels may need to be switched).

It is your retraction method that will be hard. I built mine to be a cuboid shape so I can cut the plane to shape easily. The two square-ish bits glue to the servo back and the airframe and after that its just round bits in round holes square bits in square holes.

I'll post pictures in the initial post of it on the plane once its done.


Developer
Comment by Randy on February 2, 2011 at 4:52pm
Ha! I like your comment about "Save as draft" = publish immediately.  That happened to me about a week ago with my mouse sensor post.  I saved it, then immediately went to bed and to my horror the next morning found my half-finished blog was out there..
Comment by Jay Land on February 2, 2011 at 4:56pm

Great project.... have you thought about having the GCS send commands to the mount in flight? Also what about using the mount and aircraft position data to caculate the location of an object you are viewing and being able to pass that data to the autopilot to "track to" or orbit over.

 

I am still in the baby steps for programming but would love to help if I can.

 

Good luck.

Comment by Ritchie on February 2, 2011 at 6:33pm

@Randy :D

@Jay Land GCS commands is probably out of my league but Jason, Doug et al could probably knock it up in a few minutes being the genuises (is that right plural :D) that they are. The distance calculation is converting the location data into metres or feet which I have no idea how to do but the data is all the easily enough.

Thanks to some forward planning servos can be reversed and scaled. While the data used conforms to standard APM style and so has all the information similar ones have (all locations have lat, lon and alt etc). Thinking about Happy's awesome work I made sure to use separate variables where I could so uploading only needs to go to one place to change the focus (GPS_mark - imaginative name huh). Also the retraction happens automatically below 20m above home location.

Comment by Jay Land on February 3, 2011 at 12:38am
I have an app on my DroidX that allows me to take a picture of an object and it will tell me the height. With the right info it would make a good tool for the GCS software..... My hampster is really turning......
Comment by Ritchie on February 3, 2011 at 3:52am
As I said the data is all there easy enough, its just the conversion of units (which you don't need always). You could conceivably add the GPS mark data to the telemetry stream too but I'd rather let one of the big bosses do that as it would mean adding bits to already functioning APM stuff (unlike this which is completely new code so doesn't interfere).

Developer
Comment by Doug Weibel on February 3, 2011 at 8:22am

Ritchie,

 

I am just starting to sip my first cup of coffee of the morning, but....  Your code does not appear to account for the roll, pitch or yaw (heading) of the airframe.  Without compensation for roll and pitch it cannot do a very good job of tracking a target.  Without compensation for yaw of the airframe it is useless.  Perhaps you are doing something with PITCH_CENTER that is not shown above?.  You should take a look at the work Pete Hollands did for the UAVDevBoard and the work Joe Holdsworth is doing for APM.

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

Social Networking

Contests

Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.

A list of all T3 contests is here

Groups

Advertisement

© 2013   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service