Society of Robots - Robot Forum
Software => Software => Topic started by: strat321 on February 18, 2014, 03:24:30 PM
-
I am attempting to control a servo that is compatible with ICS 3 and is only capable of being controlled via a dedicated serial signal. I assume this is done via UART. Could someone please walk me through controlling a dedicated serial servo?
-
See if this walkthrough (http://robosavvy.com/forum/viewtopic.php?t=7862) can be adapted to your needs. It also links to this protocol description pdf (http://robosavvy.com/RoboSavvyPages/Support/Kondo/KHR3HVDocs/RCB4_SerialProtocolCommands_to_PlayMotions.pdf).
-
Is there a way to implement this using the axon ii? I'm kind of a beginner with serial communication. I'm not quite sure where to begin in controlling this servo. If I post the code that I have used with a PWM servo (successfully) is there anyway you would be able to help me understand how to port it to this serial protocol? It would be much appreciated. Essentially I have a flex sensor (analog) that I want to use to control a servo
-
Instead of using the "Servo" library, you want to use the "SoftwareSerial" library.
And, to come up with the bytes to send to the servo using the SoftwareSerial library, you should read that PDF (and perhaps go through that walkthrough.)
-
SoftwareSerial lib from Webbot? That walk through and PDF seems to be intended for RCB4, however as you pointed out, the servo I am using, (http://www.robotshop.com/kondo-krs-6003hv-ics-servo-motor-red-version.html (http://www.robotshop.com/kondo-krs-6003hv-ics-servo-motor-red-version.html)) uses the ICS 3 protocol.
-
My cursory search didn't yield a lot of english language documentation, but the walkthrough I posted for the RCB4 is based on the same LibKondo library I posted in your other post. The LibKondo library works with RCB4 and ICS. As I don't have a Kondo servo and most of the documentation a quick search yields is in Japanese, you might need to tinker with what information is available to make it work. If you need some practice with serial communications you can use your Axon's USB to communicate with your computer. In fact there are a couple of UART tutorials on this site under programming. It might be worth shelving those servos until you have a little more familiarity with programming and/or can find better documentation for them.
-
This may not be possible but is there anyway to replace the internal board of the kondo with a pwm servo? If not, from the walk through you sent me, is it simply a matter of placing the libkondo ics.c (replacing the ftid part with the serial communication) and then sending the bytes from my main project.c via the uart print/write? I think I may be able to code it... I'm just not exactly sure where or how to start. It is an extremely important project and I must learn how to complete it. Your assistance is greatly appreciated.
-
A (very) quick look at the ICS and RCB do not appear to be direct replacements, but the source code seems to have all the comments needed to be able to figure out how to use the library. For example:
/*-----------------------------------------------------------------------------
* Set speed parameter of the servo
* id: the id of the servo 0-31
* stretch: the desired speed 1(2)-127(254)
* Returns: the speed as reported by the servo (>= 0), or < 0 if error
*/
int ics_set_speed(ICSData * r, UINT id, UCHAR speed)
As you can see, you can use the ics_set_speed command to set the speed of the servo with correct id. You should be able to communicate with the servo directly using UART commands but you would need to look at the libkondo library and try some experiments to see what you can manage.
As for replacing the internals with a pwm servo, it may or may not be possible. I would venture that it would be a lot more trouble than it's worth to try to swap out the boards.
-
Ok.... so the syntax would appear to be ics_set_speed(ICSData * r, UINT id, UCHAR speed)
Except I don't understand how the structure ICSData operates or what r is as it is never defined