This block works for Ruby Robot!
The robot's sensors are configured at various pre-determined ports along its body, and are initially pointed in one direction or another. But you can always change these sensors' direction, with the Set Sensor Rotation block.
Some sensors are built with several joints, like a human's arm. Imagine the shoulder, elbow, and wrist joints. In robotics, the joints are numbered, starting with 0. So the first joint, the 'base', would be the shoulder (0), next would be the elbow (1), and then the wrist joint (2).
The 0 Joint
In this example of an ultrasonic sensor placed on top of the robot, the 0 joint can be rotated sideways, allowing the robot to "look around".
The 1 Joint
In this code example, changing the 1 joint's values tilts the ultrasonic sensor up and down, allowing the robot to check for objects on the ground or over its head.
Some sensors have only one degree of rotation, in which case you should only use the 0 joint.
Tip:
It's best to follow up a Set Sensor Rotation block with a Wait Until block containing a Get Sensor Rotation block and same values you put into the Set Sensor Rotation block.
This way, you can be sure that the robot has completed the adjustment of the sensor's rotation angle before it executes the rest of the code.
Comments
Please sign in to leave a comment.