logo logo
Home arrow Forums...
Monday, 21 May 2012
 
 
 
Conscious-Robots.com Forum  


<< Start < Prev 1 2 Next > End >>
Raúl
Moderator

Moderator
Posts: 591
graph
Karma: 10  
Re:Simulated GPS Sensor - 2010/01/20 13:36 I had a look to it and managed to get the simulated GPS service working with my code. I will upload soon a set of new services under a package called CRUBOTS (Conscious Robots Utilities for Robot Simulation), which will include a basic simulated GPS service.

First of all, in order to use the simulated GPS service with your robot, you need to insert a GPS sensor entity into your simulated robot. Therefore, you either need a simulated robot that already has a GPS sensor entity or you need to create or modify a simulated robot to add this simulated sensor (as far as I know, you can't do this using a manifest):

Code:

  VisualEntity GPSent = new SimulatedGPSEntity();              GPSent.State.Name "SimulatedGPSEntity"; CreateService(      pxGPS.Contract.Identifier,     Microsoft.Robotics.Simulation.Partners.CreateEntityPartner(     "http://localhost/" GPSent.State.Name) ); robotBaseEntity.InsertEntity(GPSEnt);



This code would be part of your simulated robot creation, and will add the GPS sensor entity. If you don't have this in the first place, you won't get it working.


Other thing you have to take care is the Simulated GPS service code that comes with MRDS 2008 R2. At least in the distribution I have the code has several problems. I fixed them changing the follwing code of Simulated GPS service:

Service port name:

Code:

 [ServicePort("/SimulatedGPS"AllowMultipleInstances true)]



The entity initialization:


Code:

 void InsertEntityNotificationHandler(simengine.InsertSimulationEntity ins) {     // _entity = (simengine.CameraEntity)ins.Body;     _entity = (SimulatedGPSEntity)ins.Body;     _entity.ServiceContract Contract.Identifier;     CreateDefaultState(); }




Using camera entity triggered an invalid cast exception.

And, I also had to alter the state update (CheckForStateChange method):

Code:

 // _state.X = _entity.State.Pose.Position.X; _state._entity.Parent.State.Pose.Position.X; // Same for Y and Z...



Sensor entity position is relative to the parent, therefore I changed it to refer to parent's position (my robot chasis position in this case). Otherwise, you just get the position (relative to the robot) of the GPS sensor.

Hope this helps, anyway I'll let you know when I upload my code so you can see it working.
Raúl Arrabales Moreno. conscious-robots.com/raul
  The administrator has disabled public write access. Please, register to participate in the forum.
Raúl
Moderator

Moderator
Posts: 591
graph
Karma: 10  
Re:Simulated GPS Sensor - 2010/01/20 20:23 FYI: I have already uploaded a modified version of the Simulated GPS service, which I am using in my own code.

It is available for download at:

Simulated Pioneer GPS

Cheers,
Raúl.
Raúl Arrabales Moreno. conscious-robots.com/raul
  The administrator has disabled public write access. Please, register to participate in the forum.
mik
User

Junior Boarder
Posts: 7
graphgraph
Karma: 1  
Re:Simulated GPS Sensor - 2010/01/22 11:42 Hi Raul,

First to all I want say you thank you very much for help.
I saw your source code that you have updated and I have tried it.

I have followed your note on readme.txt but when I run it I have some problems about the manifest.

Do you think it could be possible compile a code to share and put inside the VPL framework so i can use it?

My version of Microsoft Robotics Studio it's the same of you: 2008 R2.

In alternative we can use a robot with GPS Sensor inside, so without add a service?

Then, I saw your replay here, I'm mirckley so you could read my problem.

Thank you.
  The administrator has disabled public write access. Please, register to participate in the forum.
Raúl
Moderator

Moderator
Posts: 591
graph
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
  The administrator has disabled public write access. Please, register to participate in the forum.
Raúl
Moderator

Moderator
Posts: 591
graph
Karma: 10  
Re:Simulated GPS Sensor - 2010/03/23 21:06 Version 3 of the Simulated Pioneer GPS service, which includes robot orientation (theta) is available for download at: MRDS 2008 R2 Downloads.

Cheers,
Raúl.
Raúl Arrabales Moreno. conscious-robots.com/raul
  The administrator has disabled public write access. Please, register to participate in the forum.
JoaoVr
User

Fresh Boarder
Posts: 2
graphgraph
Karma: 0  
Re:Simulated GPS Sensor - 2011/06/14 19:41 Hi,

Can I use this with MRDS Visual Programming Language 2008 R3?
  The administrator has disabled public write access. Please, register to participate in the forum.
JoaoVr
User

Fresh Boarder
Posts: 2
graphgraph
Karma: 0  
Re:Simulated GPS Sensor - 2011/06/15 17:27 Can I use this on a VPL simulation? How?
  The administrator has disabled public write access. Please, register to participate in the forum.
Raúl
Moderator

Moderator
Posts: 591
graph
Karma: 10  
Re:Simulated GPS Sensor - 2011/06/16 12:06 Hi, I think the answer is yes and no

Yes, because every service you build in RDS will be available in VPL, so in principle you can access this service from VPL programs...

HOWEVER, since the GPS service needs to be associated with a parent entity (the simulated robot you'd like to get the position from) you need to make this arrangement in the first place (and this, I don't know if can be done directly in VPL).

So, one option is to have another service which programatically builds your robot with the inbuilt simulated GPS (as explained above) and then use the complete robot and GPS service from VPL.

Cheers,
Raúl.
Raúl Arrabales Moreno. conscious-robots.com/raul
  The administrator has disabled public write access. Please, register to participate in the forum.
<< Start < Prev 1 2 Next > End >>





Lost Password?
No account yet? Register
 Conscious Robots RSS FeedConscious Robots RSS Feed

Find us on Facebook

Follow us on TwitterFollow us on twitter
Spotlight

Machine Consciousness Bibliography Database

 

ConsScale
The Cognitive Machine Consciousness Scale

 
Last Posts in Forum
 
CR
miel continental