-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Controls the arm and adds a list of controls to the UI Closes #53
- Loading branch information
1 parent
590ee4a
commit d6ce255
Showing
16 changed files
with
454 additions
and
493 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import "controller.dart"; | ||
|
||
/// Controls the arm. | ||
class ArmController extends Controller { | ||
@override | ||
List<Message> parseInputs(GamepadState state) => [ | ||
// ARM | ||
if (state.leftShoulder) ArmCommand(moveSwivel: -0.25), | ||
if (state.rightShoulder) ArmCommand(moveSwivel: 0.25), | ||
if (state.normalRightY != 0) ArmCommand(moveElbow: state.normalRightY), | ||
if (state.normalLeftY != 0) ArmCommand(moveShoulder: -state.normalLeftY), | ||
|
||
// GRIPPER | ||
if (state.leftTrigger > 0) GripperCommand(moveGripper: -state.normalLeftTrigger), | ||
if (state.rightTrigger > 0) GripperCommand(moveGripper: state.normalRightTrigger), | ||
if (state.dpadUp) GripperCommand(moveLift: 1), | ||
if (state.dpadDown) GripperCommand(moveLift: -1), | ||
if (state.normalRightX != 0) GripperCommand(moveRotate: 1.25*state.normalRightX), | ||
|
||
if (state.buttonBack) ArmCommand(stop: true), | ||
if (state.buttonBack) GripperCommand(stop: true), | ||
// if (state.buttonStart) ArmCommand(calibrate: true), | ||
// if (state.buttonStart) GripperCommand(calibrate: true), | ||
]; | ||
|
||
@override | ||
List<Message> get onDispose => [ | ||
ArmCommand(stop: true), | ||
GripperCommand(stop: true), | ||
]; | ||
|
||
@override | ||
Map<String, String> get controls => { | ||
"Swivel": "Bumpers", | ||
"Shoulder": "Left joystick (vertical)", | ||
"Elbow": "Right joystick (vertical)", | ||
"Gripper Lift": "D-pad up/down", | ||
"Gripper rotate": "Right joystick (horizontal)", | ||
"Pinch": "Triggers", | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.