Class Servo
java.lang.Object
com.viam.sdk.core.resource.Resource
com.viam.sdk.core.component.Component
com.viam.sdk.core.component.servo.Servo
- Direct Known Subclasses:
ServoRPCClient
Servo represents a physical servo
-
Nested Class Summary
Nested classes/interfaces inherited from class com.viam.sdk.core.resource.Resource
Resource.Reconfigurable, Resource.Stoppable
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Servo
fromRobot
(RobotClient robot, String name) Get the component with the provided name from the provided robot.int
Get the current angle (degrees) of the servo.abstract int
getPosition
(com.google.protobuf.Struct extra) Get the current angle (degrees) of the servo.abstract boolean
isMoving()
Get if the servo is currently moving.void
move
(int angle) Move the servo to the provided angle.abstract void
move
(int angle, com.google.protobuf.Struct extra) Move the servo to the provided angle.static Common.ResourceName
Get the ResourceName of the componentvoid
stop()
Stop the servo.abstract void
stop
(com.google.protobuf.Struct extra) Stop the servo.Methods inherited from class com.viam.sdk.core.component.Component
getGeometries
Methods inherited from class com.viam.sdk.core.resource.Resource
close, createStatus, doCommand, getName, getSubtype, named
-
Field Details
-
SUBTYPE
-
-
Constructor Details
-
Servo
-
-
Method Details
-
named
Get the ResourceName of the component- Parameters:
name
- the name of the component- Returns:
- the component's ResourceName
-
fromRobot
Get the component with the provided name from the provided robot.- Parameters:
robot
- the RobotClientname
- the name of the component- Returns:
- the component
-
move
public abstract void move(int angle, com.google.protobuf.Struct extra) Move the servo to the provided angle.- Parameters:
angle
- the desired angle of the servo in degrees
-
move
public void move(int angle) Move the servo to the provided angle.- Parameters:
angle
- the desired angle of the servo in degrees
-
getPosition
public abstract int getPosition(com.google.protobuf.Struct extra) Get the current angle (degrees) of the servo.- Returns:
- the current angle of the servo in degrees
-
getPosition
public int getPosition()Get the current angle (degrees) of the servo.- Returns:
- the current angle of the servo in degrees
-
stop
public abstract void stop(com.google.protobuf.Struct extra) Stop the servo. It is assumed that the servo stops immediately. -
stop
public void stop()Stop the servo. It is assumed that the servo stops immediately. -
isMoving
public abstract boolean isMoving()Get if the servo is currently moving.- Returns:
- whether the servo is moving
-