Shop OBEX P1 Docs P2 Docs Learn Events
Memsic2125 theta question — Parallax Forums

Memsic2125 theta question

MacGeek117MacGeek117 Posts: 747
edited 2006-08-24 04:00 in Propeller 1
I've been trying to Spin without a Prop and have moved on to the Memsic 2125 driver, but my project needs the theta values for forward, back, left, and right. Could someone please post the values for those directions?
RoboGeek

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I reject your reality and subsitute my own!"

Adam Savage, Mythbusters
www.parallax.com
www.goldmine-elec.com
www.expresspcb.com
www.startrek.com
·

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2006-08-23 18:30
    RoboGeek,

    I am not exactly sure what you are asking?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • MacGeek117MacGeek117 Posts: 747
    edited 2006-08-23 18:40
    In the NV column, "No more coffee spills", the brad measurements for 0 degreees, 90, 180, and 270 degrees. I would like to have the same for the raw theta values.
    RoboGeek

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "I reject your reality and subsitute my own!"

    Adam Savage, Mythbusters
    www.parallax.com
    www.goldmine-elec.com
    www.expresspcb.com
    www.startrek.com
    ·
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2006-08-23 19:46
    RoboGeek,


    BRADS are "Byte radians" ... Simply a way to represent 0-360 deg within a BYTE value ranging from 0-255

    BRAD = (DEG / 360) * 255

    ..or for integer math...

    BRAD = DEG * 255····· <--- For the Propeller (360 * 255) would not be an overflow problem
    BRAD = BRAD / 360


    Applying the above formula...

      0 Deg = 0 Brads 
     90 Deg = 63 Brads 
    180 Deg = 127 Brads 
    270 Deg = 191 Brads
    


    The RAW theta values in the object I posted are returned as a 32-bit value but need to be shifted right 19 places
    to create a valid 13-bit value that ranges from 0 to 8192 ($0-$1FFF)

    deg := acc.theta >>19

    Brads := deg * 255 / $1FFF

    13-bit degree    0 =   0 Brads    '  0 Deg 
    13-bit degree 2047 =  63 Brads    ' 90 Deg
    13-bit degree 4095 = 127 Brads    '180 Deg
    13-bit degree 6143 = 191 Brads    '270 Deg
    



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • MacGeek117MacGeek117 Posts: 747
    edited 2006-08-24 04:00
    Thanks, Beau!
    RoboGeek

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "I reject your reality and subsitute my own!"

    Adam Savage, Mythbusters
    www.parallax.com
    www.goldmine-elec.com
    www.expresspcb.com
    www.startrek.com
    ·
Sign In or Register to comment.