Stingray motor/motion control object posted in obex
Hi all,
Just posted my first object in obex.
As i started recently with the stingray robot and the propeller chip programming, my first project was to create a dedicated·object for easy control of the movements.
The object is written in SPIN and PASM, and doesnt use other objects.
The PASM code doesnt make use of counters to generate the PWM signal as i want to use the counters for future wheel/motor encoders.
To control the motors the object generates a 1Khz PWM signal.
It supports Forward, backward, turning, rotation movements with speed and ramping control.
As this is my first real object please feel free to comment, give tips/hints on the code.
The object can be found under Stingray motor / motion control in the motor control section.
Have fun !
Best regards,
Nico Schoemaker
·
Just posted my first object in obex.
As i started recently with the stingray robot and the propeller chip programming, my first project was to create a dedicated·object for easy control of the movements.
The object is written in SPIN and PASM, and doesnt use other objects.
The PASM code doesnt make use of counters to generate the PWM signal as i want to use the counters for future wheel/motor encoders.
To control the motors the object generates a 1Khz PWM signal.
It supports Forward, backward, turning, rotation movements with speed and ramping control.
As this is my first real object please feel free to comment, give tips/hints on the code.
The object can be found under Stingray motor / motion control in the motor control section.
Have fun !
Best regards,
Nico Schoemaker
·
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
images-team.ro
Does anybody have their Stingray driveable by IR remote?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
It is nice to see customer contributions. This month has seen the start of the Encoder object for the Stingray. Once I have sufficient progress I will start a thread on that.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
·
Great work Nico!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Whit+
"We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney
It will be here soon. Jim E is working on it
Jim
The only issue I was having with it was that I was really trying have the ability to control the motor speeds individually. I tried making a new PUB called TurnWheel(LSpeed, RSpeed) where 'LSpeed' was the left motor speed and 'RSpeed' was the right motor speed. For some reason, when executing TurnWheel with LSpeed = -30 and RSpeed = 30, the Left motor just stops while the right motor keeps spinning at the proper speed. I tried going through the PASM code. I could follow the code down to where the C flag should be set but I had issues fixing it.
Using the PUB code below to control the motor speeds individually, is there anything that I'm missing or why this code will not work? I have not modified the assembly portion of the code or any of the other routines in the SRMotorControl.spin. I tried uploading the .spin code as an attachment just in case.
Any Help would be appreciated.
Thanks,
Chad_C
PUB TurnWheel(LSpeed,RSpeed)
if (LSpeed == 0) AND (RSpeed == 0)
MoveForward(0)
repeat until vCommand.byte[noparse][[/noparse]0] == 0 'Wait until current getCommand is processed by the cog
LSpeed <#= 100 'Limit Speed to 0..100
LSpeed #>= 0
RSpeed <#= 100 'Limit Speed to 0..100
RSpeed #>= 0
vCommand.byte[noparse][[/noparse] 1] := LSpeed 'Set leftspeed to LSpeed
vCommand.byte[noparse][[/noparse] 2] := RSpeed 'Set rightspeed to RSpeed
vCommand.byte[noparse][[/noparse] 0] := 1 'Update flag
Post Edited (Chad_C) : 4/8/2010 2:38:24 AM GMT
LSpeed <#= 100 'Limit Speed to 0..100
LSpeed #>= 0
RSpeed <#= 100 'Limit Speed to 0..100
RSpeed #>= 0
So your -30 is getting clamped to 0. Change those 0's to -100's and see if that works?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out the Propeller Wiki·and contribute if you can.
Thanks Again,
Chad_C
Glad you posted! - no telling how many people you helped. No question is a dumb question. Glad you are up and running.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Whit+
"We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney