Raúl
Moderator
 Moderator
| Posts: 590 |  | Karma: 10
|
Re:Simulated GPS Sensor - 2010/01/25 12:33
Hi Mik, I've posted a preliminary version of CRUBOTS, where you can see how the simulated GPS service is used.
In order to have a service available in VPL, I think you just need to compile it. Once the corresponding dll files are in the bin directory, the service will be available in VPL.
The thing about using the Simulated GPS is that there are two components (if you want to see it that way):
- The Simulated GPS sensor entity (a visual entity). - The Simulated GPS service (associated to the former).
In order to make it work, you have to do both inserting the sensor entity to your robot, and associate it to the corresponding service. Then you can subscribe to the GPS service and get notifications.
If you look to the CRUBOTS code, the simulated robot definition code is in the MazeSimulatorRA service. The robot is created programmatically (not using a manifest):
- Creation of the GPS sensor entity:
| Code: |
// Raul - Jan 2010 - Create GPS Entity
private VisualEntity CreateGPSEntity()
{
VisualEntity GPSent = new GPS.PioneerGPSEntity();
GPSent.State.Name = "SimulatedGPSEntity";
GPSent.ServiceContract = pxGPS.Contract.Identifier;
CreateService(
pxGPS.Contract.Identifier,
Microsoft.Robotics.Simulation.Partners.CreateEntityPartner(
"http://localhost/" + GPSent.State.Name)
);
return GPSent;
}
|
- Then, add it to the robot:
| Code: |
robotBaseEntity.InsertEntity(CreateGPSEntity());
|
With this code, the service will be created and running when the simulated robot is created. Then you can subscribe to the Simulated GPS service from another service (like I do from the Cranium Dashboard service).
Raúl Arrabales Moreno. conscious-robots.com/raul |