logo logo
Home arrow Forums...
Thursday, 04 December 2008
 
 
English English  Español Español  
Upcoming Events
10.Jun. 2009

IWANN 2009
Salamanca, Spain
International Work-Conference on Artificial Neural Networks
11.Jun. 2009

Toward a Science of Consciousness
Hong Kong, China
15.Jun. 2009

International Workshop on Machine Consciousness
Hong Kong, China
15.Jun. 2009

The 8th IEEE International Conference on Cognitive Informatics
Hong Kong, China
22.Jun. 2009

IWINAC 2009
Santiago de Compostela, Spain
Work-Conference in the Interplay between Natural and Artificial Computation
Tag Cloud
Artificial Associations Books Brain Conferences Conscious Consciousness Developer Documentación Documentation Español Machine Machine Consciousness Machines Neuroscience Publications Research Researchers Reviews Robotics Robots Spanish Studio VPL
Spotlight
Syndicate
 Conscious Robots RSS FeedConscious Robots RSS Feed
Conscious-Robots.com Forum  


carlcs
User

Expert Boarder
Posts: 20
graphgraph
Karma: 1  
simulated sonar, states and operations - 2008/08/27 17:21 i was reading the code for the lrf and the simulated sonar here and i was wondering where the simulated sonar stored it's state variables and operations.

the lrf has a SickLRFState.cs file if i remembered right and it has a class called SickLRFOperations.

does the simulated sonar have those kind of state files and operation classes?
  The administrator has disabled public write access. Please, register to participate in the forum.
Raúl
Moderator

Moderator
Posts: 434
graph
Karma: 6  
Re:simulated sonar, states and operations - 2008/08/28 09:44 Yes, you are right, the Sonar service has analogous structure. Indeed, what I do is to implement the generic contract for sonar provided by MSRS. Therefore, I don't really need to define new classes for state and operations, they are already there as part of the generic contract definition. What I do is to reference to the RoboticsCommon assembly, where the generic contract is defined and then use these types:

Code:

 // Raul - SONAR Generic Contract using pxsonar Microsoft.Robotics.Services.Sonar.Proxy;



As I am implementing the generic contract, I have an alternate contract identifier:

Code:

 [AlternateContract(pxsonar.Contract.Identifier)]



This is the state definition taken from the generic contract:

Code:

 private pxsonar.SonarState _state null;



And I also use the sonar operations definition from the generic contract:

Code:

 [ServicePort("/SimulatedSonar"AllowMultipleInstances true)] private pxsonar.SonarOperations _mainPort = new pxsonar.SonarOperations();



By the way, I've seen in my code that I added a comment saying that the service models just one single transducer. That is wrong!! That was my older idea, but I ended up modeling the Pioneer frontal sonar ring with 8 transducers! And therefore, I allocate 8 positions in the array of doubles that represents sonar measurements in the Sonar service state:

Code:

 /// <summary> /// Number of SONAR devices in the simulated SONAR Ring. /// </summary> public const int SonarArrayLength 8;

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

Expert Boarder
Posts: 20
graphgraph
Karma: 1  
Re:simulated sonar, states and operations - 2008/08/28 12:22 oh i see... so, if for example i need to use the SonarOperations class with the simulated sonar, i will have something like

SonarEntity sonar= new SonarEntity();

sonar.SonarOperations _mainport= new sonar.SonarOperations();

and for it's state something like

private sonar.SonarState _state = null;

am i correct?
  The administrator has disabled public write access. Please, register to participate in the forum.
carlcs
User

Expert Boarder
Posts: 20
graphgraph
Karma: 1  
Re:simulated sonar, states and operations - 2008/08/28 13:29 or something like...

using sonar= Cranium.Simulation.Sensors.Proxy;
sonar.SonarOperations _mainport= new sonar.SonarOperations();

and for it's state something like

private sonar.SonarState _state = null;

something like that?
  The administrator has disabled public write access. Please, register to participate in the forum.
Raúl
Moderator

Moderator
Posts: 434
graph
Karma: 6  
Re:simulated sonar, states and operations - 2008/08/28 15:08 Well, what you probably want is to subscribe to the sonar service and get notifications when its states changes, i.e. get the new sonar readings when they robot has moved (or something moved in front of the sonar).

In order to do that, you should use the generic contract for sonar and declare a parter of your service, something like this:

Code:

 // Raul - Sonar generic contract using pxsonar Microsoft.Robotics.Services.Sonar.Proxy; ... [Partner("Sonar"Contract pxsonar.Contract.IdentifierCreationPolicy PartnerCreationPolicy.UseExisting)] pxsonar.SonarOperations _sonarPort =                   new pxsonar.SonarOperations(); pxsonar.SonarOperations _sonarNotify =                   new pxsonar.SonarOperations(); ... // Within your start() method, maybe within an Interleave: Arbiter.ReceiveWithIterator<pxsonar.Replace>(true_sonarNotifyOnSonarReplaceHandler),



Have a look to the service tutorials if you have doubts about how the subscription works. Then, you could find useful to have a look to my code in ExplorerSimSonar that uses the Simulated Sonar.

Remember that you _mainport is for your own service opeations. For sonar notifications you declare another port as shown above.

Post edited by: Raúl, at: 2008/08/28 15:09
Raúl Arrabales Moreno. conscious-robots.com/raul
  The administrator has disabled public write access. Please, register to participate in the forum.
carlcs
User

Expert Boarder
Posts: 20
graphgraph
Karma: 1  
Re:simulated sonar, states and operations - 2008/08/28 16:40 cool! thanks. i'll try that. i'm sorry if i'm a little persistent. hahaha
  The administrator has disabled public write access. Please, register to participate in the forum.





Lost Password?
No account yet? Register
Last Posts in Forum
 
Top!
Advertising links: Cheap Electricity - Loans - Credit Cards - Loans
Top!