Infrared (IR) is invisible light with longer wavelengths than visible light, and it is commonly used in TV remote controls to transmit small amounts of data. IR is used in Sphero BOLT, BOLT+, and RVR/RVR+ to transmit data such as relative distance and heading between robots to enable following and evading behavior among multiple robots, as well as to send custom messages. There are four IR emitters and receivers (pairs) for 360° awareness assuming there is a clear line of sight between two or more robots. The effective range is up to about 3 meters.
Sets the IR emitters to broadcast on two specified channels, from 0 to 7, so other robots can follow or evade. The broadcaster uses two channels because the first channel emits near IR pulses (< 1 meter), and the second channel emits far IR pulses (1 to 3 meters) so the following and evading robots can detect these messages on their IR receivers with a sense of relative proximity to the broadcaster.
Use the following examples to broadcast on channels 0 and 1, so that other robots following or evading on 0 and 1 will recognize this robot:
JavaScript: startIRBroadcast(0, 1)
Python: start_ir_broadcast(0, 1)
Parameters:
nearChannel {number} - The channel (0 to 7) for near IR pulses (< 1 meter)
farChannel {number} - The channel (0 to 7) for far IR pulses (1 to 3 meters)
You can't use a channel for more than one purpose at time. For example, you cannot use channel 0 and 1 to broadcast while also using channel 0 and 1 to evade or follow. This will result in problematic behavior. Each coded IR behavior needs to use a dedicated channel pair.
Compatible Robots:
BOLT and BOLT+
RVR and RVR+
Stops the IR broadcasting behavior previously started with the Broadcast command.
Use the following examples to stop broadcasting:
JavaScript: stopIRBroadcast()
Python: stop_ir_broadcast()
Compatible Robots:
BOLT and BOLT+
RVR and RVR+
Sets the IR receivers to look for broadcasting robots on the same channel pair, from 0 to 7. Upon receiving messages from a broadcasting robot, the follower will adjust its heading and speed to follow the broadcaster. When a follower loses sight of a broadcaster, the follower will spin in place to search for the broadcaster.
Use the following examples to follow another robot that is broadcasting on channels 0 and 1:
JavaScript: startIRFollow(0, 1)
Python: start_ir_follow(0, 1)
Parameters:
nearChannel {number} - The channel (0 to 7) for near IR pulses (< 1 meter)
farChannel {number} - The channel (0 to 7) for far IR pulses (1 to 3 meters)
You can't use a channel for more than one purpose at time. For example, you cannot use channel 0 and 1 to follow while also using channel 0 and 1 to evade or broadcast. Each coded IR behavior needs to use a dedicated channel pair.
Compatible Robots:
BOLT and BOLT+
RVR and RVR+
Stops the IR following behavior previously started with the Follow command.
Use the following examples to stop following another robot that is broadcasting:
JavaScript: stopIRFollow()
Python: stop_ir_follow()
Compatible Robots:
BOLT and BOLT+
RVR and RVR+
Sets the IR receivers to look for broadcasting robots on the same channel pair, from 0 to 7. Upon receiving messages from a broadcasting robot, the evader will adjust its heading to roll away from the broadcaster. When an evader loses sight of a broadcaster, the evader will spin in place to search for the broadcaster. The evader may stop if it is in the far range for a period of time so it does not roll too far away from the broadcaster.
Use the following examples to evade another robot that is broadcasting on channels 0 and 1:
JavaScript: startIREvade(0, 1)
Python: start_ir_evade(0, 1)
Parameters:
nearChannel {number} - The channel (0 to 7) for near IR pulses (< 1 meter)
farChannel {number} - The channel (0 to 7) for far IR pulses (1 to 3 meters)
You can't use a channel for more than one purpose at time. For example, you cannot use channel 0 and 1 to evade while also using channel 0 and 1 to follow or broadcast. Each coded IR behavior needs to use a dedicated channel pair.
Compatible Robots:
BOLT and BOLT+
RVR and RVR+
Stops the IR evading behavior previously started with the Evade command.
Use the following examples to stop evading another robot that is broadcasting:
JavaScript: stopIREvade()
Python: stop_ir_evade()
Compatible Robots:
BOLT and BOLT+
RVR and RVR+
Sends a message on a given IR channel, at a set intensity, from 1 to 64. Intensity is proportional to proximity, where a 1 is the closest, and 64 is the farthest. You will need to use the "On IR Message" event for a corresponding robot to receive the message. Also see the "Get Last IR Message" function to keep track of the last message your robot received.
Use the following examples to send message 4 at intensity 5:
JavaScript: sendIRMessage(4, 5)
Python: send_ir_message(4, 5)
Parameters:
channel {number} - IR channel that sends a message (0 to 7)
intensity {number} - The transmission intensity (1 to 64)
You can't use a channel for more than one purpose at time. For example, you cannot use channel 1 to send a message while also using channel 1 to evade or broadcast. Each coded IR behavior needs to use dedicated channels.
Compatible Robots:
BOLT and BOLT+
RVR and RVR+