Class MechanismLigament2d
java.lang.Object
org.wpilib.smartdashboard.MechanismObject2d
org.wpilib.smartdashboard.MechanismLigament2d
- All Implemented Interfaces:
TelemetryLoggable
Ligament node on a Mechanism2d. A ligament can have its length changed (like an elevator) or
angle changed, like an arm.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMechanismLigament2d(String name, double length, double angle) Create a new ligament with the default color (orange) and thickness (6).MechanismLigament2d(String name, double length, double angle, double lineWidth, Color8Bit color) Create a new ligament. -
Method Summary
Modifier and TypeMethodDescriptiondoublegetAngle()Get the ligament's angle relative to its parent.getColor()Get the ligament color.doubleGet the ligament length.doubleGet the line thickness.Gets the telemetry table type.voidlogTo(TelemetryTable table) Logs the object to aTelemetryTable.final voidsetAngle(double degrees) Set the ligament's angle relative to its parent.voidsetAngle(Rotation2d angle) Set the ligament's angle relative to its parent.final voidSet the ligament color.final voidsetLength(double length) Set the ligament's length.final voidsetLineWeight(double weight) Set the line thickness.Methods inherited from class MechanismObject2d
append, getName
-
Constructor Details
-
MechanismLigament2d
public MechanismLigament2d(String name, double length, double angle, double lineWidth, Color8Bit color) Create a new ligament.- Parameters:
name- The ligament name.length- The ligament length.angle- The ligament angle in degrees.lineWidth- The ligament's line width.color- The ligament's color.
-
MechanismLigament2d
Create a new ligament with the default color (orange) and thickness (6).- Parameters:
name- The ligament's name.length- The ligament's length.angle- The ligament's angle relative to its parent in degrees.
-
-
Method Details
-
setAngle
public final void setAngle(double degrees) Set the ligament's angle relative to its parent.- Parameters:
degrees- the angle in degrees
-
setAngle
Set the ligament's angle relative to its parent.- Parameters:
angle- the angle
-
getAngle
public double getAngle()Get the ligament's angle relative to its parent.- Returns:
- the angle in degrees
-
setLength
public final void setLength(double length) Set the ligament's length.- Parameters:
length- the line length
-
getLength
public double getLength()Get the ligament length.- Returns:
- the line length
-
setColor
Set the ligament color.- Parameters:
color- the color of the line
-
getColor
-
setLineWeight
public final void setLineWeight(double weight) Set the line thickness.- Parameters:
weight- the line thickness
-
getLineWeight
public double getLineWeight()Get the line thickness.- Returns:
- the line thickness
-
logTo
Description copied from interface:TelemetryLoggableLogs the object to aTelemetryTable.- Specified by:
logToin interfaceTelemetryLoggable- Overrides:
logToin classMechanismObject2d- Parameters:
table- telemetry table
-
getTelemetryType
Description copied from interface:TelemetryLoggableGets the telemetry table type. Default is no specified table type (null). A mismatch in type during logging results in a reported warning, so this should always return the same value.- Returns:
- Table type
-