Skip to content

Commit

Permalink
DOCS-2498: Link from RDK docs to main docs on component pages part 2 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sguequierre authored Sep 9, 2024
1 parent 3b5bc06 commit 60b08d6
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 3 deletions.
6 changes: 6 additions & 0 deletions components/input/input.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// Package input provides human input, such as buttons, switches, knobs, gamepads, joysticks, keyboards, mice, etc.
// For more information, see the [input controller component docs].
//
// [input controller component docs]: https://docs.viam.com/components/input-controller/
package input

import (
Expand Down Expand Up @@ -35,6 +38,7 @@ func Named(name string) resource.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.
// For more information, see the [input controller component docs].
//
// Controls example:
//
Expand Down Expand Up @@ -64,6 +68,8 @@ func Named(name string) resource.Name {
// return errors.New("button `ButtonStart` not found; controller may be disconnected")
// }
// Mycontroller.RegisterControlCallback(context.Background(), input.ButtonStart, triggers, printStartTime, nil)
//
// [input controller component docs]: https://docs.viam.com/components/input-controller/
type Controller interface {
resource.Resource

Expand Down
7 changes: 7 additions & 0 deletions components/motor/motor.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Package motor defines machines that convert electricity into rotary motion.
// For more information, see the [motor component docs].
//
// [motor component docs]: https://docs.viam.com/components/motor/
package motor

import (
Expand Down Expand Up @@ -37,6 +41,7 @@ const SubtypeName = "motor"
var API = resource.APINamespaceRDK.WithComponentType(SubtypeName)

// A Motor represents a physical motor connected to a board.
// For more information, see the [motor component docs].
//
// SetPower example:
//
Expand Down Expand Up @@ -92,6 +97,8 @@ var API = resource.APINamespaceRDK.WithComponentType(SubtypeName)
// logger.Info(powered)
// logger.Info("Power percent:")
// logger.Info(pct)
//
// [motor component docs]: https://docs.viam.com/components/motor/
type Motor interface {
resource.Resource
resource.Actuator
Expand Down
8 changes: 7 additions & 1 deletion components/movementsensor/movementsensor.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// Package movementsensor defines the interfaces of a MovementSensor
// Package movementsensor defines the interfaces of a MovementSensor.
// For more information, see the [movement sensor component docs].
//
// [movement sensor component docs]: https://docs.viam.com/components/movement-sensor/
package movementsensor

import (
Expand Down Expand Up @@ -65,6 +68,7 @@ func Named(name string) resource.Name {
}

// A MovementSensor reports information about the robot's direction, position and speed.
// For more information, see the [movement sensor component docs].
//
// Position example:
//
Expand Down Expand Up @@ -117,6 +121,8 @@ func Named(name string) resource.Name {
//
// // Get the accuracy of the movement sensor.
// accuracy, err := myMovementSensor.Accuracy(context.Background(), nil)
//
// [movement sensor component docs]: https://docs.viam.com/components/movement-sensor/
type MovementSensor interface {
resource.Sensor
resource.Resource
Expand Down
2 changes: 1 addition & 1 deletion components/posetracker/pose_tracker.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Package posetracker contains the interface and gRPC infrastructure
// for a pose tracker component
// for a pose tracker component.
package posetracker

import (
Expand Down
8 changes: 7 additions & 1 deletion components/powersensor/powersensor.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// Package powersensor defines the interfaces of a powersensor
// Package powersensor defines the interfaces of a powersensor.
// For more information, see the [power sensor component docs].
//
// [power sensor component docs]: https://docs.viam.com/components/power-sensor/
package powersensor

import (
Expand Down Expand Up @@ -48,6 +51,7 @@ func Named(name string) resource.Name {
}

// A PowerSensor reports information about voltage, current and power.
// For more information, see the [power sensor component docs].
//
// Voltage example:
//
Expand All @@ -63,6 +67,8 @@ func Named(name string) resource.Name {
//
// // Get the power measurement from device in watts.
// power, err := myPowerSensor.Power(context.Background(), nil)
//
// [power sensor component docs]: https://docs.viam.com/components/power-sensor/
type PowerSensor interface {
resource.Sensor
resource.Resource
Expand Down
3 changes: 3 additions & 0 deletions components/sensor/sensor.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// Package sensor defines an abstract sensing device that can provide measurement readings.
// For more information, see the [sensor component docs].
//
// [sensor component docs]: https://docs.viam.com/components/sensor/
package sensor

import (
Expand Down
7 changes: 7 additions & 0 deletions components/servo/servo.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Package servo supports “RC” or “hobby” servo motors.
// For more information, see the [servo component docs].
//
// [servo component docs]: https://docs.viam.com/components/servo/
package servo

import (
Expand Down Expand Up @@ -31,6 +35,7 @@ const SubtypeName = "servo"
var API = resource.APINamespaceRDK.WithComponentType(SubtypeName)

// A Servo represents a physical servo connected to a board.
// For more information, see the [servo component docs].
//
// Move example:
//
Expand All @@ -50,6 +55,8 @@ var API = resource.APINamespaceRDK.WithComponentType(SubtypeName)
//
// logger.Info("Position 1: ", pos1)
// logger.Info("Position 2: ", pos2)
//
// [servo component docs]: https://docs.viam.com/components/servo/
type Servo interface {
resource.Resource
resource.Actuator
Expand Down
3 changes: 3 additions & 0 deletions resource/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,14 @@ func ContainsReservedCharacter(val string) error {

// A Sensor represents a general purpose sensor that can give arbitrary readings
// of all readings that it is sensing.
// For more information, see the [sensor component docs].
//
// Readings example:
//
// // Get the readings provided by the sensor.
// readings, err := mySensor.Readings(context.Background(), nil)
//
// [sensor component docs]: https://docs.viam.com/components/sensor/
type Sensor interface {
// Readings return data specific to the type of sensor and can be of any type.
Readings(ctx context.Context, extra map[string]interface{}) (map[string]interface{}, error)
Expand Down

0 comments on commit 60b08d6

Please sign in to comment.