How many Cogs for IMU.spin?
shanghai_fool
Posts: 149
I have written a demo to look at the variables produced by IMU in OBEX.
My main code runs in 1 cog and PC_Terminal runs in 1 cog yet after I start IMU, cogcounter says I have 4 cogs left.
I thought IMU starts a cog for itself and then starts 3 other cogs (MCP3208, Kalman[noparse][[/noparse]Pitch], and Kalman[noparse][[/noparse]Roll]). I was thinking 6 cogs in all. Where am I going wrong?
Thanks
·
My main code runs in 1 cog and PC_Terminal runs in 1 cog yet after I start IMU, cogcounter says I have 4 cogs left.
I thought IMU starts a cog for itself and then starts 3 other cogs (MCP3208, Kalman[noparse][[/noparse]Pitch], and Kalman[noparse][[/noparse]Roll]). I was thinking 6 cogs in all. Where am I going wrong?
Thanks
·
Comments
One cog reads the ADC to get the analog outputs from the 5DOF unit.
One cog is used for the Kalman filter's.
Two cogs are for the floating point math functions. (these two cogs could be removed if you convert he filter to int math)
Good Day
Jason
Wood
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
IMU does a cognew (cog 3, starting at go) . IMU.go starts MCP (cog4), fmath (cog5), KF (cog6), KF (cog7). fmath starts f32A (cog?).
What am I missing here?
I am trying to determine savings by running an FPU. I was thinking 2 cogs but upon looking closer at the modules, I couldn't figure it out.
It seems that you are running 2 KF's, each on separate cogs. I thought that although only 1 copy of the program was in main memory, it would copy that same program into as many cogs as called for.
I am defiinitely missing some understanding here. Where did I go wrong?
Donald
Take Care,
Jason
Wood
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My IMU uses 1 cog for ADC, one for all float math, and one for all the main / filter / PID / flight code. I'll have to double check that statement, but I'm pretty sure that's correct.
Jason
I am planning to use the FPU to handle the GPS functions so was thinking it could also do the floating point for the IMU. I think it is fast enough to handle it if I can allow it to get access between GPS strings. I have tested the FPU with the 5 Hz GPS alone at 57600 baud and it handles everything OK. On the scope it looks like I get all 5 strings in ~80ms leaving it free for ~120ms. I'm not sure what will happen if I give it additional instructions within those 80ms bursts. Am I correct that the float routines are only used when called by the IMU routine? I think that will be called at about the same rate as the receiver PRF which is ~50 Hz. Some people have suggested that the stability servos/motors work better when updated at a faster rate of 100-150 Hz. I am still working on programming some GPS functions into the FPU so I haven't yet tested it with the IMU working also. The FPU also processes strings much easier. I think the biggest problem is when the FPU is waiting for the correct GPS header. It stays in the loop until it gets it. Of course, the "RNC" string takes the most computations but it seems to handle it even when calling the math from SPIN. Having a sequence of instructions "built-in" as internal functions can only make it faster. I may have to put a semaphore in place.
The number of cogs is important as I am doing several things in this prop and will need all 8.
The IMU works great on the bench. I can't wait until I get it into my plane.
Donald
It looks like you were posting at the same time as I. I have given a quick look at you project and will definitely spend more time on it. I have just been working on getting all the pieces working independantly before trying to put them all together. Since I am new to the Propeller, it is taking some time. I also can't figure out why 1 of the accellerometers is about 7° off level.
Donald
The prop takes a little while to get your head around; I can relate. It's pretty cool once you get the hang of it though. [noparse]:)[/noparse]
Jason
It certainly would be possible for someone to make the changes you suggest.
It would take some work, mostly to understand enough about the details of
Float32Full to be sure that rearranging things would still work when done.