DIY Drones

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!

Share

Attachments:

Reply to This

Replies to This Discussion

As of right now the system will not work with the Groundstation developed by Jordi because it is now a request based system, so the ArduPilot is not continuously broadcasting (and the format of the broadcast is different).

I am going to wait to post the ground station code, but attached is the modified ArduPilot code and below are some of the commands. If I am not mistaken there are some obsoleted commands in the code as well, if you so desire you can look through and find them.

commands:
-print tele data: @[ID]P$ (so if the ID is 1 the command is "@1P$"]

-print waypoint(s) : @[ID]L[list start],[list end],$ (so to print waypoints 0 through the command would be "@1L0,8,$". If you are in EEPROM mode the waypoint will be printed from EERPOM, if you are in RAM it will print from RAM)

-set waypoint @[ID]S[wp number],[lat],[lon],[alt],$ (this sets the wp listed to the new value, without changing any other wps in the list, this command ONLY works for RAM)

-insert waypoint - @[ID]I[wp number],[lat],[lon],[alt],$ (this is similar to set, but it shifts all the other wps, so what used to wp 2 is now 3, etc)

-delete waypoint(s) - @[ID]E[list start],[list end],$ (this does shift as well, so WP 10 becomes 9, etc)

-switch waypoint mode - @[ID]M$ (goes from RAM to EERPOM and the other way as well). Returning a Zero means you are in RAM mode

-go to waypoint - @[ID]G[wp number],$ (this sets your current wp to w/e you tell it too, works in EEPROM and RAM but the EEPROM might screw up if a reset happens quickly after this command I think)
Attachments:

Reply to This

  • 1
  • 2

RSS

© 2009   Created by Chris Anderson

Badges  |  Report an Issue  |  Privacy  |  Terms of Service

Sign in to chat!