Raúl
Moderator
 Moderator
| Posts: 591 |  | Karma: 10
|
Re:MSRS could not load SimulatedSonar service - 2010/10/02 11:24
Hi,
Please, use the last version of the simulated sonar, which is included as part of CRUBOTS download at:
--> MRDS 2008 R2 Services
Also, if you look at the other services in this package, you'll see that in order to get the simulated sonar service working you need to create the sonar entity associated to your robot. For instance, you could look at the MAzeSimulatorRA.cs file (the maze simulator service), where the simulated sonar is used:
First, we need a reference to the service proxy:
| Code: | using pxsonar = Cranium.Simulation.Sensors.Proxy;
|
Then, when we create the robot, we can add the simulated sonar entity, and specify its position (relative the robot chassis):
| Code: | SonarEntity sonar1 = CreateSonar(0.0f);
robotBaseEntity.InsertEntity(sonar1);
|
And here is the create sonar function:
| Code: | /// <summary>
/// Creates a frontal SONAR array entity for the Pioneer 3 DX robot.
/// </summary>
/// <param name="dx">X position of sonar source "rays"</param>
/// <returns></returns>
private SonarEntity CreateSonar(float dx)
{
// Create a Sonar Entity.
// Place it 30cm above base CenterofMass.
SonarEntity sonar = new SonarEntity( new Pose(new Vector3(dx, 0.30f, 0)) );
sonar.State.Name = "SimulatedSonar";
// TT - From Oct CTP
sonar.SonarBox.BoxState.DiffuseColor = new Vector4(0.25f, 0.25f, 0.8f, 1.0f);
// Create Sonar simulation service and specify
// which entity it talks to
CreateService(
pxsonar.Contract.Identifier,
Microsoft.Robotics.Simulation.Partners.CreateEntityPartner(
"http://localhost/" + sonar.State.Name));
return sonar;
}
|
Hope this helps..
Raúl Arrabales Moreno. conscious-robots.com/raul |