예제 #1
0
 public ArmPart(ArmAssembler part, Tuple <Servo, ServoGimbal> servo, ServoGimbal extraGimbal)
 {
     Node        = part.Node;
     Mount       = part.Mount;
     ChildMount  = part.ChildMount;
     Servo       = servo.Item1;
     Gimbal      = servo.Item2;
     ExtraGimbal = extraGimbal;
 }
예제 #2
0
        public SimzArmB1(Scene scene)
        {
            //construct the arm
            Arm = scene.CreateChild("arm");

            //base
            var baseBuilder = new ArmAssembler("Scenes/zArmB1.xml", Arm).Create("base");

            baseBuilder.Immovable();
            Base = baseBuilder.Node;

            //knob & Led
            var knobLight = baseBuilder.Attach("knob-light");
            var knob      = knobLight.Attach("knob", new Vector3(0, 1, 0));

            Led = knobLight.AttachLed();
            var knobParts = knob.AttachKnob();

            Knob       = knobParts.Item1;
            Button     = knobParts.Item2;
            KnobGimbal = knobParts.Item3;

            //shoulder
            var shoulder    = baseBuilder.Attach("servo").Attach("shoulder", new Vector3(1, 0, 0), new Quaternion(0, 50, 0));
            var servoPart   = shoulder.AttachServo(0);
            var servo       = shoulder.Attach("servo");
            var extraGimbal = servo.AttachServoGimbal();

            Shoulder = new ArmPart(shoulder, servoPart, extraGimbal);

            //upper arm
            var upperArm = servo.Attach("upperarm", new Vector3(0, 0, 1), new Quaternion(-90, 0, 0));

            servoPart   = upperArm.AttachServo(1);
            servo       = upperArm.Attach("servo");
            extraGimbal = servo.AttachServoGimbal();
            UpperArm    = new ArmPart(upperArm, servoPart, extraGimbal);

            //forearm
            var foreArm = servo.Attach("forearm", new Vector3(0, 0, 1));

            servoPart   = foreArm.AttachServo(2);
            servo       = foreArm.Attach("servo");
            extraGimbal = servo.AttachServoGimbal();
            ForeArm     = new ArmPart(foreArm, servoPart, extraGimbal);

            //hand
            var hand = servo.Attach("hand", new Vector3(0, 0, 1));

            servoPart   = hand.AttachServo(3);
            servo       = hand.Attach("servo");
            extraGimbal = servo.AttachServoGimbal();
            Hand        = new ArmPart(hand, servoPart, extraGimbal);

            //finger
            var finger = servo.Attach("finger", new Vector3(0, 1, 0));

            servoPart = finger.AttachServo(4, true);
            Finger    = new ArmPart(finger, servoPart, null);
            Finger.Servo.SetRenderLimits(-6f, null); //limit finger to not allow folding in on itself

            //grippers
            var handGrip   = hand.Attach("grip");
            var fingerGrip = finger.Attach("grip");

            Gripper = hand.AttachPrimaryGripper(fingerGrip.Node);

            //all servos
            ArmSegments = new ArmPart[]
            {
                Shoulder,
                UpperArm,
                ForeArm,
                Hand,
                Finger
            };
        }