Updated Controlling a Servo (Blocks) (markdown)
@ -14,7 +14,7 @@ Let’s modify your op mode to add the logic required to control a servo motor.
|
||||
|
||||
With a typical servo, you can specify a target position for the servo. The servo will turn its motor shaft to move to the target position, and then maintain that position, even if moderate forces are applied to try and disturb its position.
|
||||
|
||||
For the blocks programming mode server, you can specify a target position that ranges from 0 to 1 for a servo. A target position of 0 corresponds to zero degrees of rotation and a target position of 1 corresponds to 180 degrees of rotation for a typical servo motor.
|
||||
For the blocks Program & Manage server, you can specify a target position that ranges from 0 to 1 for a servo. A target position of 0 corresponds to zero degrees of rotation and a target position of 1 corresponds to 180 degrees of rotation for a typical servo motor.
|
||||
|
||||
<p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/servo0to80.jpg" width="300"><p>
|
||||
|
||||
@ -51,5 +51,5 @@ Note that it will take an estimated 20 minutes to complete this task.
|
||||
| 23. Use a “gamepad1.A” block as the test condition for the second “else if” block. Drag a “set servoTest.position to” block to the do clause of the second “else if” block and modify the numeric value so that the servo’s position will be set to a value of 1.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/ControlServoStep23ControlHub.jpg" width="300"></p>For this clause, if the “A” button is pressed on the #1 gamepad, the op mode will move the servo to the 180-degree position. |
|
||||
| 24. Insert a “call telemetry.addData” block (numeric) before the “call Telemetry.update” block. Rename the key field to “Servo Position” and insert a “servoTest.Position” block for the number field.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/ControlServoStep24ControlHub.jpg" width="300"></p>This set of blocks will send the current servo position value to the Driver Station while the op mode is running. |
|
||||
| 25. Save your op mode and verify that it was saved successfully to the Robot Controller.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/ControlServoStep25ControlHub.jpg" width="300"></p> |
|
||||
| 26. Follow the procedure outlined in the section titled [Running Your Op Mode](https://github.com/ftctechnh/ftc_app/wiki/Running-Your-Op-Mode) to run your updated op mode. Don’t forget to exit programming mode before selecting and running the op mode. Also, make sure that your gamepad is designated as User #1 before running your op mode.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/ControlServoStep26ControlHub.jpg" width="350"></p>You should now be able to control the servo position with the colored buttons. The servo position should be displayed on the Driver Station. |
|
||||
| 26. Follow the procedure outlined in the section titled [Running Your Op Mode](https://github.com/ftctechnh/ftc_app/wiki/Running-Your-Op-Mode) to run your updated op mode. Also, make sure that your gamepad is designated as User #1 before running your op mode.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/ControlServoStep26ControlHub.jpg" width="350"></p>You should now be able to control the servo position with the colored buttons. The servo position should be displayed on the Driver Station. |
|
||||
|
||||
|
Reference in New Issue
Block a user