
Hey Lumpy (or anyone who can advise). I'm addressing this first to Lumpy because I know he is using and working with the Kangaroo X2 / Sabertooth setup. If anyone has some insight please chime in.
Anyway, as mentioned in other posts I'm working through issues with my Kangaroo X2 / Sabertooth setup where I'm using two DC motors that have pots for feedback and limit switches. I now have both motors responding through serial commands from ARC. I had an issue where I was continually getting error codes at power up and would have to power cycle the unit to get it to respond to serial commands. However I found I had to make sure the Sabertooth/Kangaroo powered down completely when the robot and EZB was switched off and then powered up after the EZB was powered up.
My issue now is trying to get the speed ramping feature of the Kangaroo to work. There are different ways to set up the Kangaroo; Velocity or Position control. I cant get the speed ramping to work when serial commands are sent from EZB in either control setting. However, I can get ramping to work nicely in Velocity but not Position tests when using the "Live Test" section of the Describe software used to set up the Kangaroo. When doing these test I'm attached directly to the Kangaroo with a Serial Adapter from a USB port of my laptop and EZB is not connected.
Without any ramping my motor will jerk to full speed and stop suddenly. I've e been working with Dimension Engineering on this for weeks but it's been painfully slow. The only way I can get help from them is through e-mail and it sometimes takes days for them to respond. Then I'll get a one sentence question or answer like "sounds like you need to make sure to upload your settings and reboot" or please send us a copy of your settings. This must be a newer product with limited users. I've found no community forums and few people posting info on this board.
One other thing. What is the best way to set servo control to work independently on the Sabertooth/Kangaroo's second motor channel? So far the only way I've been able to get it to work is if I start the first motor Chanel with a servo command and don't release it. I am using a second cable attached to a second digital port on EZB and attached to S2 of the kangaroo. I'll call that port when I want motor 2 to respond to a servo command.
I must say it is a great little board and from what I've been able to set up, it works great. I like the idea of being able to send servo commands to control my DC motors. Very precise and quick. If I can get this speed ramping issue figured out it will be an excellent addition to my B9 robot motor control.
Humm, that's a cool idea. Maybe some day when the team get more time they could look into this. IMHO ramping is an area that really needs to be addressed not only with EZ Robots but with other companies that provide motion control boards. It seems like it's just an after thought or partially implemented. I may be wrong about all this but I haven't found much where this is a concern. With people now building larger and more human like robots I imaging the need to get them to move more naturally is going to be in demand. They all really should address this lack of support to stay ahead. The kangaroo does do adjustable ramping but only in Velocity Mode unless you do involved scripting that most people (like me) don't know how to do. Velocity Mode is good for RC controlled bots and cars that just drive forward, reverse and turn. I need position and speed control. DE says their Kangaroo doesn't do ramping in Position Mode unless you script. WHY?
The only way I was able to get ramping to work on my DC Motors with ARC was to send gradual increased or decreased PWM commands. That actually worked very nicely. That script looks like this:
To be honest I got smoother ramping with simpler EZ code (as seen above) then I am getting with the Kangaroo script I just made over serial. I'm still not really convinced my new setup using the Sabertooth/Kangaroo is better then what I had with a H-bridge and a pot attached to an ADC port on the EZB. The Sabertooth is more rugged and top quality and the Kangaroo does do all the work that EZB used to do. Added to that, I now only use one Digital port on the EZB and send all info with a serial command. Also, I can now use servo commands but I found if I mix servo commands and serial commands using the same Digital port on EZB everything will lock up and I need to reboot everything. So it's one or the other. With servo commands I have no ramping. It's all or nothing.
Dave, I do not use Sabertooth or Kangaroo controllers, so have little knowledge of them, but here are some thoughts.
I guess that your main problem is not getting the position feedback so the script does not know when to start ramping down as it approaches the target position. The lack of serial comms (read) on the V3 is a real problem sometimes, but it should be solved when the V4 arrives, as it has bi-directional comms. You really need a thing called analogue PID (proportional-integral-derivative) controller see
en.wikipedia.org/wiki/PID_controller
With a controller like this using PID the motor would move very smoothly from start position to (accurately) the target position thanks to the on board PID algorithm. I use the Motor Mind 3 controllers with great success on the EZ:1 robot using serial PID control, the robot accurately moves from one location to another. Serial mode uses encoders but the mode you need is analogue (using positional feedback resistor). Here is a link to the Motor Mind 3
www.solutions-cubed.com/content/Downloads/MotionMind3Docs/MOTM3DS_6.pdf
One thing to note, I found that PID is quite complicated and very difficult to set up properly, it may be worth waiting for the V4 as PID may be a steep learning curve for you. Once you get the V4 with bi-directional comms you could roll out a simple script like
In the above example the first 10% of travel is slow ramp-up with the next 80% of travel being full speed and the last 10% being slow ramp-down. The ramp up/down percentage (10% in the example) may need to be changed to suit the particular motor setup that you have.
I hope I have interpreted your problem correctly and this has been of some help.
Tony
@Tony,
Thanks so much for sharing your thoughts here. You've confirmed what I thought the problem may be. I really have been hampered by not having two way serial communication between EZB and the Kangaroo. That and the lack of good documents or active Kangaroo community forums and my lack of C++ script writing knowledge has made this a true struggle with slow progress.
Also thanks for the tip and link to the PID board. I don't think I'm up for another steep learning curve just yet so I think I'll wait for my Pre-ordered V4 EZB. Hopefully it will be here in a matter of weeks. That sounds like the natural solution. Your outline of a script will help a lot when I get back to this point.
I the mean time I'll keep plugging away. Heck, even a blind squirrel finds an acorn once in a while.
I haven't had chance to check this topic for a while (and even now I've just quickly skimmed over it), glad the script got you going
On the servo commands and no ramping, you could use scripts to simulate ramping by moving the position step by step with sleep between... Something like;
Or if the ServoUp and ServoDown commands work with it;
The above would need more work, using Tony's algorithm and some error checking along with some code to make sure that moving the servo up by $steps wont push it over the $new_position - something like IF(GetServo(D1) + $steps > $new_position).
It may be simpler than that, I will admit I didn't put much thought in to this one but the concept is the point I am trying to get across and hopefully I have done so
@Rich, Your best guess without much thought is a whole lot better then my hours of slight progress. I did get ramping to work like this on other applications with PWM commands. I didn't think about trying it on servo commands. Thanks once again!
@Dave, with my algorithm I need to add the following, because of the lag time it takes for the EZ-B to read the position (back from the Kangaroo), it is likely that the actual position will "over shoot" when the equality checks (10% in the example) are being made, especially when the motor is on full speed (like when going to pos_3) etc. So the check should not be for equality, it should be ">" (more than), this will allow for any over shoot.
Dave, when the V4 is available, I will write this algorithm into an EZ-B script for you, if that will help.
Tony
Thanks Tony... that will help me as well. I just picked up a couple of kangaroo boards myself...
@Tony, Once more you've proved what a great guy you are. I couldnt get most of this stuff to work the way I want to without people like you offering help. I intend to learn this type of programing soon so I dont have to relay on good people like you so much. In the mean time I will gladly accept your offer of help. When the V4 arrives I'll contact you. Fit it in as your scheduel allows. Many thanks!
@Richard, When you start to install your Kanagroo please contact me if you like. I'll gladly share what I've learned so you dont have to struggle through what I have. It's a good PID board but documentation sucks and it seems to me that what they do have is geared towards the more advanced among us.