Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCS-2950: Make changes from QA to gripper, input controller #4489

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions components/gripper/gripper.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@ func Named(name string) resource.Name {
//
// Open example:
//
// myGripper, err := gripper.FromRobot(machine, "my-gripper")
//
// // Open the gripper.
// err := myGripper.Open(context.Background(), nil)
//
// Grab example:
//
// myGripper, err := gripper.FromRobot(machine, "my-gripper")
//
// // Grab with the gripper.
// grabbed, err := myGripper.Grab(context.Background(), nil)
//
Expand Down
20 changes: 14 additions & 6 deletions components/input/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,21 @@ func Named(name string) resource.Name {
return resource.NewName(API, name)
}

// Controller is a logical "container" more than an actual device
// Could be a single gamepad, or a collection of digitalInterrupts and analogReaders, a keyboard, etc.
// Controller is a logical "container" more than an actual device.
// It could be a single gamepad, or a collection of digitalInterrupts and analogReaders, a keyboard, etc.
// For more information, see the [input controller component docs].
//
// Controls example:
//
// myController, err := input.FromRobot(machine, "my_input_controller")
//
// // Get the list of Controls provided by the controller.
// controls, err := myController.Controls(context.Background(), nil)
//
// Events example:
//
// myController, err := input.FromRobot(machine, "my_input_controller")
//
// // Get the most recent Event for each Control.
// recent_events, err := myController.Events(context.Background(), nil)
//
Expand All @@ -57,17 +61,21 @@ func Named(name string) resource.Name {
// logger.Info("Start Menu Button was pressed at this time: %v", event.Time)
// }
//
// myController, err := input.FromRobot(machine, "my_input_controller")
//
// // Define the EventType "ButtonPress" to serve as the trigger for printStartTime.
// triggers := []input.EventType{input.ButtonPress}
//
// // Get the controller's Controls.
// controls, err := controller.Controls(ctx, nil)
// controls, err := myController.Controls(context.Background(), nil)
//
// // If the "ButtonStart" Control is found, trigger printStartTime when "ButtonStart" the event "ButtonPress" occurs.
// // If the "ButtonStart" Control is found, trigger printStartTime when on "ButtonStart" the event "ButtonPress" occurs.
// if !slices.Contains(controls, input.ButtonStart) {
// return errors.New("button `ButtonStart` not found; controller may be disconnected")
// logger.Error("button 'ButtonStart' not found; controller may be disconnected")
// return
// }
// Mycontroller.RegisterControlCallback(context.Background(), input.ButtonStart, triggers, printStartTime, nil)
//
// myController.RegisterControlCallback(context.Background(), input.ButtonStart, triggers, printStartTime, nil)
//
// [input controller component docs]: https://docs.viam.com/components/input-controller/
type Controller interface {
Expand Down
Loading