Hello everyone! I would like to start by saying that this is a pretty sweet website, and what you guys are doing is awesome. I was hoping my first post on here would be a contribution, but, unfortunately, that is not going to happen.

So I am trying to impliment two way communication with a ground station that some friends of mine are working on. The goal is to add the ability to change waypoints while in the air and anything else we haven't thought of yet. I am doing this by adding a soft serial line to analog pins 4 and 5. The EEPROM based waypoint system is to remain an option, with a command to switch between EEPROM and non-EEPROM waypoints (I think the term is flash?). The idea is to create arrays, and use the WP number to index to them, pretty simple.

The modifications made to the code are minimal, I changed arround the set_waypoint slightly to have two different locations to get new waypoints and to check to see if the next waypoint s blank, and added the command "commander();" to the main loop. I will post the code associated with this in a file called "clarence". I also modified the navigation loop to always update wp (for debugging) and changed the "print_data()" function to include a time stamp, ID and changed its format slightly. If there is interest prior to me finishing and polishing this thing, I would be more than happy to post it.

So far, in the lab at least, everything works great, we are able to use the system to full capability, being able to switch to waypoints, insert, delete, print, modify and erase all. The problem is all this functionality works with only latitude and longitude, but not altitude.

So after mucho time debugging, I have concluded that the problem lies when writing to the array wp_alts, in the function called "saveIt()" . In the attached code the second to last line is commented out, and everything works fine so long as this line is commented out. If I remove the comments, none of the soft serial communication works, it seems to omit things at random, and insert additional characters, even when the function saveIt(); is not called (for example, when I send the command "1D$" the data printed is distorted when the line is not commented out). Now here is why I think this may be a memory problem, when I change the size of the array wp_alts from 100 (more than 100 waypoints is not neccessary with two wayt telem) to 2, things work fine (but then I can only have 2 wps!). I know this is a difficult quest to respond to, but I am not a programmer by any means, and I am stumped! Also, I am very open to suggestions to making my code "better" or more efficient!

Thanks in advance!

Views: 267

Attachments:

Reply to This

Replies to This Discussion

Well, if anyone is interested the problem was my arrays were eating up to much RAM and so I changed the array sizes to 75. I will be sure to post all my code if it turns out as well as we are hoping
Not sure about all this stuff, as I am not a programmer and have no experience. However, I have used a program in conjunction with microsoft's flight simulator called "FS Navigator". Basically a moving map that is linked to the sim and responds via inputs and outputs to the autopilot, allowing the aircraft to follow a pre-loaded flight plan or changing perimeters on the fly...ie. fully autonomous, heading only, airspeed or altitude hold, follow the flight plan, or fly to a certain GPS waypoint or point on the map.
If someone could make this program work with UAV's , it would be the "bomb" in my book.
Can you tell me how you r switching between GPS and RF / because both r connected to same UART...................
Have you used ardupilot atmega328....
All my work has been on the 328 ArduPilot

So long as you keep the Baud Rates different you could do it on the same line, but the buffer would be shared (making the talking from the ground station to the ArduPilot limited at best) so I added a "soft"serial line. This is a library used to mimick a serial line on any digital pins. Long story short I used this http://arduiniana.org/libraries/NewSoftSerial/

The code posted above has several limitations and shouldnt be used yet beacuase it spends too much time processing commands and not enough flying the AC (a simple timer will fix that however)

BTW, if anyone is interested we are posting our C++ groundstation and modified ArduPilot (supporting 2-way comm) for one plane later this month, or at least after we test the crap out of it.
Welcome to DIY Drones!

- Don't know about your problem though so I can't help [i'm not a programmer]..

-Can't wait to see your two way link, I have been looking into something like that for a while. I would love to use that to program my uav when it is finished.

-Good luck!, Rd=]
Thats interesting i also doing the same stuff and started to design the whole ground station application in VC++... .. Did not make any major changes in ardupilot code but i m thinking of using two controllers(two ardupilots). because my groundstation requires
1.Google maps(navigation data).
2. Camera zooming instruction from ground itself.
3. Other commands to plane from ground(for future development).

So i m planning to implement it in this way(attached here)

Please suggest if any better idea you have ....
Attachments:
The new soft serial idea is great thanx to tell that... but i think it lacks in efficiency....because we dont have a huge buffer internally in 328. Have you tested in real time situations..
We have done a TON of testing on the ground, as well as while GPS data is parsed for speed tests. We changed the data printing to request based (for multiple aircraft purposes), so the AC is silent until told to do something by the ground. On the ground, with GPS being parsed I can send 1000 requests and get, usually, 997 good responses, 3 time outs and no bad packets (simple checks on the groundstation filter bad data). We are currently running into the problem where if we request data too fast (over 2 Hz) we get stuttering in the control surfaces, which is unacceptable.Hopefully we will fix it today.

I did modify the waypoint switch function as well as added a few printing functions, and some mods in navigation. Basically all I did was add a flag that tells the board to either read waypoints from the EEPROM or read them from RAM (we don't allow for writing to the EEPROM or flash while the AC is in the air)

With our current setup if you set a timer to zero you will get the original ArduPilot exactly as posted on Google, but with modified telemetry printing. The printing also removes all text.

I have no idea the size of the software serial buffer, but the real limitation IMO is the baud rate limitation without external hardware. We have to operate at 38.4k. Commands are kept very simple, usually no more than 6 characters, and up to around 40.


We are using the QT add on for VS 2008 for the ground station. We can use Google maps to simply click on an AC and click on a map where you want its waypoints to be. We are trying to keep everything operating without a keyboard.

Things that would be useful in two way ground we haven't done yet
1. Gain scheduling / live PID tuning
2. live trim setting
3. Fly by iPhone (or something similiar, command set points, basically ignoring the outer loops in the PIDs)
4. Camera stuff


I would be interested to know about your camera set-up and if you want more up to date code let me know.
The jittering is not wanting to go away =(
I am pretty sure that the soft serial line uses a timer or interrupt or something that doesn't play well with the servo code, which explains why everything works fine so long as the ArduPilot isn't talking.

Played with the trims today and thought this was pretty useful

if(digitalRead(4)==LOW){
pitch_trim = -ch2;
roll_trim = -ch1;
}

this makes it so that whatever the controller was sending prior to switching to aut0pilot mode will be the new trim settings, so if you are in steady level flight prior to switching over, you will have good trim values
love the idea of live PID tuning!
I guess you do realize the GPS I suggested is in Australia. I have never dealt with the company tho.
http://www.littlebirdelectronics.com/products/50-channel-gs406-heli...
Earl
Clarence, I would be interested in your ground station and 2 way telemetry to AC. I have full up Jordi system and also his 4 line ground station with XBee. I also have Labview to change things.
Do you have any code you can post yet ?
Earl

RSS

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

Advertisement

© 2013   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service