Search in sources :

Example 11 with Twist

use of maspack.spatialmotion.Twist in project artisynth_core by artisynth.

the class RigidBody method getEffectiveMassForces.

public static int getEffectiveMassForces(VectorNd f, double t, FrameState state, SpatialInertia effectiveInertia, int idx) {
    Wrench coriolisForce = new Wrench();
    Twist bodyVel = new Twist();
    bodyVel.inverseTransform(state.XFrameToWorld.R, state.vel);
    SpatialInertia S = effectiveInertia;
    S.coriolisForce(coriolisForce, bodyVel);
    if (dynamicVelInWorldCoords) {
        coriolisForce.transform(state.XFrameToWorld.R);
    }
    double[] buf = f.getBuffer();
    buf[idx++] = -coriolisForce.f.x;
    buf[idx++] = -coriolisForce.f.y;
    buf[idx++] = -coriolisForce.f.z;
    buf[idx++] = -coriolisForce.m.x;
    buf[idx++] = -coriolisForce.m.y;
    buf[idx++] = -coriolisForce.m.z;
    return idx;
}
Also used : Twist(maspack.spatialmotion.Twist) Wrench(maspack.spatialmotion.Wrench) SpatialInertia(maspack.spatialmotion.SpatialInertia)

Example 12 with Twist

use of maspack.spatialmotion.Twist in project artisynth_core by artisynth.

the class RigidBody method copy.

@Override
public RigidBody copy(int flags, Map<ModelComponent, ModelComponent> copyMap) {
    RigidBody comp = (RigidBody) super.copy(flags, copyMap);
    // comp.myAttachments = new ArrayList<PointFrameAttachment>();
    // comp.myComponents = new ArrayList<ModelComponent>();
    // comp.indicesValidP = false;
    comp.setDynamic(true);
    comp.mySpatialInertia = new SpatialInertia(mySpatialInertia);
    // comp.myEffectiveInertia = new SpatialInertia (mySpatialInertia);
    PolygonalMesh mesh = getMesh();
    comp.myMeshInfo = new MeshInfo();
    if (mesh != null) {
        PolygonalMesh meshCopy = mesh.copy();
        comp.setMesh(meshCopy, getMeshFileName(), getMeshFileTransform());
        comp.myMeshInfo.myFlippedP = myMeshInfo.myFlippedP;
    } else {
        comp.setMesh(null, null, null);
    }
    // comp.myMarkers =
    // new PointList<FrameMarker> (
    // FrameMarker.class, "markers", "k");
    // comp.add (comp.myMarkers);
    comp.myBodyForce = new Wrench();
    comp.myCoriolisForce = new Wrench();
    comp.myBodyVel = new Twist();
    comp.myBodyAcc = new Twist();
    comp.myQvel = new Quaternion();
    comp.myTmpPos = new Point3d();
    comp.myConnectors = null;
    return comp;
}
Also used : Twist(maspack.spatialmotion.Twist) Wrench(maspack.spatialmotion.Wrench) Quaternion(maspack.matrix.Quaternion) Point3d(maspack.matrix.Point3d) PolygonalMesh(maspack.geometry.PolygonalMesh) SpatialInertia(maspack.spatialmotion.SpatialInertia)

Example 13 with Twist

use of maspack.spatialmotion.Twist in project artisynth_core by artisynth.

the class MotionTargetTerm method updateTargetVelocityVec.

private void updateTargetVelocityVec() {
    if (myTargetVel == null || myTargetVel.size() != myTargetVelSize)
        myTargetVel = new VectorNd(myTargetVelSize);
    double[] buf = myTargetVel.getBuffer();
    int idx = 0;
    for (int i = 0; i < myTargets.size(); i++) {
        MotionTargetComponent target = myTargets.get(i);
        if (target instanceof Point) {
            Vector3d vel = ((Point) target).getVelocity();
            buf[idx++] = vel.x;
            buf[idx++] = vel.y;
            buf[idx++] = vel.z;
        } else if (target instanceof Frame) {
            Twist vel = ((Frame) target).getVelocity();
            buf[idx++] = vel.v.x;
            buf[idx++] = vel.v.y;
            buf[idx++] = vel.v.z;
            buf[idx++] = vel.w.x;
            buf[idx++] = vel.w.y;
            buf[idx++] = vel.w.z;
        }
    }
}
Also used : Twist(maspack.spatialmotion.Twist) Frame(artisynth.core.mechmodels.Frame) Vector3d(maspack.matrix.Vector3d) VectorNd(maspack.matrix.VectorNd) Point(artisynth.core.mechmodels.Point) MotionTargetComponent(artisynth.core.mechmodels.MotionTargetComponent) Point(artisynth.core.mechmodels.Point)

Aggregations

Twist (maspack.spatialmotion.Twist)13 Wrench (maspack.spatialmotion.Wrench)7 SpatialInertia (maspack.spatialmotion.SpatialInertia)4 Point (artisynth.core.mechmodels.Point)3 Vector3d (maspack.matrix.Vector3d)3 Frame (artisynth.core.mechmodels.Frame)2 Quaternion (maspack.matrix.Quaternion)2 RigidTransform3d (maspack.matrix.RigidTransform3d)2 RotationMatrix3d (maspack.matrix.RotationMatrix3d)2 MotionTargetComponent (artisynth.core.mechmodels.MotionTargetComponent)1 PolygonalMesh (maspack.geometry.PolygonalMesh)1 Matrix3d (maspack.matrix.Matrix3d)1 Matrix3x3Block (maspack.matrix.Matrix3x3Block)1 Matrix6d (maspack.matrix.Matrix6d)1 Matrix6dBlock (maspack.matrix.Matrix6dBlock)1 MatrixBlock (maspack.matrix.MatrixBlock)1 Point3d (maspack.matrix.Point3d)1 VectorNd (maspack.matrix.VectorNd)1