Behaviour-based Robotics – 3Pi/Wixel Robot controlled Remotely by Java

I always wanted to control my robots using Java. I finally built one after buying many items at heavy discount from Pololu during their Black Friday Sale. The actual cost of the robot is around one-half ($100) of that listed in the Bill of materials which is based on list price($209). Most microcontrollers cannot support full function Java directly due to their limited onchip resources. That is the reason why Java has to run on a PC or tablet.The key components are the 2 Wixels (8051 core) which provide wireless communication between the robot and a PC. The Java program runs on the PC.

Behaviour-based robotics uses a collection of behaviours. Each behaviour takes input from sensor(s) and strives to achieve a goal by activating effectors (eg, wheels). The subsumption architecture is used to structure the behaviours by prioritising them. The behaviours in my Java program include the following (from high to low priority):

  • Avoid Cliff Behaviour - if a cliff has been detected (by using the line sensors), back away and turn
  • Escape Obstacle Behaviour - if the distance sensor detects an obstacle ahead (close by), back away and scan left and right for an opening and move towards it
  • Avoid Obstacle Behaviour - if the distance sensor detects an obstacle ahead (farther away), scan left and right for an opening and move towards it
  • Cruise Behaviour - simply move forward

The jar file can either be run from a command prompt or deployed in Tomcat to provide a web interface.

Here is a brief description of the project:

Project Highlights

 

Bill of Materials

Finished Product Photo1

Points of Interest:

  • there is a slight time lag due to wireless communication. The 3Pi robot has to be slowed down a bit using PWM control to make timely control of the robot
  • the cliff detection using the line sensors is not reliable due to the geometry of the 3Pi wheels. Depending on the angle of approach, the cliff detection comes a bit too late and one wheel is already off the cliff.
  • the serial communication using RXTXcomm.jar used to communicate with the Wixel, which is connected to the PC via a USB port, works fine on Windows but not reliably on Linux
  • the 3Pi runs the stock slave program so that the Java master can control it by sending it commands. All facilities on the 3Pi are fully functional including the LCD.
  • the Wixel provides the wireless link between the 3Pi and PC. It also implements 2 additional commands to measure distance ahead using the Ping sensor and to control the servo that positions the Ping sensor left or right. When the Wixel receives a command from the PC, it checks if it is one of the 2 new commands that it handles, if so, it executes the command and sends a response back to the PC. If it is a 3Pi command, it just passes it to the 3Pi using a serial link and relates the response back to the PC.
  • an extra battery is used as a counter weight at the back of the robot to avoid it from tipping forward due to the weight of the servo and Ping sensor mounted at the front. You can clearly see it on the second last photo.

Navigate around using a Ping))) sensor mounted on a servo

  • Actuators / output devices: 2 X gearhead motors
  • Control method: Remotely controlled by a Java behaviour-based control program or manually controlled
  • CPU: Atmel328p, Wixel(8051) and PC(X86)
  • Operating system: Ubuntu (Linux), Windows 7
  • Power source: 4 x AA batteries
  • Programming language: C on Wixel, Java on PC
  • Sensors / input devices: Ping))) sensor
  • Target environment: indoor

This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/behaviour-based-robotics-3pi-wixel-robot-controlled-remotely-by-java