From b0920c4c5ad6b5aa587d1ec35355f2928f5fe573 Mon Sep 17 00:00:00 2001 From: Sierra Guequierre Date: Fri, 25 Oct 2024 10:18:49 -0400 Subject: [PATCH] Make changes from QA --- components/gripper/gripper.go | 4 ++++ components/input/input.go | 20 ++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/components/gripper/gripper.go b/components/gripper/gripper.go index 379e5186bdb..9014e5561df 100644 --- a/components/gripper/gripper.go +++ b/components/gripper/gripper.go @@ -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) // diff --git a/components/input/input.go b/components/input/input.go index cdfb8b19355..2ef9c1d1dbb 100644 --- a/components/input/input.go +++ b/components/input/input.go @@ -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) // @@ -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 {