ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I want to write a program to control a robot arm (a Lynxmotion 5, specifically) using the serial port. Now, I've often been told that serial port programming is a lot easier using Java (with the javax.comm package) as opposed to using C.
I was wondering if you guys had any suggestions or experience to share. Another thing to keep in mind is whether the java code will later be able to be used as part of a device driver which I may write for the same robotic arm.
If you are planning on writing a device driver for Linux then it must be written in C.
However... if the robot speaks RS-232 then I don't see a good reason for writing a driver in the first place. All you really need is a user space program that users the serial driver already in the kernel. In this case it comes down to a matter of personal preference, as it is quite easy to write to the serial port driver in both C and Java.
Hmm. The driver can provide some additional functionality I think. For example, I can have control timing in kernel space so that I can have 2 servos moving but appearing to move together (I guess like multi-processing). Of course, a side reason is that it'll give me an excuse to write a driver and thus understand the kernel better
It's not that nice to program in kernel space. And the only reason to do that is... to modify or improve the kernel. Now I understand that you want to learn, but wouldn't be nicer if you would do 2 separate things ? Something more meaningfull for kernel space, and a user space program that control the robotic arm.
In any case good luck with your robotic arm! I've done something vaguely similar on serial port, and it's really nice when something it's moving controlled by the computer.
All you really need is a user space program that users the serial driver already in the kernel.
The driver is serial_core.c right? I don't understand anything in it. I could try reading the source code of a serial driver already in the kernel, but looking at their sizes I doubt if I'll get anywhere anytime soon. Since I'm working for on a college project the main aim is to get the robot moving, to be honest I don't care for perfection (deadlocks, race conditions and the likes :/)
So, do you guys have any suggestions on how to go about it, would you recommend Java for my purpose then? Or perhaps some source code or documentations that would help me?