Welcome to the Parallax Discussion Forums, sign-up to participate.

AwesomeCronk
Posts: **833**

in Robotics

I am really hedgy on the Elev-8. Mostly because of the firmware. I see that it is written in c++. Preferring Spin, is there an available Spin version of the firmware?

Returning to Spin after two months of not coding micros at all, forgetting to use :=

## Comments

408Mike

8331,291408As far as I know there is no fixed point calculation to do Quaternions. Also you need to do Euler angles to determine orientation.

It is possible to use a coprocessor chip to do this math and simplify some of the calculations such as BNO055 or EM7180.

Still you will need assembly code or C code to do the SBUS or PPM input from the radio receiver not to mention the PWM for each motor output.

Mike

1,291When one speaks of writing something in Spin, it's implied that hardware drivers will be written in PASM and not Spin. So I'd mostly reuse all the same PWM, SBUS, PPM, serial, etc. drivers that are written in Spin/PASM that are used in the current firmware (although I vaguely remember that I had found a way to save a cog or two by combining some cogs). I'd just rewrite the main control code to Spin and the math code to a fixed-point vector math VM that runs in a cog. I already have a small collection of fixed-point multiplication routines that I would use as a starting point for the math coprocessor cog I would write, which would of course be able to do vectors, matrices, quaternions, Euler angles, and all other necessary math. An external coprocessor chip would be too complicated because it'd involve adding components to the board, whereas the Prop already has plenty of cogs, and you'd have tons of overhead communicating with it instead of just having a cog run a script.