I have an AL5D robot with the ssc-32 board, bot board II, and basic atom pro. I switched the original servo with a 360 servo, and now the robot spins contiuosly and doesn’t respont to commands from the ps2 controller. I’m sure it has something to do with the programming, but neither I nor my partner know antything about writing code. We were using the code found at www.lynxmotion.com/images/html/build091.htm
This code did work for a while (until my partner tried to fix it), but the base controls were too fast and touchy. If someone could please either write me a working code, or point me in the direction of one, I’d be eternally thankful.
There is no fix to this. The CR servo is not positionable because there is no feedback. No code changes will fix this.
That being said, you will be able to make it a bit more usable with a few code tweaks. In order to stop the servo from turning constantly, find this line in the code:
Base_PulseDef con 1500
Hitec servos will spin clockwise with a higher number, and counterclockwise with smaller numbers with ~1500 being centered. Unfortunately, this value differs from servo to servo. Change the 1500 to another number. You shouldn’t need to go more than 100 from 1500. Keep plugging in values until the spinning stops.
Next, find this bit of code:
ZCoord = DualShock(3) - 128
if ZCoord > DeadZone then
ZCoord = ZCoord - DeadZone
elseif ZCoord < -DeadZone
ZCoord = ZCoord + DeadZone
else
ZCoord = 0
endif
and replace it with this
ZCoord = DualShock(3) - 128
if ZCoord > DeadZone then
ZCoord = ZCoord - DeadZone
elseif ZCoord < -DeadZone
ZCoord = ZCoord + DeadZone
else
ZCoord = 0
Base_Pulse = Base_PulseDef
endif
That should at least help. I haven’t tested this, but it should turn when you move the joystick and stop when you stop.
It seems to be responding better, and we can now change the direction of the spinning. We are still trying to find the center but are getting close. Is there any way to reduce the speed? It’s incredibly fast.
For the typical DIY continous rotation servos, speed control only happens for practical purposes within ±100us of the usual 1500us neutral value. An example would be 1505us or 1495us for fairly slow rotation.
What’s the make and model of the 360 servo. Premodified or home brew? What do you have there?
The servo is a lynxmotion HSR-1425CR, it is currently in its stock form.
Ah, right. Should’ve guessed about that. Find this bit:
if ZCoord or NeedServosOn then
Base_Pulse = Base_Pulse + ZCoord / 8
if Base_Pulse > Base_PulseMax then
Base_Pulse = Base_PulseMax
elseif Base_Pulse < Base_PulseMin
Base_Pulse = Base_PulseMin
endif
serout SSC32,i38400,"#",DEC BasePin,"P",DEC Base_Pulse," T100",13]
endif
and change it to:
if ZCoord or NeedServosOn then
Base_Pulse = Base_PulseDef + ZCoord
if Base_Pulse > Base_PulseMax then
Base_Pulse = Base_PulseMax
elseif Base_Pulse < Base_PulseMin
Base_Pulse = Base_PulseMin
endif
serout SSC32,i38400,"#",DEC BasePin,"P",DEC Base_Pulse," T100",13]
endif
The PS2 joystick will return a value from -128 to +128, which should make the base be a bit more controllable.
Each step seems to be making it work better more and more but I still can’t seem to get it centered and I still have the problem of it moving after releasing the joystick. So is their any ideas or do we have to learn how to deal with it?