diff --git a/wpilibcExamples/src/main/cpp/examples/Mechanism2d/cpp/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/Mechanism2d/cpp/Robot.cpp index 7df57472e7..551dc78335 100644 --- a/wpilibcExamples/src/main/cpp/examples/Mechanism2d/cpp/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/Mechanism2d/cpp/Robot.cpp @@ -11,6 +11,8 @@ #include #include #include +#include +#include #include /** @@ -57,13 +59,14 @@ class Robot : public frc::TimedRobot { // the main mechanism object frc::Mechanism2d m_mech{3, 3}; // the mechanism root node - frc::MechanismRoot2d* m_root = m_mech.GetRoot("climber", 3, 3); + frc::MechanismRoot2d* m_root = m_mech.GetRoot("climber", 2, 0); // MechanismLigament2d objects represent each "section"/"stage" of the // mechanism, and are based off the root node or another ligament object frc::MechanismLigament2d* m_elevator = m_root->Append("elevator", 1, 90_deg); frc::MechanismLigament2d* m_wrist = - m_elevator->Append("wrist", 0.5, 90_deg); + m_elevator->Append( + "wrist", 0.5, 90_deg, 6, frc::Color8Bit{frc::Color::kPurple}); }; #ifndef RUNNING_FRC_TESTS diff --git a/wpilibcExamples/src/main/cpp/examples/examples.json b/wpilibcExamples/src/main/cpp/examples/examples.json index f598e1e74d..19bc1a7eb0 100644 --- a/wpilibcExamples/src/main/cpp/examples/examples.json +++ b/wpilibcExamples/src/main/cpp/examples/examples.json @@ -56,7 +56,7 @@ "foldername":"Mechanism2d", "gradlebase":"cpp", "description":"An example usage of Mechanism2d to display mechanism states on a dashboard.", - "tags":[], + "tags":["Mechanism2d"], "commandversion": 2 }, { diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/examples.json b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/examples.json index 8e05a1570e..b31e6d0c4e 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/examples.json +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/examples.json @@ -211,7 +211,7 @@ }, {"name": "Mechanism2d", "description": "An example usage of Mechanism2d to display mechanism states on a dashboard.", - "tags": [], + "tags": ["Mechanism2d"], "foldername": "mechanism2d", "gradlebase": "java", "mainclass": "Main", diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mechanism2d/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mechanism2d/Robot.java index b4d638fe06..264b8ad9fe 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mechanism2d/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mechanism2d/Robot.java @@ -13,6 +13,8 @@ import edu.wpi.first.wpilibj.smartdashboard.Mechanism2d; import edu.wpi.first.wpilibj.smartdashboard.MechanismLigament2d; import edu.wpi.first.wpilibj.smartdashboard.MechanismRoot2d; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; +import edu.wpi.first.wpilibj.util.Color; +import edu.wpi.first.wpilibj.util.Color8Bit; /** * This sample program shows how to use Mechanism2d - a visual representation of arms, elevators, @@ -39,14 +41,16 @@ public class Robot extends TimedRobot { m_elevatorEncoder.setDistancePerPulse(kMetersPerPulse); // the main mechanism object - Mechanism2d mech = new Mechanism2d(200, 200); + Mechanism2d mech = new Mechanism2d(3, 3); // the mechanism root node - MechanismRoot2d root = mech.getRoot("climber", 80, 100); + MechanismRoot2d root = mech.getRoot("climber", 2, 0); // MechanismLigament2d objects represent each "section"/"stage" of the mechanism, and are based // off the root node or another ligament object - m_elevator = root.append(new MechanismLigament2d("elevator", 10, 90)); - m_wrist = m_elevator.append(new MechanismLigament2d("wrist", 6, 90)); + m_elevator = root.append(new MechanismLigament2d("elevator", kElevatorMinimumLength, 90)); + m_wrist = + m_elevator.append( + new MechanismLigament2d("wrist", 0.5, 90, 6, new Color8Bit(Color.kPurple))); // post the mechanism to the dashboard SmartDashboard.putData("Mech2d", mech);