United Kingdom
Asked — Edited
Resolved Resolved by Dave Schulpius!

Motor Controller Ramping Script Help

E4-B4 has been a little neglected lately, so or been playing trying to give him more graceful drive movements, so I'm looking for a little help with a ramping script to be used in a custom Movement Panel for my motor controller. I read a thread some time ago where DJ posted that ServoSpeed() commands can be used, so I have tried the following script for moving forwards...

servospeed(d3,5)
servospeed(d1,5)

PWM(D3, 0)
PWM(D1, 0)

Set(D2, Off)
Set(D0, Off)

PWM(D3, 65)
PWM(D1, 65)

I have setting tried different servo speeds, but the ramping part does not seem to work. I have also had a go at converting @Rich's Sabertooth ramping script, but could not get my head around where I needed to make the changes. Can anyone help me with a ramping script to ramp up when I hit forward or reverse, and ramp down when I hit "Stop" for the following movement commands...

#Forwards
Set(D2, Off)
Set(D0, Off)
PWM(D3, 65)
PWM(D1, 65)

#Reverse
Set(D2, On)
Set(D0, On)
PWM(D3, 65)
PWM(D1, 65)

#Stop
Set(D2, Off)
Set(D0, Off)
PWM(D3, 0)
PWM(D1, 0)

Thanks.


ARC Pro

Upgrade to ARC Pro

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

#1  

I may be way off base here, but if I were trying to get a servo to ramp up I would try:


$TopSpeed =65 #Whatever top speed number would be
$NextInc =1
repeatwhile $NextInc <= $TopSpeed
  servospeed(D0,$NextInc)
  servospeed(D2,$NextInc)
  sleep(500) #Just a guess. Whatever rate of ramping you want.
  $NextInc++
endrepeatwhile

If the ramping is too slow incrementing by 1 you could increment $NextInc by a larger number. Though probably changing sleep time would do the trick.

I haven't actually tested this. Just off the top of my head.

Same for ramp down but start at current speed setting and decrement until minimum/stop speed setting is reached.

United Kingdom
#2  

@WBS.

Thanks for the reply. I'm not sure if that's the kind of thing I'm looking for, but it could be. Not sure how to use it with my direction commands, but I'll have a play with it to see if I can make something of it (unless someone comes up with another solution).

Thanks, and happy holidays.:)

United Kingdom
#3  

Bumping thread as I still need help with this.

#4  

Steve, are you using a Sabertooth?

#6  

The servospeed only adjusts ramping on continuous rotation servos. Something like the Sabertooth ramping script is needed for a PWM H-bridge (although interestingly, if you drive your movement with a joystick/game controller it ramps the PWM so maybe this is something DJ could just add to the Movement Panel to do when driven by the keyboard or script commands too)

If you are using a Sabertooth, I am pretty sure you can turn on Ramping with Describe software. Now that I finally have my basement back and getting my tools unpacked, I am finally going to wire up my Sabertooth to some wheelchair motors and start getting some hands-on knowledge on this.

Alan

United Kingdom
#7  

Hey Alan.

This is a quote from DJ talking about the script example he posted in the link on post #1 above...

Quote:

For PWM H-Bridge, simply use the ServoSpeed(). As in my above example. The servospeed() will ramp the speed between PWM's.
It looked to me that this should work with the motor controller I'm using as it uses PWM as well. It will be a couple of months at least before I get my hands on a sabertooth, so I'm stuck using the motor controller in post #6 for now.

#8  

Hmm... I'll play with that on my Roli which has an LM298 H-Bridge and see if I can figure it out. As usual, no guarantee on time. Lot's to do and not enough hours in a day to do it...

Alan