Skip to content

Commit

Permalink
Make changes from QA
Browse files Browse the repository at this point in the history
  • Loading branch information
sguequierre committed Oct 25, 2024
1 parent b9d8078 commit b0920c4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
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

0 comments on commit b0920c4

Please sign in to comment.