Society of Robots - Robot Forum

Software => Software => Topic started by: sparty on December 21, 2011, 04:28:07 AM

Title: arduino and java
Post by: sparty on December 21, 2011, 04:28:07 AM
I am doing a mobile robot that can perform localisation, obstacle avoidance and path finding for my final year engineering project.  I am not sure if the microcontroller in the arduino board can handle everything. I want to interface my laptop with  the arduino board such that the laptop does the processing with the data sent by the arduino (via the sensors) and sends back data to the board again. For example, a sensor identifies an obstacle and sends the data to the running program in the laptop, the laptop processes it, and sends back the motor speed and direction of rotation to the board. I have seen some websites that use a java program to communicate with the microcontroller (for example, http://silveiraneto.net/2009/03/01/arduino-and-java/ (http://silveiraneto.net/2009/03/01/arduino-and-java/)). Does this mean that I can write a java code, compile and run it while the arduino is connected to the laptop and let the laptop do the processing?
Title: Re: arduino and java
Post by: ArtBot on December 24, 2011, 03:14:57 AM
Using serial communications you can easily pass messages back and forth - I'd be tempted to use Bluetooth, or you could use an Xbee/Zigbee solution. But I'd be wary of getting the laptop to do things like motor control simply because of the latency issues. It would be better to give the robot as much autonomous functionality as possible and use the laptop for higher-level functions. For example, you might have a quasi-AI program running on the laptop that decides that under circumstances A, B and C, the robot needs to go into 'flight mode' or 'attack mode'. And the laptop communicates this to the robot. But it's left to the robot's microcontroller to convert that high-level command into, say, motor control.

Similarly, you'll probably want as much processing of sensor inputs as possible to be performed on the robot, and for some reponses (eg, for simple obstacle avoidance) to be carried out by the microcontroller, simply to achieve responsiveness. Then abstract out high-level functions (like mapping, say) to the laptop.
Title: Re: arduino and java
Post by: sparty on January 09, 2012, 09:00:48 AM
Thank you very much :) That was very helpful.