The function "servo_get" can't stored more than 7 servo's degree
bsnatu
Posts: 7
I write the program with Propeller C to control the Hexapod robot.
But it still can't work...
Is this function just only can store 7 servos' degree?
https://code.google.com/p/propsideworkspace/source/browse/Learn/Simple Libraries/Motor/libservo/servo.c?r=4718b5a6c19f4be616a801772b1f43d896c82544&spec=svn4718b5a6c19f4be616a801772b1f43d896c82544
How could I slove it?
But it still can't work...
Is this function just only can store 7 servos' degree?
https://code.google.com/p/propsideworkspace/source/browse/Learn/Simple Libraries/Motor/libservo/servo.c?r=4718b5a6c19f4be616a801772b1f43d896c82544&spec=svn4718b5a6c19f4be616a801772b1f43d896c82544
How could I slove it?
Comments
Here is a test library that runs up to 14 servos, and you can use it with the existing library to get up to 21. It should be pretty easy to modify it for 28, but I'm out of time until later next week. The one bug I know of is that the servo14_ servos need to be initialized before the servo_ servos. Please let me know if you find any more. Aside from changing servo to servo14 at the beginning of function names, the rest of the API is the same for both libraries.
These instructions assume you have SimpleIDE v0.9.43. If you have an older version, update at http://learn.parallax.com/propeller-c-set-simpleide. Before running the installer, make sure to rename your existing .../Documents/SimpleIDE folder so that when you run SimpleIDE, it'll copy the latest SimpleIDE folder into documents. If you have a Mac, you may also want to Tools -> Properties -> General -> Clear Settings -> OK then restart SimpleIDE.
Next, just copy the libservo14 folder from the attached zip to Documents\SimpleIDE\Learn\Simple Libraries\Motor. If SimpleIDE is open, you'll need to restart it. Then, make sure you are in Simple View (default view), click New Project, name & save, paste code below in, and run. It's controlling 20 servos.
Regards, Andy
But I have other question, in this example http://learn.parallax.com/propeller-c-functions/multicore-example
When I first time call the function "cogstart", it will use "cog2" not "cog1."
So, it means in the main function the chip use 2cogs, "cog0" & "cog1", right?
what's reason will cause that?
But when I use that the cog will start on cog3, 4....for six legs, the 6th leg cog=-1, so it can't work.
If I cancel the print & float point the cog will start on 2 or 1?
Oh...My advisor hope me can try what different between 1 cog and 6 cogs, which is better when the hexapod robot walking.
It seem like I don't need 6 cogs for the robot.
@bsnatu,
The current solution uses a total of three cogs, one for executing the main function (orchestrating motions) and two for controlling the 18 servos. That's because servo14 and servo each use one cog apiece. If your adviser is suggesting that you develop a single cog implementation and compare to the three cog implementation, it is doable and sounds like an interesting project.
@kuroneko,
Thank you very much for pointing out the out of range bug. I'll fix it and post the update soon.
Andy
To run the 28 servo signal example below, make sure to remove the libsrevo and libservo14 (if you have it) folders from ...Documents/SimpleIDE/Learn/Simple Libraries/Motor. Then, copy the libservo and libservoAux folders from the attached zips into that folder. If you have SimpleIDE running, make sure to restart it. Then, click New Project, name and save it, paste this code in, and click Load EEPROM & Run: