This fun little robot is a test bed to see if the Mindsensors PFMate and SumoEyes will work with leJOS on the EV3. Good news is that both sensors work perfectly with the current 0.5.0-alpha build of leJOS!

2014 01 01 13 48 58

The Mindsensors PFMate allows you to control Lego Technic Power Functions Motors by sending IR commands to the power functions receiver. Each receiver has two motor output ports (labeled A and B in the code) and a receiver can be listening on one of four channels (1-4). Thus you can independently control up to 8 Power Functions motors from a single PFMate which should accommodate up to the largest robots. LeJOS for the NXT provided a PFMate class that allowed you to communicate with the PFMate in Java. I tested this class in the 0.5.0-alpha build of leJOS for EV3 and it works perfectly.

NOTE: Despite what is shown on the Mindsensors website the PFMate will work with leJOS!

I also tested the Mindsensors SumoEyes on the EV3. The SumoEyes is a three zone obstacle detector that tells you if an obstacle was detected to the left, right or centre of the centre. The detection is not very accurate, but its handy to have a single sensor that takes the place of two or more Ultrasonic sensors on a single port. leJOS provides the SumoEyesSensor class to interface with the SumoEyes. I discovered that on the EV3 the value returned from the SumoEyes for “No Obstacle” is 1022 and not 1023 as in the class code. 

2014 01 01 13 49 27

The code is presented as four class files in this handy zip FirstRover.zip which you can unzip and import directly into Eclipse. I used a subsumption class which allows me to build incremental behaviours in layers in the robot code. It’s  good way to incrementally test and develop your code. 

  • PFRover.java – the main rover Java class file that starts the subsumption arbitrator running.
  • Driving.java – the subsumption behaviour for driving the robot.
  • CollisionDetection.java – the subsumption behaviour for detecting collisions using the SumoEyes. 
  • ButtonWatch.java – a subsumption behaviour to detect collisions using the SumoEyes.