Class MechanismLigament2d
- java.lang.Object
-
- edu.wpi.first.wpilibj.smartdashboard.MechanismObject2d
-
- edu.wpi.first.wpilibj.smartdashboard.MechanismLigament2d
-
public class MechanismLigament2d extends MechanismObject2d
Ligament node on a Mechanism2d. A ligament can have its length changed (like an elevator) or angle changed, like an arm.- See Also:
Mechanism2d
-
-
Constructor Summary
Constructors Constructor Description MechanismLigament2d(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getAngle()
Get the ligament's angle relative to its parent.double
getLength()
Get the ligament length.void
setAngle(double degrees)
Set the ligament's angle relative to its parent.void
setAngle(Rotation2d angle)
Set the ligament's angle relative to its parent.void
setColor(Color8Bit color)
Set the ligament color.void
setLength(double length)
Set the ligament's length.void
setLineWeight(double weight)
Set the line thickness.protected void
updateEntries(NetworkTable table)
Update all entries with new ones from a new table.-
Methods inherited from class edu.wpi.first.wpilibj.smartdashboard.MechanismObject2d
append, getName
-
-
-
-
Constructor Detail
-
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.lineWidth
- The ligament's line width.color
- The ligament's color.
-
MechanismLigament2d
public MechanismLigament2d(String name, double length, double angle)
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 Detail
-
setAngle
public void setAngle(double degrees)
Set the ligament's angle relative to its parent.- Parameters:
degrees
- the angle, in degrees
-
setAngle
public void setAngle(Rotation2d angle)
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 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
public void setColor(Color8Bit color)
Set the ligament color.- Parameters:
color
- the color of the line
-
setLineWeight
public void setLineWeight(double weight)
Set the line thickness.- Parameters:
weight
- the line thickness
-
updateEntries
protected void updateEntries(NetworkTable table)
Description copied from class:MechanismObject2d
Update all entries with new ones from a new table.- Specified by:
updateEntries
in classMechanismObject2d
- Parameters:
table
- the new table.
-
-