Его пост на сайте social.msdn'a:
Добавлено спустя 29 секунд:
2SMT: А я и предлагал в MSRS стандартные бамперы юзать, TSOP - это ведь и есть безконтактный бампер
roboforum.ruТехнический форум по робототехнике. |
|
|
=DeaD= писал(а):2SMT: Ужос, а не проще включить выключатель с резисторами, на который усики подцепить из скажем трубочек для коктейлей?
имяпроекта1Types.cs содержит набор классов с типами, используемыми классом сервиса, который находится в файле имяпроекта1.cs
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /unsafe- /checked- /nowarn:1701,1702 /nostdlib- /warn:4 /baseaddress:285212672 /define:DEBUG;TRACE;INSTRUMENTED /reference:"C:\Users\sam\Microsoft Robotics Dev Studio 2008\bin\GameController.Y2006.M09.Proxy.dll" /reference:C:\Windows\assembly\GAC_MSIL\Microsoft.Ccr.Adapters.WinForms\2.0.831.0__31bf3856ad364e35\Microsoft.Ccr.Adapters.WinForms.dll /reference:C:\Windows\assembly\GAC_MSIL\Microsoft.Ccr.Core\2.0.831.0__31bf3856ad364e35\Microsoft.Ccr.Core.dll /reference:C:\Windows\assembly\GAC_MSIL\Microsoft.Dss.Base\2.0.831.0__31bf3856ad364e35\Microsoft.Dss.Base.dll /reference:C:\Windows\assembly\GAC_MSIL\Microsoft.Dss.Runtime\2.0.831.0__31bf3856ad364e35\Microsoft.Dss.Runtime.dll /reference:C:\Windows\assembly\GAC_MSIL\Microsoft.Dss.Runtime.Proxy\2.0.831.0__31bf3856ad364e35\Microsoft.Dss.Runtime.Proxy.dll /reference:"C:\Users\sam\Microsoft Robotics Dev Studio 2008\bin\RoboticsCommon.Proxy.dll" /reference:"C:\Users\sam\Microsoft Robotics Dev Studio 2008\bin\SickLRF.Y2005.M12.proxy.dll" /reference:"C:\Users\sam\Microsoft Robotics Dev Studio 2008\bin\SimulationCommon.Proxy.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug:full /filealign:4096 /keyfile:"C:\Users\sam\Microsoft Robotics Dev Studio 2008\samples\mrisamples.snk" /optimize- /out:obj\Debug\SimpleDashboard.Y2006.M01.dll /resource:obj\Debug\Microsoft.Robotics.Services.SimpleDashboard.DriveControl.resources /target:library /warnaserror+ AssemblyInfo.cs DriveControl.cs DriveControl.Designer.cs SimpleDashboard.cs SimpleDashboardState.cs SimpleDashboardTypes.cs
protected override void Start()
{
base.Start();
// Orient sim camera view point
SetupCamera();
// Add objects (entities) in our simulated world
PopulateWorld();
//SpawnIterator(testPlayback);
InitSerialPort();
}
private void InitSerialPort(){
_serialPort = new SerialPort("COM4", 19200, Parity.None, 8, StopBits.One);
_serialPort.Open();
_serialPort.DataReceived += new SerialDataReceivedEventHandler(_serialPort_DataReceived);
}
void _serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e){
var str = _serialPort.ReadExisting();
var matchCollection = Regex.Matches(str, @"Command - (?<command>\d+)");
if (matchCollection.Count == 0)
return;
string command = matchCollection[0].Groups["command"].Value;
const string TURN_RIGHT = "17";
const string TURN_LEFT = "16";
const string RUN_FORWARD = "32";
const string RUN_BACKWARD = "33";
const string STOP = "59";
switch (command){
case TURN_RIGHT:
TurnRobotBy(30f);
break;
case TURN_LEFT:
TurnRobotBy(-30f);
break;
case RUN_FORWARD:
DriveBy(50f, 50f);
break;
case RUN_BACKWARD:
DriveBy(-50f, -50f);
break;
case STOP:
DriveBy(0, 0);
break;
default:
break;
}
}
private void DriveBy(float leftWheel, float rightWheel){
_robotBaseEntity.SetMotorTorque(leftWheel, rightWheel);
}
private void TurnRobotBy(float degrees){
_robotBaseEntity.RotateDegrees(degrees, 100f, new SuccessFailurePort() );
}
#region Lego NXT
void AddLegoNxtRobot(Vector3 position)
{
LegoNXTTribot robotBaseEntity = CreateLegoNxtMotorBase(ref position);
EntityNameSprite nameSprite = new EntityNameSprite(
0.25f, 0.0625f, 256, 64, SpritePivotType.Center, new Vector3(0, 0.25f, 0), "Courier", 14);
nameSprite.State.Name = GetStringWithUniquePostfix("nameSprite");
robotBaseEntity.InsertEntity(nameSprite);
// Create bumper array entity and start simulated bumper service
BumperArrayEntity bumperArray = CreateLegoNxtBumper();
// insert as child of motor base
robotBaseEntity.InsertEntity(bumperArray);
// Finaly insert the motor base and its two children
// to the simulation
SimulationEngine.GlobalInstancePort.Insert(robotBaseEntity);
}
private LegoNXTTribot CreateLegoNxtMotorBase(ref Vector3 position)
{
// use supplied entity that creates a motor base
// with 2 active wheels and one caster
LegoNXTTribot robotBaseEntity = new LegoNXTTribot(position);
// specify mesh.
robotBaseEntity.State.Assets.Mesh = "LegoNXTTribot.bos";
robotBaseEntity.WheelMesh = "LegoNXTTribotWheel.bos";
// the name below must match manifest
robotBaseEntity.State.Name = GetStringWithUniquePostfix("LegoNXTMotorBase");
// Start simulated arcos motor service
drive.Contract.CreateService(
ConstructorPort, "http://localhost/" + robotBaseEntity.State.Name,
Microsoft.Robotics.Simulation.Partners.CreateEntityPartner(
"http://localhost/" + robotBaseEntity.State.Name)
);
return robotBaseEntity;
}
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 = GetStringWithUniquePostfix("LegoNXTBumpers");
// start simulated bumper service
bumper.Contract.CreateService(
ConstructorPort, "http://localhost/" + bumperArray.State.Name,
Microsoft.Robotics.Simulation.Partners.CreateEntityPartner(
"http://localhost/" + bumperArray.State.Name));
return bumperArray;
}
#endregion
void AddLegoNxtRobot(Vector3 position)
private LegoNXTTribot CreateLegoNxtMotorBase(ref Vector3 position)
private BumperArrayEntity CreateLegoNxtBumper()
// use supplied entity that creates a motor base
// with 2 active wheels and one caster
LegoNXTTribot robotBaseEntity = new LegoNXTTribot(position);
private LegoNXTTribot CreateLegoNxtMotorBase(ref Vector3 position)
{
// use supplied entity that creates a motor base
// with 2 active wheels and one caster
LegoNXTTribot robotBaseEntity = new LegoNXTTribot(position);
// specify mesh.
robotBaseEntity.State.Assets.Mesh = "123.bos";//новый корпус
// robotBaseEntity.State.Assets.Mesh = "LegoNXTTribot.bos";
robotBaseEntity.WheelMesh = "123w.bos";//новые "колеса"
// robotBaseEntity.WheelMesh = "LegoNXTTribotWheel.bos";
...
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 25