
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...Code:
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...Code:
#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.
Code:
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.
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.
No, it's a DEOK motor controller/H-Bridge.
https://www.amazon.co.uk/gp/aw/d/B00M1JZ7O2/ref=yo_ii_img?ie=UTF8&psc=1
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
This is a quote from DJ talking about the script example he posted in the link on post #1 above...
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.
Alan
Anyway, thanks.
Anyway, thanks guys, and Dave especially for giving me a nudge in the right direction.
@Alan.
Did you get to play around with the L298 ramping idea with Roli?
Not yet.
Alan
Code:
and have similar scripts for reverse, turning differential left/right and U turn left/right. This works great, and gives a good effect, both ramping up and ramping down. But here is where I need the help. I also use the iPhone sensor stream control for drive movement as well, and use the movement commands such as Forwards() etc in a custom movement panel. So an example of the movement control panel scripts are as follows...
Code:
and the "STOP" button to ramp down to "Stop"...
Code:
This is all good. But the issue arises when I use a reverse or turning ramping script. For example, reverse ramping "up" is no problem... but when I press "STOP" to ramp "down" to stop the motors, it will obviously still use the "ramp down" from forwards script which causes problems, and excess strain on the gearboxes instantly changing direction at speed. So I need a "STOP" script to do a if moving forwards, ramp down from forwards. If moving in reverse, ramp down from reverse. Same for turn left and turn right.. I've had a play using "IF" and "ELSEIF" commands in various testing scripts, but have not had much success getting it to do what I need it to.
Like I said, I have a ST2x25 coming soon, but I still have a couple of robots that use the motor controllers this thread is talking about, so having a solution for this would be very useful... and maybe for others too.
Any help anyone can offer with with this custom Movement Panel ramping "STOP" script, would be appreciated.
Alan
I did think of setting the direction commands as variables might be the way to go, and after my other try's at composing a working script, I did start to write one using this idea but I gotta be honest, I hit a wall pretty early on as I'm not sure how to fully write the script. I don't normally ask for script examples as I like to try to work it out for myself, but in this case I'd be grateful if someone could post a "stop from forwards" and "stop from reverse" example as I'm at a loss of how to write it. I can work out the turning scripts from there.
Thanks.
Code:
The your stop script, insert your ramp down code in the appropriate sections of this script:
Code:
Alan
@Dave.
Yeah, when I tried this on my Roomba a while back, I never really got a great effect for ramping down either. But in this situation it actually works quite well. I played around with the sleep() values to see what worked best, and 150 seemed to be the magic number for both ramping up and down for this particular setup. I'll do a quick video demo of the ramping in action and post it on my E4-B4 showcase.
The motor controller this thread is about has an automatic braking function which stops the motors dead, and I was always worried that E4 might tip over from or to maximum speed. This is a great help.
Thanks again guys.
Steve.
Alan
Thanks again.