private void addIntertialEllipsoidsToVisualizer(FloatingRootJointRobot valkyrieRobot) { ArrayList<Joint> joints = new ArrayList<>(); joints.add(valkyrieRobot.getRootJoint()); HashSet<Link> links = getAllLinks(joints, new HashSet<Link>()); for (Link l : links) { AppearanceDefinition appearance = YoAppearance.Green(); appearance.setTransparency(0.6); l.addEllipsoidFromMassProperties(appearance); l.addCoordinateSystemToCOM(0.5); // l.addBoxFromMassProperties(appearance); } }
link.addEllipsoidFromMassProperties(YoAppearance.Gold()); link.addEllipsoidFromMassProperties2(YoAppearance.Green());
public DoublePendulum() { super("DoublePendulum"); j1 = new PinJoint("j1", new Vector3D(0, 0, 2), this, Axis.X); Link l1 = new Link("l1"); l1.setComOffset(0, 0, 0.5); l1.setMassAndRadiiOfGyration(1.0, 0.05, 0.05, 0.3); l1.addEllipsoidFromMassProperties(YoAppearance.Pink()); j1.setLink(l1); j2 = new PinJoint("j2", new Vector3D(0.0, 0.0, 1.0), this, Axis.X); Link l2 = new Link("l2"); l2.setComOffset(0, 0, 0.5); l2.setMassAndRadiiOfGyration(1.0, 0.05, 0.05, 0.3); l2.addEllipsoidFromMassProperties(YoAppearance.Purple()); j2.setLink(l2); j1.addJoint(j2); addRootJoint(j1); }