Every robot skill that uses servos has a standard configuration dialog for specifying the servo port, min and max range. In this lesson, we will explain how to configure a servo (even multiple servos) to be moved from a control. In this example, we will use a vertical servo skill, although this procedure applies to any robot skill that uses servos. There are many robot skills that use servos, including WiiMote, MYO, Camera and dozens more...
What You Will Need
- A PC with ARC Installed and connected to your ezb
*Note: Always ensure you have the latest ARC. When you load ARC and have a connection to the internet, it will notify you if there is a newer version.
Press the Project tab from the top menu. Now press the Add Control button.
The Add Control window will display. In this window, you can browse and select controls to add to your project. Press the SERVO tab to view servo specific controls.
We are going to use the Vertical Servo control for this example. There are many kinds of controls that interact with servos, even more than you can see in this page. Nearly every skill control uses servos, however only the specific servo skill controls are listed in this page. Even the Camera, WiiMote, MYO and more use servos. Click the Vertical Servo button to add the vertical servo skill control to your project.
The Vertical Servo skill control will be added to the workspace. This skill allows sliding the mouse vertically to move a servo position. Alternatively, there is a Horizontal Servo skill control which allows the mouse to be dragged horizontally to move the position.
As mentioned in the Controls Tutorial, every control has a gear button. This gear button can be pressed to load the configuration menu. Each control has a unique configuration menu.
The configuration menu will now be displayed
Each configuration control will have many options. Any control that uses Servos will have a similar servo configuration interface. Some controls may have 2 or more servo configuration interfaces (usually for horizontal and vertical servo control). In this control, there is only one servo interface.
Name: This is the name of the control.
Board Index: There can be 5 EZ-B's connected to the ARC Software. This specifies which EZ-B to send the servo command to.
Port: The EZ-B port of the servo. Pressing this button will display the EZ-B for you to select the respective port.
Min/Max: Min and Max limits in degrees of the servo. The servo can move between 1 and 180 degrees. The value for Min must be less than the value of Max, in all cases, even when Invert is checked.
Invert: If the servo is moving in the incorrect direction, checking this box will reverse/invert the direction of the servo.
Multi Servo: If more than one servo will be moving, this allows you to specify multiple servos.
Press the PORT button and the EZ-B port configuration will be displayed. In this dialog, you may select the port and press the Close button.
Now that you have selected a port, we can move the servo to specify the MIN and MAX limits. These numbers are in degrees between 1 and 180. Start with the MIN by clicking and holding the mouse button while dragging the cursor UP or DOWN. The MIN value must be less than the MAX value. In this example, set the MIN to a low number and the servo will move in real-time, if connected to ARC and an EZ-B.
Move the MAX by clicking and holding the mouse button while dragging the cursor UP or DOWN. The MIN value must be less than the MAX value. In this example, set the MAX to a low number and the servo will move in real-time, if connected to ARC and an EZ-B.
If you would like this control to move more than one servo at the same time, the Multi Servo button does just that. Press the button to display the Multi Servo dialog.
To add multiple servos, press the ADD SERVO button. Each time it is pressed, a new servo entry is added. You can remove the servo by pressing the X on the respective servo. Use the PORT, MIN and MAX to configure the limits. The multiservo option also allows a ratio to be specified. The ratio is based off the primary value for first servo in the list. If the servo degree position for the first servo is specified as 10 and the ratio is 2, the respective servo will move to degree position 20.
Close the configuration dialog for the servo control and return to workspace. Now that the servo has been configured, you may move it between the MIN and MAX limits that were specified. Click in the servo position and the cursor will change while holding the mouse button. Slide the mouse up and down (for vertical control) to move the servo between the specified limits.
*Note: Remember that even though many controls may move servos, the configuration of those servos are only valid for that control. This means if you configure a camera control to move servos to specific min/max ranges, those ranges are only applicable to the camera control. If you wish a servo, or group of servos to move together from script, use the Relative Servo control.
Set Servo Limits
The servo control values in the previous example are for that servo control only. Every control have its own servo values (i.e. min and max). This means the Camera control has different servo values than the Joystick control. The values specified in a control's configuration are specific to that control. If you wish to specify global servo position limits across the entire application, you can do so with EZ-Script commands in your Init.
The command to use in an INIT script to specify servo positions globally across the entire application are...
SetServoMin (servoPort, position)
Set the minimum limit that this servo can ever move to
Servo position is between 1 and 180
Example: SetServoMin(D14, 40)
SetServoMax (servoPort, position)
Set the maximum limit that this servo can ever move to
Servo position is between 1 and 180
Example: SetServoMax(D14, 100)
Here's an example from the JD project that makes the left gripper not move further in either direction globally across the software.
# Left Gripper SetServoMin(d6, 30) SetServoMax(d6, 90)