Hi Chris,

I have been looking at your basic stamp code and I think it is all starting to make sense to me finally! I have a question relation to the altitude control, I understand that if the UAV is + or - 10 Meters away from starting altitude it will correct by moving the elevators either up or down by just a bit. But if the UAV was some how a bit further below or above that, wouldn’t that cause the UAV to start doing a big loop the loop. I.e., never reaching the altitude and just doing big loops? What do you think would be the best way to stop this? I was thinking maybe a gyro or something that could measure the angle of climb or decent and not let the plane go steeper than that angle.

Also then I could include altitudes into the waypoints. This could be handy with photography or Mountains!.

I should be getting my BS2P and other gear this week! I can’t wait to start trying some of this stuff out!

Regards,

Scott James

Views: 216

Reply to This

Replies to This Discussion

Scott,

Although it may have to be tweaked for different aircraft, the code is written to just give a small amount of up elevator (equivalent of one trim click) so that the plane climbs or descends gradually until it's back within +-10m of the target altitude.

I am going to fine tune that subroutine, however, but for another reason. Right now it takes three altitude samples in a row. At a 1Hz refresh rate, that means that it freezes the autopilot for three seconds, which is too long. Instead, I'll adjust it so it takes a single reading before handing back to the navigation subroutine. It will remember the past two readings and just use those to take an average.

As I say, all this will have to be tweaked after air trials!
Oh yea, I didn’t even notice that it would freeze it for three seconds. I guess I also forgot that once the elevator went back to centre the FMA unit would then level out the UAV again. There is certainly a lot to consider when writing the code, but that’s the challange!
Chris, I've never flown R/C before. Is altitude hold something that is very crucial to the UAV's performance? Or is it acceptable to let it "bounce" around in a 10-15 meter error range as long as it doesn't veer right into the ground? With no concern for camera/video quality, of course.
Scott,

I've now updated the code so that it only samples once per loop, and gets its average from previous readings. So that 3-second freeze is now just a one-second freeze.
Simon,

Yes, altitude hold is pretty important. Without it, even with a well trimmed plane and the FMA stabalization, it's just a matter of a few minutes before you'll be in the ground or too high for comfort. So you can probably get away with maybe a couple laps around the field, following waypoints for testing, without altitude hold, but not more than that.

That said, the kind of altitude hold the Basic Stamp autopilot does is indeed a "bounce around a range" sort, which is too say that we're just trying to keep it from going too high or too low but don't really care about a few meters here and there.
Ah, I see

Scott:

I don't know the specifics on how a gyro works, but I definitely don't think that it is needed for this application. You could have proportional elevator control where you can take into account the actual error in altitude and use that in a function for elevator position, that way you won't have jerky movements where the elevator will always move to the same position, whether its 10 meters off target or 1 meter. (Not sure if the autopilot code is already programmed to do this, since I don't understand the FT639 syntax)

However, even that I don't think is necessary, since as Chris says, the angle of the elevator is already fixed to move at a shallow angle, so there shouldn't be a problem unless you're dangerously low to the ground.

Then again, I have no r/c experience, but that is just what I concluded from what I know so far.

@Chris, again:

This is slightly off topic, but do you think an Easy Star would be able to fly somewhat with decent stability (anything that doesn't end in a crash) without an FMA co-pilot? I don't want to use something that does all the work for me, since it's for a science fair, and I've also heard that the co-pilot won't help on a plane with no ailerons. We'll have a manual pilot too in case something does go wrong, but do you think it is acceptable to fly without the co-pilot?
Simon,

Frankly, I doubt it. I general I think GPS-only autopilots are a bad idea for all but the most stable free-flight aircraft, and as someone who has crashed EasyStars many times, I can assure you that is is certainly not that ;-)

But you're right that the FMA co-pilot won't suit a plane with no ailerons. You'd have better luck with the larger EasyGlider, which does have ailerons (and more room for equipment):
http://www3.towerhobbies.com/cgi-bin/wti0001p?&I=MPUA2105

Or better yet, go for something more like a standard highwing trainers, as we use in Geocrawler 2 and 4.
What about this for an idea.....

Getting back to my idea of altitude control and maybe even including altitude levels into the waypoints. (To avoid Geography or for different altitudes for Photography)

What if you attached the FMA co-pilot unit onto a see-saw style mount which would be connected to a servo. The hinge of the see-saw would run parallel to the wings letting it tilt forward and back, but only by maximum of say 10 degrees in either direction.
Then the subroutines that would normally control the elevator (for altitude) would instead control the servo connected to the FMA co-pilot. If the UAV needed to climb, the servo connected to the FMA Co-Pilot would tilt it forward. It would then think that the UAV is starting to descend. The FMA Co-pilot would then control the elevator to correct it. The UAV would then be climbing and the angle specified by the program.

Can anyone see any holes in my theory? I think it could be a simple approach rather then lots of extra sensors and code.

What do you think??
Scott,

Yes, I think that could work. Although it sounds a little fiddly, mechanically, it's probably a more effective way than mine, which disables the elevator input from the FMA co-pilot during autonomous flight and just controls altitude with GPS. (Remember that we intercept the rudder and elevator commands, but not the ailerons and throttle.). Alternatively, you could have the FMA co-pilot "elevator" channel control the throttle instead. A properly set-up plane will climb with more throttle and descend with less.
Hmm...isn't all of the work we do on autopilot development a little fiddly? LOL
Another thing about the altitude hold freezing the navigation for three seconds. I'm reading the PSC/Parallax GPS source code, so I don't know if the updated one is different, but wouldn't it be better if the program switched to altitude hold when the plane is on course (i.e. turning angle is close to 0)?

Right now it switches to altitude hold when the plane hits the current target waypoint, but isn't that when the plane needs to make the sharpest turns to the next waypoint? (Correct me if I'm wrong, just something that came to me while I was reading through the code).
Simon,

The latest code is here. Now, as always, it switches to the altitude hold program once per second, not just when the the plane hits the target waypoint.

Reply to Discussion

RSS

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service