Let's Make Robots!

Servo control in Java

Hello everyone. I am making my first robot, and it's going to be a hexapod.

I have trouble with finances so I don't have most of the parts yet, and I have to make things work with parts I have before I can get more money from my club for other stuff I need.

I have 3 CARSON CS-3 502015 servo motors and Intellibrain board (I've got it for robotics competition). I program it in Java becouse it doesn't support anything else, and compiler I use is RoboJDE.

Now for my problem. RoboJDE doesn't give code for commands, only explanation on how to use them. And there is only one command to use servos, which accepts integers from 0 to 100. When it gets 50 servo is on the middle, and when it gets 100 or 0 servo is at 45° to on side. I need a code for Java that controls servos so I can use them in atleast 180°, and preferably more precisely than 1° steps. I have never worked in Java before, except for competitions with these robots, but I know how to work in C, if that helps.

Thank you for your time to read this, and I'm sorry for my bad english, it isn't my main language.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I would suggest you look at the java primer that they have on their page. They also have tutorials and a full api class doc for you to look through.

If you need to do more with your server, you could create your own class and use the pulsout method that you could fine tune to your needs. I know it's used on the parallax javelin stamp, so don't see why that wouldn't work here. You might also be able to look on their forums to see how they did it and use it as a starting point.

I've been on their page, but they have only 2 commands that you can use with servos, one is setPosition that is inprecise and other is Off, which doesn't realy do what I need. And they don't explain anything on how their classes work, only what they do.

I've searched for pulsout and tried inplementing it in my program, but it says it doesn't know any method named pulsout, and I couldn't find how to add libraries or something so that RoboJDE recognizes it. Every example I found was in picaxe or something simmilar.

Thank you very much for your help, I see this is a realy nice comunity, one worth staying in.

This was in the resources section for the intellibrain, the device you said you had. 


You should be looking their for resources...

My mistake, it was pulse. Check the api for all commands.....


Thank you very much, it's working now! Now I only need to translate my code from simulator in C to motor in Java...