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-3353: Add backlinks part 2 #4704

Merged
merged 4 commits into from
Jan 14, 2025
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
11 changes: 10 additions & 1 deletion components/encoder/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ func (t PositionType) String() string {
// // Get the position of the encoder in ticks
// position, posType, err := myEncoder.Position(context.Background(), encoder.PositionTypeTicks, nil)
//
// For more information, see the [Position method docs].
//
// ResetPosition example:
//
// myEncoder, err := encoder.FromRobot(machine, "my_encoder")
Expand All @@ -82,14 +84,21 @@ func (t PositionType) String() string {
//
// err = myEncoder.ResetPosition(context.Background(), nil)
//
// For more information, see the [ResetPosition method docs].
//
// Properties example:
//
// myEncoder, err := encoder.FromRobot(machine, "my_encoder")
//
// // Get whether the encoder returns position in ticks or degrees.
// properties, err := myEncoder.Properties(context.Background(), nil)
//
// [encoder component docs]: https://docs.viam.com/components/encoder/
// For more information, see the [Properties methods docs].
//
// [encoder component docs]: https://docs.viam.com/dev/reference/apis/components/encoder/
// [Position method docs]: https://docs.viam.com/dev/reference/apis/components/encoder/#getposition
// [ResetPosition method docs]: https://docs.viam.com/dev/reference/apis/components/encoder/#resetposition
// [Properties methods docs]: https://docs.viam.com/dev/reference/apis/components/encoder/#getproperties
type Encoder interface {
resource.Resource

Expand Down
14 changes: 13 additions & 1 deletion components/gantry/gantry.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ func Named(name string) resource.Name {
// // Get the current positions of the axes of the gantry in millimeters.
// position, err := myGantry.Position(context.Background(), nil)
//
// For more information, see the [Position method docs].
//
// MoveToPosition example:
//
// myGantry, err := gantry.FromRobot(machine, "my_gantry")
Expand All @@ -67,20 +69,30 @@ func Named(name string) resource.Name {
// // Move the axes of the gantry to the positions specified.
// myGantry.MoveToPosition(context.Background(), examplePositions, exampleSpeeds, nil)
//
// For more information, see the [MoveToPosition method docs].
//
// Lengths example:
//
// myGantry, err := gantry.FromRobot(machine, "my_gantry")
//
// // Get the lengths of the axes of the gantry in millimeters.
// lengths_mm, err := myGantry.Lengths(context.Background(), nil)
//
// For more information, see the [Lengths method docs].
//
// Home example:
//
// myGantry, err := gantry.FromRobot(machine, "my_gantry")
//
// myGantry.Home(context.Background(), nil)
//
// [gantry component docs]: https://docs.viam.com/components/gantry/
// For more information, see the [Home method docs].
//
// [gantry component docs]: https://docs.viam.com/dev/reference/apis/components/gantry/
// [Position method docs]: https://docs.viam.com/dev/reference/apis/components/gantry/#getposition
// [MoveToPosition method docs]: https://docs.viam.com/dev/reference/apis/components/gantry/#movetoposition
// [Lengths method docs]: https://docs.viam.com/dev/reference/apis/components/gantry/#getlengths
// [Home method docs]: https://docs.viam.com/dev/reference/apis/components/gantry/#home
type Gantry interface {
resource.Resource
resource.Actuator
Expand Down
8 changes: 7 additions & 1 deletion components/gripper/gripper.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,20 @@ func Named(name string) resource.Name {
// // Open the gripper.
// err := myGripper.Open(context.Background(), nil)
//
// For more information, see the [Open method docs].
//
// Grab example:
//
// myGripper, err := gripper.FromRobot(machine, "my_gripper")
//
// // Grab with the gripper.
// grabbed, err := myGripper.Grab(context.Background(), nil)
//
// [gripper component docs]: https://docs.viam.com/components/gripper/
// For more information, see the [Grab method docs].
//
// [gripper component docs]: https://docs.viam.com/dev/reference/apis/components/gripper/
// [Open method docs]: https://docs.viam.com/dev/reference/apis/components/gripper/#open
// [Grab method docs]: https://docs.viam.com/dev/reference/apis/components/gripper/#grab
type Gripper interface {
resource.Resource
resource.Shaped
Expand Down
11 changes: 10 additions & 1 deletion components/input/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ func Named(name string) resource.Name {
// // Get the list of Controls provided by the controller.
// controls, err := myController.Controls(context.Background(), nil)
//
// For more information, see the [Controls method docs].
//
// 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)
//
// For more information, see the [Events method docs].
//
// RegisterControlCallback example:
//
// // Define a function to handle pressing the Start Menu button, "ButtonStart", on your controller and logging the start time
Expand All @@ -75,7 +79,12 @@ func Named(name string) resource.Name {
//
// myController.RegisterControlCallback(context.Background(), input.ButtonStart, triggers, printStartTime, nil)
//
// [input controller component docs]: https://docs.viam.com/components/input-controller/
// For more information, see the [RegisterControlCallback method docs].
//
// [input controller component docs]: https://docs.viam.com/dev/reference/apis/components/input-controller/
// [Controls method docs]: https://docs.viam.com/dev/reference/apis/components/input-controller/#getcontrols
// [Events method docs]: https://docs.viam.com/dev/reference/apis/components/input-controller/#getevents
// [RegisterControlCallback method docs]: https://docs.viam.com/dev/reference/apis/components/input-controller/#registercontrolcallback
type Controller interface {
resource.Resource

Expand Down
26 changes: 25 additions & 1 deletion components/motor/motor.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,37 @@ var API = resource.APINamespaceRDK.WithComponentType(SubtypeName)
// // Set the motor power to 40% forwards.
// myMotorComponent.SetPower(context.Background(), 0.4, nil)
//
// For more information, see the [SetPower method docs].
//
// GoFor example:
//
// myMotorComponent, err := motor.FromRobot(machine, "my_motor")
// // Turn the motor 7.2 revolutions at 60 RPM.
// myMotorComponent.GoFor(context.Background(), 60, 7.2, nil)
//
// For more information, see the [GoFor method docs].
//
// GoTo example:
//
// // Turn the motor to 8.3 revolutions from home at 75 RPM.
// myMotorComponent.GoTo(context.Background(), 75, 8.3, nil)
//
// For more information, see the [GoTo method docs].
//
// SetRPM example:
//
// // Set the motor's RPM to 50
// myMotorComponent.SetRPM(context.Background(), 50, nil)
//
// For more information, see the [SetRPM method docs].
//
// ResetZeroPosition example:
//
// // Set the current position as the new home position with no offset.
// myMotorComponent.ResetZeroPosition(context.Background(), 0.0, nil)
//
// For more information, see the [ResetZeroPosition method docs].
//
// Position example:
//
// // Get the current position of an encoded motor.
Expand All @@ -78,6 +88,8 @@ var API = resource.APINamespaceRDK.WithComponentType(SubtypeName)
// logger.Info("Position:")
// logger.Info(position)
//
// For more information, see the [Position method docs].
//
// Properties example:
//
// // Return whether or not the motor supports certain optional features.
Expand All @@ -87,6 +99,8 @@ var API = resource.APINamespaceRDK.WithComponentType(SubtypeName)
// logger.Info("Properties:")
// logger.Info(properties)
//
// For more information, see the [Properties method docs].
//
// IsPowered example:
//
// // Check whether the motor is currently running.
Expand All @@ -97,7 +111,17 @@ var API = resource.APINamespaceRDK.WithComponentType(SubtypeName)
// logger.Info("Power percent:")
// logger.Info(pct)
//
// [motor component docs]: https://docs.viam.com/components/motor/
// For more information, see the [IsPowered method docs].
//
// [motor component docs]: https://docs.viam.com/dev/reference/apis/components/motor/
// [SetPower method docs]: https://docs.viam.com/dev/reference/apis/components/motor/#setpower
// [GoFor method docs]: https://docs.viam.com/dev/reference/apis/components/motor/#gofor
// [GoTo method docs]: https://docs.viam.com/dev/reference/apis/components/motor/#goto
// [SetRPM method docs]: https://docs.viam.com/dev/reference/apis/components/motor/#setrpm
// [ResetZeroPosition method docs]: https://docs.viam.com/dev/reference/apis/components/motor/#resetzeroposition
// [Position method docs]: https://docs.viam.com/dev/reference/apis/components/motor/#getposition
// [Properties method docs]: https://docs.viam.com/dev/reference/apis/components/motor/#getproperties
// [IsPowered method docs]: https://docs.viam.com/dev/reference/apis/components/motor/#ispowered
type Motor interface {
resource.Resource
resource.Actuator
Expand Down
Loading