Moderator

ArduStation for ArduCopter

I am working on adding in ArduCopter support for ArduStation.

 

One big problem I am having is parsing the CSV string.  From the documentation on the internet sscanf() allows me to parse a string, however, it only seems to work when I try to parse a CSV containing values which are integer and it doesn't work when parsing values that are float

 

This is the line of code

sscanf(buffer, "%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f", &gyro_roll, &gyro_pitch,&gyro_yaw,&accel_roll,&accel_pitch,&accel_z,&roll_err,&pitch_err, &roll_angle, &pitch_angle, &yaw_angle);

 

buffer is the line of CSV received from the "Q" command on ArduCopter.

all variables are of type float

 

If I replace the %f with %d and make all values and variables integer it works fine.

 

I'm quite new to programming Arduino, and I know very little C and C++, most of my coding is done in Obj-C

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

Join diydrones

Email me when people reply –

Replies

  • Hi all .....

    May I ask experts ... In EZ-ground-station we connect the ground station with audio port in VRX (video receiver) to get the GPS data for tracking antenna pointing ...

    What is the same line in ARDU-STATION ??
  • Hai Tran:

     have you had any luck with the Ardustation / Arducopter. I would like to us it on my Quad and I am flying the ACM code. What firmware are you using ?

     

    Thanks Jack

  • Moderator

    Still can't figure this out, but I managed to do a work around.

     

    I parse a float ie 123.45600 as two integers, so I get

     

    a=123

    b=45600

     

    Then I divide b  by 100000 to give me c=0.45600

     

    Then I reassemble a+c

This reply was deleted.

Activity