Shop OBEX P1 Docs P2 Docs Learn Events
Float to String from 5DOF with Kalman Filter — Parallax Forums

Float to String from 5DOF with Kalman Filter

skybotskybot Posts: 14
edited 2010-03-30 18:11 in Propeller 1
Hi all,
·
I need help from you guys.
I am using 5DOF with Kalman Filter from obex for my FPV project.
The problem is that I want to convert float number from KF to simple degree based numbers.
I think I need some kind·formula to convert the float numbers to degree based numbers something like "1234455666" to "1.5".
Does anyone know how to convert the float data to real degree based numbers?

Comments

  • LeonLeon Posts: 7,620
    edited 2010-03-29 11:50
    "1234455666" looks like an integer to me!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Leon Heller
    Amateur radio callsign: G1HSM
  • skybotskybot Posts: 14
    edited 2010-03-29 18:05
    Here is my test code attached.

    the test screen is like;

    Pitch Angle: -1002112226
    Roll·· Angle: 1122110002
    Yaw· Angle: -1002332003

    How can I convert the data to degree based number like 1.5 or -1.0?
    Please help if·you know.
    Thanks.
  • John AbshierJohn Abshier Posts: 1,116
    edited 2010-03-29 20:06
    The Propeller Library contains a FloatString object that will convert a float to a string representation.

    John Abshier
  • LeonLeon Posts: 7,620
    edited 2010-03-29 20:53
    He's getting integers, though. I can't see why he needs a float conversion.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Leon Heller
    Amateur radio callsign: G1HSM
  • John AbshierJohn Abshier Posts: 1,116
    edited 2010-03-29 21:37
    Leon, from looking at the code I think that the Kalman Filter is returning a float. The demo program just prints it out as an integer using the dec method.

    John Abshier
  • LeonLeon Posts: 7,620
    edited 2010-03-29 22:14
    OK. The numbers he had in his post confused me, as they were integers.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Leon Heller
    Amateur radio callsign: G1HSM
  • skybotskybot Posts: 14
    edited 2010-03-30 16:42
    Does any one know how to convert the 10 digit floating number to degree numbers?
    I think I need some formula to present the degree.
  • John AbshierJohn Abshier Posts: 1,116
    edited 2010-03-30 18:11
    It may be lying but this is what the code says:
    pub get_angle
    {{
    Return the current Kalman Filtered angle as a Float in Degrees
    }}
    return angle

    So IMU_Test should be printing out (I only checked pitch) the angle in degrees. All the answers are in the code.

    A comment from IMU_RANGE also indicates degrees
    {{

    ┌───────────────────────────────────────────┐
    │ Convert gyro rate to deg/sec │
    │ │
    │ My Setup │
    │ 2mV/deg/sec │
    │ 500deg/sec │
    │ │
    │ 0deg/sec=2048 │
    │ 500deg/sec=4096adu=2048 + 2048 │
    │ each 1deg/sec = 2048/500 = 4.096 │
    │ each 1=1/4.096deg/sec=0.244140625deg/sec │
    └───────────────────────────────────────────┘



    }}

    John Abshier
Sign In or Register to comment.