17) Building the predator

7) Building the Predator

Date: 06/06 2012
Group members participating: Falk, Jeppe and Jakob
Duration of activity: 7 hours

7.1) Goal

Building the Predator robot and implementing remote control.

7.2) Plan

  • Building the Predator robot.
  • Implement remote control of the predator via bluetooth.
  • Let the predator interact with the preys.
  • Find a way the predator can "kill" the preys.

7.3) Results


7.3.1) Building the Robot

The robot is build with the turning wheel in the front unlike the prey robots. This provides some problems when driving backwards, the robot does not drive straight backwards but drives slightly to one of the sides. The robot has a flipping mechanism in the front for tipping the prey over.
The plan is to make the robot look evil by adding som "spikes" all over it, the end result is a robot that looks like an evil deranged elephant.

7.3.2) Control the Robot via Bluetooth

Using the RemotePilot example in the lejos.pcsamples it was possible to connect and control the robot with bluetooth.
The example provided some base code to develop further implementations of controlling the robot over bluetooth.
The example uses the DifferentialPilot [Bibliography item differentialpilot not found.], but instead the Mover class is used.

The KeyListener interface is used to listen for which keys are pressed and released.
There were some issues getting keyboard focus, so code from the KeyEventDemo, to make a GUI, which hold keyboard focus.
It turns out that on linux holding a key will result in multiple keyPressed and keyReleased events, while on a windows machine holding a key will give multiple keypressed events but only one keyReleased event. This gave some problems because a linux computer is used to control the predator.
This was solved by letting the robot go forward when "up"-key is pressed, and it keeps going foward until another key is pressed. (Kind of like controlling the snake in the game "Snake" on Nokia cellphones).

7.3.3) Killing Prey

To kill the prey it was envisioned that the prey somehow could deteremine if it was lying down, and then turn itself off. The idea was to use the color sensor, and when it reads black for a longer duration it is safe to assume that the prey is laying down. The problem is that the floor intended to be used for the final presentation registers as black on the color sensor.
This was avoided by making a contraption that pushes the enter button on the NXT to kill it. This means that the predator has to tip the prey over and then ram it to kill it.

7.3.4) Interaction

The predator interacts fine with the prey and has no problem tipping them over, pressing the top on the other hand prooved troublesome because the prey keep moving while laying down. This means that the preys are hard to kill, and something may need to be changed so that it is easier.

7.4) Conclusion

We added a BackBumper behavior that depends on a touch sensor mounted in the back of the prey. This proved very easy to implement in our existing framework and took only 5-10 minutes to do.
The prey implementation was refactored during today's lab, where all names of variables were changed to more intentional names, which makes the code easier to read. Comments were added to most of the code as well.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License