IR Scoring a Goal
One NXT robot (leader) detects an IR ball and "passes" it to another NXT robot. The second robot then detects the IR ball and moves the ball into the goal (which is equipped with an IR beacon).
Topics covered in this project:
- Use of IR Seeker sensor interfacing and calibration.
- Transmitting and Receiving Data from an RS-485 Device (NXTBee)
- Using External Libraries
- Formatting strings and converting strings to integers
Note: The concepts outlined in this lesson are geared towards an intermediate user of ROBOTC and C Programming languages. Students should be comfortable with all material covered in the Teaching ROBOTC for MINDSTORMS curriculum before jumping into any Multi-Robot communication lessons.
- Remember when using Multi-Robot communications to always start the robot that is the receiver first. Otherwise, the receiving robot will not be listening when the sending robot broadcasts it's message.
- To received the most accurate reading try to position the IR Seeker in a low position on the robot, or on the same plane as the ball. In this lab this is essential, as the ball must come within very close proximity of the seeker.
Hardware and Software Required
- HiTechnic NXT IRSeeker V2 sensors - 2
- HiTechnic Infrared Electronic Ball (IR ball) - 1
- HiTechnic IR Beacon (1200 Hz) - 1 or 2
- Robot A and Robot B should both be equipped with a front-facing IR Seeker sensor, a downward-facing light sensor, and a mechanical IR ball gathering arm system.
- A playing field (ideally on a carpeted surface to reduce IR ball excessive rolling) should be setup with 2 strips of white tape dividing the area into 3 zones (see video). There are 3 zones. The 1)goal zone (with IR beacon). 2) the middle zone (where the receiver robot, Robot B, is positioned), and 3) the start zone, where the leader, Robot A, is positioned. Initially the IR ball is placed anywhere in the start zone with Robot A.
- The IR ball should be turned on and set to match the frequency of the settings in the code for ball detection (we are using 600 Hz here). NOTE: The IR ball is capable of transmitting at one of two frequencies 600Hz or 1200Hz. However, the IR beacon for the goal is fixed at 1200Hz, so we must set the IR ball to 600Hz, so that the robots can distinguish between the IR ball and the goal. The IR Seeker sensor can be programmatically changed to detect either 600Hz or 1200Hz.
- The goal area should be equipped with 1 or 2 IR beacons (fixed at 1200Hz)
- An NXTBee radio should be connected to sensor port 4 of each robot. The radios on each robot should be paired so that there is communication.
- The goal of the leader robot (Robot A) code is to use the IR seeker sensor (set to the the frequency of the IR ball beacon of 600Hz)to detect and move towards the IR ball. Once the IR ball is within the "gatherer" arms of Robot A, then Robot A sets the IR seeker sensor to track the goal area beacon (1200 Hz) and Robot A moves the IR ball towards the goal. When Robot A reaches the white line on the way to the goal area, Robot A stops motion and communicates wirelessly to Robot B to detect and move toward the IR ball. Robot A then backs up and stops.
- The goal of the receiver (Robot B) is to wait for a message from Robot A to start moving towards the IR ball. Once this message is received, Robot B detects and moves toward the IR ball using the IR seeker sensor (set to 600Hz). Once the IR ball has been "gathered" by the robot, Robot B switches the setting for the IR seeker sensor to detect the IR signal from the beacon at the goal area (1200Hz). Robot B then moves towards the goal area with the IR ball until it reaches the white line and stops. The IR ball continues to move or roll forward and enters the goal. Robot B backs up and stops.
- The white lines are included to maintain zones to avoid collisions between the robots and to help visualize the sequencing and assignment of the tasks. The goal of this project to to gain experience in multi-robot communication. The distances between the white lines and the goal and start area are flexible, but the leader robot must be able to detect the IR beacon at the goal area. This may require some experimentation and an additional IR beacon to get good performance. As can be seen , we used 2 IR beacons in the demonstration video (both beacons are fixed at 1200Hz).
- The project is extended to 3 robots ( 1 leader, 2 receivers) in the follow-up challenge (see follow-up challenge video). These techniques may be used as building blocks to achieve more sophisticated task coordination and task sequencing for such activities as simplified soccer and related challenges.
Robot A (Leader) Source Code
- Download IR Passing 2 Robots A
Robot B (Receiver) Source Code
- Download IR Passing 2 Robots B
Follow-up Challenge: IR ball passing with 3 robots
Challenge: Extend the code and algorithms described above allow the leader robot to pass the IR ball into a zone containing 2 receiver robots. Once the message has been sent from the leader robot, the receiver robots will communicate to determine which of the two receiving robots is closest to the IR ball that was passed into the zone by the leader robot. The closest receiver robot will approach the ball and move the ball into the goal. See the video below that demonstrates the 3 robot solution.
Follow-up Challenge Video (IR ball passing with 3 robots)
More Follow-up Projects and Discussion Questions
- Add more robots and/or zones and improve sophistication of task assignments.
- Add code to automatically calibrate the IR ball so that it can be reliably detected when gathered. (This will alleviate the need to recalibrate and change software thresholds when the IR ball battery level decreases.)
- Add a defender (goalie robot) and simulate simple soccer play action.
- Increase the speed of play by redesigning robots and the algorithms.
- Create, test, demonstrate and share your own challenge or application based on this technology.
- What are some real-world applications of this technology?