Class LoggedMechanismLigament2d
java.lang.Object
org.littletonrobotics.junction.mechanism.LoggedMechanismObject2d
org.littletonrobotics.junction.mechanism.LoggedMechanismLigament2d
- All Implemented Interfaces:
AutoCloseable
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
ConstructorsConstructorDescriptionLoggedMechanismLigament2d(String name, double length, double angle) Create a new ligament with the default color (orange) and thickness (6).LoggedMechanismLigament2d(String name, double length, double angle, double lineWidth, Color8Bit color) Create a new ligament.LoggedMechanismLigament2d(String name, Distance length, Angle angle) Create a new ligament with the default color (orange) and thickness (6).LoggedMechanismLigament2d(String name, Distance length, Angle angle, double lineWidth, Color8Bit color) Create a new ligament. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()doublegetAngle()Get the ligament's angle relative to its parent.getColor()Get the ligament color.doubleGet the ligament length.doubleGet the line thickness.doubleAbstract helper function.voidsetAngle(double degrees) Set the ligament's angle relative to its parent.voidsetAngle(Rotation2d angle) Set the ligament's angle relative to its parent.voidSet the ligament's angle relative to its parent.voidSet the ligament color.voidsetLength(double length) Set the ligament's length.voidSet the ligament's length.voidsetLineWeight(double weight) Set the line thickness.protected voidupdateEntries(NetworkTable table) Update all entries with new ones from a new table.Methods inherited from class org.littletonrobotics.junction.mechanism.LoggedMechanismObject2d
append, generate3dMechanism, getName
-
Constructor Details
-
LoggedMechanismLigament2d
public LoggedMechanismLigament2d(String name, double length, double angle, double lineWidth, Color8Bit color) Create a new ligament.- Parameters:
name- The ligament name.length- The ligament length in meters.angle- The ligament angle in degrees.lineWidth- The ligament's line width.color- The ligament's color.
-
LoggedMechanismLigament2d
public LoggedMechanismLigament2d(String name, Distance length, Angle angle, double lineWidth, Color8Bit color) Create a new ligament.- Parameters:
name- The ligament name.length- The ligament length.angle- The ligament angle.lineWidth- The ligament's line width.color- The ligament's color.
-
LoggedMechanismLigament2d
Create a new ligament with the default color (orange) and thickness (6).- Parameters:
name- The ligament's name.length- The ligament's length in meters.angle- The ligament's angle relative to its parent in degrees.
-
LoggedMechanismLigament2d
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.
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classLoggedMechanismObject2d
-
setAngle
public 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
-
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.- Specified by:
getAnglein classLoggedMechanismObject2d- Returns:
- the angle in degrees
-
setLength
public void setLength(double length) Set the ligament's length.- Parameters:
length- the line length
-
setLength
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
Get the ligament color.- Returns:
- the color of the line
-
setLineWeight
public 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
-
updateEntries
Description copied from class:LoggedMechanismObject2dUpdate all entries with new ones from a new table.- Specified by:
updateEntriesin classLoggedMechanismObject2d- Parameters:
table- the new table.
-
getObject2dRange
public double getObject2dRange()Description copied from class:LoggedMechanismObject2dAbstract helper function. A proxy for getLength() with Ligament2d, but would be something else like getRadius() for circular parts if they were to be implemented.- Specified by:
getObject2dRangein classLoggedMechanismObject2d- Returns:
- distance in meters
-