コード例 #1
0
ファイル: ScribblerSim.cs プロジェクト: yingted/Myro
        private BumperArrayEntity CreateBumperArray()
        {
            // Create a bumper array entity with two bumpers
            BoxShape leftBumper = new BoxShape(
                new BoxShapeProperties("front left",
                                       0.001f,
                                       new Pose(new Vector3(-0.036f, 0.03f, -0.09f)),
                                       new Vector3(0.07f, 0.03f, 0.06f)
                                       )
                );

            leftBumper.State.DiffuseColor = new Vector4(0.1f, 0.1f, 0.1f, 1.0f);

            BoxShape rightBumper = new BoxShape(
                new BoxShapeProperties("front right",
                                       0.001f,
                                       new Pose(new Vector3(0.036f, 0.03f, -0.09f)),
                                       new Vector3(0.07f, 0.03f, 0.06f)
                                       )
                );

            rightBumper.State.DiffuseColor = new Vector4(0.1f, 0.1f, 0.1f, 1.0f);

            // The physics engine will issue contact notifications only
            // if we enable them per shape
            leftBumper.State.EnableContactNotifications  = true;
            rightBumper.State.EnableContactNotifications = true;

            // put some force filtering so we only get notified for significant bumps
            //frontBumper.State.ContactFilter = new ContactNotificationFilter(1,1);
            //rearBumper.State.ContactFilter = new ContactNotificationFilter(1, 1);

            BumperArrayEntity
                bumperArray = new BumperArrayEntity(leftBumper, rightBumper);

            // entity name, must match manifest partner name
            bumperArray.State.Name = "ScribblerBumpers";

            // start simulated bumper service

            //bumper.Contract.CreateService(
            //    ConstructorPort,
            //    Microsoft.Robotics.Simulation.Partners.CreateEntityPartner(
            //    "http://localhost/" + bumperArray.State.Name));

            return(bumperArray);
        }
コード例 #2
0
ファイル: ScribblerSim.cs プロジェクト: yingted/Myro
        void AddScribblerRobot(Vector3 position)
        {
            ScribblerRobot robotBaseEntity = CreateScribblerMotorBase(ref position);

            // Create bumper array entity and start simulated bumper service
            BumperArrayEntity bumperArray = CreateBumperArray();

            // insert as child of motor base
            robotBaseEntity.InsertEntity(bumperArray);

            // create Camera Entity ans start SimulatedWebcam service
            CameraEntity camera = CreateCamera();

            // insert as child of motor base
            robotBaseEntity.InsertEntity(camera);

            // Finaly insert the motor base and its two children
            // to the simulation
            SimulationEngine.GlobalInstancePort.Insert(robotBaseEntity);
        }
コード例 #3
0
ファイル: MazeSimulatorRA.cs プロジェクト: romzes2/cslamme
        private BumperArrayEntity CreateBumperArray()
        {
            // Create a bumper array entity with two bumpers
            // TT -- I changed the thickness of the bumpers to try to
            // reduce the problem where both front and back seem
            // to trigger when it "climbs" a wall. Moving the
            // bumper up higher on the robot did not work because
            // it simply got stuck on the wall!
            // TT Jul-2007 - There is some problem with the bumpers
            // not being recognised during collisions. Put them back
            // the way they were before.
            BoxShape frontBumper = new BoxShape(
                new BoxShapeProperties("front",
                    0.001f,
                    new Pose(new Vector3(0, 0.05f, -0.25f)),
                    new Vector3(0.40f, 0.03f, 0.03f)
                    //new Vector3(0.40f, 0.01f, 0.03f)
                )
            );
            // TT - From Oct CTP
            frontBumper.State.DiffuseColor = new Vector4(0.1f, 0.1f, 0.1f, 1.0f);

            BoxShape rearBumper = new BoxShape(
                new BoxShapeProperties("rear",
                    0.001f,
                    new Pose(new Vector3(0, 0.05f, 0.25f)),
                    new Vector3(0.40f, 0.03f, 0.03f)
                    //new Vector3(0.40f, 0.01f, 0.03f)
                )
            );
            // TT - From Oct CTP
            rearBumper.State.DiffuseColor = new Vector4(0.1f, 0.1f, 0.1f, 1.0f);

            // The physics engine will issue contact notifications only
            // if we enable them per shape
            frontBumper.State.EnableContactNotifications = true;
            rearBumper.State.EnableContactNotifications = true;

            BumperArrayEntity
                bumperArray = new BumperArrayEntity(frontBumper, rearBumper);

            // entity name, must match manifest partner name
            // TT Dec-2006 - Remove slash for V1.0
            bumperArray.State.Name = "P3DXBumpers";

            // start simulated bumper service
            // TT Dec-2006 - Subtle change for V1.0
            //CreateService(
            //    bumper.Contract.Identifier,
            //    Microsoft.Robotics.Simulation.Partners.CreateEntityPartner(
            //    "http://localhost" + bumperArray.State.Name));
            bumper.Contract.CreateService(
                ConstructorPort,
                Microsoft.Robotics.Simulation.Partners.CreateEntityPartner(
                "http://localhost/" + bumperArray.State.Name));
            return bumperArray;
        }
コード例 #4
0
ファイル: MazeSimulatorRA.cs プロジェクト: romzes2/cslamme
        private BumperArrayEntity CreateLegoNxtBumper()
        {
            // create a little bumper shape that models the NXT bumper
            BoxShape frontBumper = new BoxShape(
                new BoxShapeProperties(
                    "front", 0.001f, //mass
                    new Pose(new Vector3(0, 0.063f, -0.09f)), //position
                    new Vector3(0.023f, 0.023f, 0.045f)));

            // The physics engine will issue contact notifications only
            // if we enable them per shape
            frontBumper.State.EnableContactNotifications = true;

            BumperArrayEntity
                bumperArray = new BumperArrayEntity(frontBumper);
            // entity name, must match manifest partner name
            bumperArray.State.Name = "LegoNXTBumpers";

            // start simulated bumper service
            CreateService(
                bumper.Contract.Identifier,
                Microsoft.Robotics.Simulation.Partners.CreateEntityPartner(
                "http://localhost/" + bumperArray.State.Name));
            return bumperArray;
        }
コード例 #5
0
ファイル: ScribblerSim.cs プロジェクト: SamLin95/cs3630
        private BumperArrayEntity CreateBumperArray()
        {
            // Create a bumper array entity with two bumpers
            BoxShape leftBumper = new BoxShape(
                new BoxShapeProperties("front left",
                    0.001f,
                    new Pose(new Vector3(-0.036f, 0.03f, -0.09f)),
                    new Vector3(0.07f, 0.03f, 0.06f)
                )
            );
            leftBumper.State.DiffuseColor = new Vector4(0.1f, 0.1f, 0.1f, 1.0f);

            BoxShape rightBumper = new BoxShape(
                new BoxShapeProperties("front right",
                    0.001f,
                    new Pose(new Vector3(0.036f, 0.03f, -0.09f)),
                    new Vector3(0.07f, 0.03f, 0.06f)
                )
            );
            rightBumper.State.DiffuseColor = new Vector4(0.1f, 0.1f, 0.1f, 1.0f);

            // The physics engine will issue contact notifications only
            // if we enable them per shape
            leftBumper.State.EnableContactNotifications = true;
            rightBumper.State.EnableContactNotifications = true;

            // put some force filtering so we only get notified for significant bumps
            //frontBumper.State.ContactFilter = new ContactNotificationFilter(1,1);
            //rearBumper.State.ContactFilter = new ContactNotificationFilter(1, 1);

            BumperArrayEntity
                bumperArray = new BumperArrayEntity(leftBumper, rightBumper);
            // entity name, must match manifest partner name
            bumperArray.State.Name = "ScribblerBumpers";

            // start simulated bumper service

            //bumper.Contract.CreateService(
            //    ConstructorPort,
            //    Microsoft.Robotics.Simulation.Partners.CreateEntityPartner(
            //    "http://localhost/" + bumperArray.State.Name));

            return bumperArray;
        }