Yes, there are no docs on this yet–we wanted to move this to NetworkTables (as we did with Field2D) but didn’t get it done in time for kickoff.
In the current implementation, you need to create a json file describing the body and how the ligaments are connected, e.g.:
{
"name": "Test",
"backgroundColor": "green",
"body": [
{
"name": "one",
"type": "line",
"startLocation": 0,
"lineWidth": 3,
"length": 10,
"color": "blue",
"angle": 0,
"children":[
{
"name": "two",
"type": "line",
"lineWidth": 3,
"length": 10,
"color": "green",
"angle": 0
}
]
}
]
}
Then in your robot program, create a Mechanism2D object. Calling setLigamentAngle("Test/one/two", angleInDegrees)
will set the relative angle between the line segments one and two.
Our plan for future improvement here is to move this entirely to NetworkTables so no json file is needed (it would be entirely defined via the Mechanism2D API) and multiple mechanisms can be created.