Class PowerSensor
java.lang.Object
com.viam.sdk.core.resource.Resource
com.viam.sdk.core.component.Component
com.viam.sdk.core.component.powersensor.PowerSensor
- Direct Known Subclasses:
PowerSensorRPCClient
PowerSensor reports information about voltage, current and power.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.viam.sdk.core.resource.Resource
Resource.Reconfigurable, Resource.Stoppable -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PowerSensorfromRobot(RobotClient robot, String name) Get the component with the provided name from the provided robot.getCurrent(Optional<com.google.protobuf.Struct> extra) Return the current of a specified device and whether it is AC or DC.abstract doubleReturn the power reading in watts.getReadings(Optional<com.google.protobuf.Struct> extra) Get the measurements or readings that this power sensor provides.getVoltage(Optional<com.google.protobuf.Struct> extra) Return the voltage reading of a specified device and whether it is AC or DC.static Common.ResourceNameGet the ResourceName of the componentMethods inherited from class com.viam.sdk.core.component.Component
getGeometriesMethods inherited from class com.viam.sdk.core.resource.Resource
close, createStatus, doCommand, getName, getSubtype, named
-
Field Details
-
SUBTYPE
-
-
Constructor Details
-
PowerSensor
-
-
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
-
getVoltage
Return the voltage reading of a specified device and whether it is AC or DC.- Returns:
- the pair where the first double representing the voltage reading in V, the second bool indicating whether the voltage is AC (`true`) or DC (`false`).
-
getCurrent
Return the current of a specified device and whether it is AC or DC.- Returns:
- the pair where the first double representing the current reading in V, the second bool indicating whether the current is AC (`true`) or DC * (`false`).
-
getPower
Return the power reading in watts.- Returns:
- the power reading in watts
-
getReadings
Get the measurements or readings that this power sensor provides. If a sensor is not configured correctly or fails to read a piece of data, it will not appear in the readings dictionary.- Returns:
- The readings for the PowerSensor. Object should be of type Vector3, GeoPoint, Orientation, or any Value type. Includes voltage in volts (float), current in amperes (float), is_ac (bool), and power in watts (float).
-