Two way telemetry

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!

clarence.pde

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • 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.
    NewSoftSerial | Arduiniana
  • Can you tell me how you r switching between GPS and RF / because both r connected to same UART...................
    Have you used ardupilot atmega328....
  • 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
This reply was deleted.

Activity