Search in sources :

Example 21 with MechModel

use of artisynth.core.mechmodels.MechModel in project artisynth_core by artisynth.

the class PointModel method build.

public void build(DemoType demoType) {
    myDemoType = demoType;
    model = new MechModel("point");
    model.setGravity(0, 0, 0);
    model.setIntegrator(Integrator.Trapezoidal);
    model.setMaxStepSize(0.01);
    createModel(myDemoType);
    setupRenderProps();
    setWorkingDir(useReactionForceTargetP ? "reaction_force/" : "east/");
    addTrackingController();
}
Also used : MechModel(artisynth.core.mechmodels.MechModel)

Example 22 with MechModel

use of artisynth.core.mechmodels.MechModel in project artisynth_core by artisynth.

the class SimpleCollide method setTopObject.

public void setTopObject(ObjectType type) {
    MechModel mechMod = (MechModel) models().get(0);
    if (myTopType != type) {
        if (myTopObject != null) {
            if (myBottomObject != null) {
                mechMod.clearCollisionBehavior(myTopObject, myBottomObject);
            }
            removeObject(myTopObject, myTopType);
        }
        Collidable comp = createObject("topObject", type);
        setTopObject(comp, type);
        addObject(comp, type);
        createAndAddControlPanel("Top object", comp);
        if (myBottomObject != null) {
            mechMod.setCollisionBehavior(myTopObject, myBottomObject, true, myFriction);
        }
    }
}
Also used : Collidable(artisynth.core.mechmodels.Collidable) MechModel(artisynth.core.mechmodels.MechModel)

Example 23 with MechModel

use of artisynth.core.mechmodels.MechModel in project artisynth_core by artisynth.

the class SimpleCollide method setBottomObject.

public void setBottomObject(ObjectType type) {
    MechModel mechMod = (MechModel) models().get(0);
    if (myBottomType != type) {
        if (myBottomObject != null) {
            if (myTopObject != null) {
                mechMod.clearCollisionBehavior(myTopObject, myBottomObject);
            }
            removeObject(myBottomObject, myBottomType);
        }
        Collidable comp = createObject("bottomObject", type);
        setBottomObject(comp, type);
        addObject(comp, type);
        createAndAddControlPanel("Bottom object", comp);
        if (myTopObject != null) {
            mechMod.setCollisionBehavior(myTopObject, myBottomObject, true, myFriction);
        }
    // addBreakPoint (0.33);
    }
}
Also used : Collidable(artisynth.core.mechmodels.Collidable) MechModel(artisynth.core.mechmodels.MechModel)

Example 24 with MechModel

use of artisynth.core.mechmodels.MechModel in project artisynth_core by artisynth.

the class SimpleCollide method setFriction.

public void setFriction(double mu) {
    MechModel mechMod = (MechModel) models().get(0);
    myFriction = mu;
    if (mechMod != null) {
        mechMod.setFriction(mu);
    }
}
Also used : MechModel(artisynth.core.mechmodels.MechModel)

Example 25 with MechModel

use of artisynth.core.mechmodels.MechModel in project artisynth_core by artisynth.

the class SimpleCollide method build.

public void build(String[] args) {
    MechModel mechMod = new MechModel("mechModel");
    mechMod.setMaxStepSize(0.01);
    mechMod.setIntegrator(Integrator.ConstrainedBackwardEuler);
    addModel(mechMod);
    // for block/block friction test
    // mySeparation = 1.09;
    // mySeparation = .615;
    CollisionManager cm = mechMod.getCollisionManager();
    cm.setColliderType(ColliderType.SIGNED_DISTANCE);
    cm.setDrawIntersectionContours(true);
    RenderProps.setEdgeWidth(cm, 2);
    RenderProps.setEdgeColor(cm, Color.YELLOW);
    RenderProps.setVisible(cm, true);
    setTopObject(ObjectType.FemEllipsoid);
    setBottomObject(ObjectType.Box);
    // for block/block friction test
    // mechMod.transformGeometry (
    // new RigidTransform3d (0, 0, 0, 0, 1, 0, Math.toRadians(20)));
    mechMod.setProfiling(false);
    ControlPanel panel = new ControlPanel("controls");
    panel.addWidget(this, "topObject");
    panel.addWidget(this, "bottomObject");
    panel.addWidget(mechMod, "integrator");
    panel.addWidget(this, "friction");
    panel.addWidget(mechMod, "collisionManager:compliance");
    panel.addWidget(mechMod, "collisionManager:damping");
    addControlPanel(panel, 0);
    // mechMod.transformGeometry (
    // new RigidTransform3d (0, 0, 0, 0, 1, 0, Math.PI));
    Main.getMain().arrangeControlPanels(this);
    // panel.pack();
    // panel.setVisible (true);
    // java.awt.Point loc = Main.getMainFrame().getLocation();
    // panel.setLocation(loc.x + Main.getMainFrame().getWidth(), loc.y);
    // addControlPanel (panel);
    NumericInputProbe iprobe = new NumericInputProbe(mechMod, "rigidBodies/bottomObject:targetOrientation", 0, 6);
    // new NumericInputProbe (
    // mechMod, "rigidBodies/bottomObject:targetPosition", 0, 6);
    iprobe.addData(new double[] { 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 3, 0, 1, 0, 90, 5, 0, 1, 0, 180, 6, 0, 1, 0, 180 }, NumericInputProbe.EXPLICIT_TIME);
    // iprobe.addData (
    // new double[] { 0, 0, 0, 0, 1, 0, 0, 2, 2, 0, 0, 0, 3, 0, 0,
    // 2, 4, 0, 0, 0,},
    // NumericInputProbe.EXPLICIT_TIME);
    // 
    // 
    iprobe.setActive(true);
    addInputProbe(iprobe);
    addBreakPoint(1.34);
}
Also used : MechModel(artisynth.core.mechmodels.MechModel) CollisionManager(artisynth.core.mechmodels.CollisionManager) ControlPanel(artisynth.core.gui.ControlPanel) NumericInputProbe(artisynth.core.probes.NumericInputProbe)

Aggregations

MechModel (artisynth.core.mechmodels.MechModel)59 RigidBody (artisynth.core.mechmodels.RigidBody)25 RigidTransform3d (maspack.matrix.RigidTransform3d)19 FemModel3d (artisynth.core.femmodels.FemModel3d)14 FemNode3d (artisynth.core.femmodels.FemNode3d)8 Particle (artisynth.core.mechmodels.Particle)8 PolygonalMesh (maspack.geometry.PolygonalMesh)8 Vector3d (maspack.matrix.Vector3d)8 RevoluteJoint (artisynth.core.mechmodels.RevoluteJoint)7 LinearMaterial (artisynth.core.materials.LinearMaterial)6 FrameMarker (artisynth.core.mechmodels.FrameMarker)6 CollisionManager (artisynth.core.mechmodels.CollisionManager)5 Color (java.awt.Color)5 AxialSpring (artisynth.core.mechmodels.AxialSpring)4 BodyConnector (artisynth.core.mechmodels.BodyConnector)4 WayPoint (artisynth.core.probes.WayPoint)4 Point3d (maspack.matrix.Point3d)4 MultiPointSpring (artisynth.core.mechmodels.MultiPointSpring)3 PlanarConnector (artisynth.core.mechmodels.PlanarConnector)3 FemElement3d (artisynth.core.femmodels.FemElement3d)2