DIY Drones

Hey guys,
my problem is that i use the ublox gps, and my Xbee's module max baud rate is 9600 (100mW version). I tried changing the code a bit to:


void loop()//Main Loop
{
navigation();
stabilization();
catch_analogs();
Serial.begin(38400);
decode_gps(); //Reads and average the GPS when is doing nothing...
Serial.begin(9600);
print_data(); //Function localted in "System" tab.
...

It works, the gps locks, but i think it messed up the communications... it seems unstable. like some of the data gets lost. what do you think? shuld the change work?

is it possible to change the baud rate of the ublox to 9600? i found explanations on how its done but with differnt gps modules...

I am verry new to this, so any help i'll get will be verry apriciated! thanks!

Share

Reply to This

Replies to This Discussion

You can change the uBlox baud rate using uCenter, but I don't think you can do 4Hz updating, which is the whole point of the uBlox, at 9600. I'd upgrade your Xbees instead.

Reply to This

Thanks for the answer. ok, its probably not a good idea to lower the gps baud rate, and the best solution is a new Xbee module. but what about changing the ardupilot baud rate before sending the telemetry? why didn't the code i wrote worked?

thanks again.

Reply to This

Not sure. Maybe it messes up the serial buffer?

Reply to This

The problem with your code is that the Serial.begin(38400) is in the wrong place. You could be receiving GPS while the timer is set to 9600. GPS comes in asynchronously. It does not wait for your decode_gps() line.

This should work:

void loop()//Main Loop
{
navigation();
stabilization();
catch_analogs();
decode_gps(); //Reads and average the GPS when is doing nothing...
if (data_update_event == 3){
Serial.begin(9600);
print_data(); //Function localted in "System" tab.
Serial.begin(38400);
}
...

Reply to This

You'll notice this serverly limits your output to once per GPS read. That moment is the only time you can be sure that you won't stomp on the incoming GPS signal.
You could also just use a Software Serial port. Read more here: http://arduiniana.org/libraries/NewSoftSerial/

Reply to This

i tried it, indoor where the GPS cant get a lock, and i got one telemetry message, and thats it. the autopilot stoped sending messages...

i'll get myself more femiliar with the code before continuing making changes... thanks for the help thogh!

Reply to This

Yes, that code only fires when the gps gets good data. The software serial is the way to go.

Reply to This

oh! i miss-read your code! i didn't add the data_update_event condition! now i understand that without it colisions betwin the gps and telemetry will take place...and i don't need fast telemetry. some telemetry will do. 4Hz is more then enough. i'll try it and report back... thanks! :)

by the way, the code is with lots of comments (which is great!) but is there any more documentation/explenations for the software architecture? thanks again!

Reply to This

RSS

© 2009   Created by Chris Anderson

Badges  |  Report an Issue  |  Privacy  |  Terms of Service

Sign in to chat!