Hi, Arsalan, and anyone who has interest in ROS connecting to opencog,
From the discussions with Arsalan, first the ROS needs to input the
environment information to the opencog, and the map-info message is a
bit complex,
so I made some explanation about the map-info message format and handlling here:
Note: this is for the old 2D spacemap.
This an xml message send to opencog PAI: This message is sent by OCConnector.cs in the Unity project - sendMapInfoMessage()
<?xml version="1.0" encoding="UTF-8"?>
<oc:embodiment-msg xsi:schemaLocation="
http://www.opencog.org/brain
BrainProxyAxon.xsd"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:oc="
http://www.opencog.org/brain">
<map-info global-position-x="24" global-position-y="24" global-position-offset="48" global-floor-height="99">
<map-data timestamp="2012-07-04T13:50:33.854"> ... </map-data>
</map-info>
</oc:embodiment-msg>
The format of this map-info message is in /opencog/embodiment/Control/PerceptionActionInterface/BrainProxyAxon.xsd
<xsd:element name="map-info" type="oc:MapInfoType"/>
<xsd:annotation>
<xsd:documentation>
An aggregate of all map data from virtual world which consists of "blips".
</xsd:documentation>
</xsd:annotation>
<xsd:complexType name="MapInfoType">
<xsd:sequence>
<xsd:annotation>
<xsd:documentation>
The map data behaves much like a radar screen, a grid with a
series of blips that represent nearby entities.
</xsd:documentation>
</xsd:annotation>
<xsd:element name="blip" type="oc:BlipType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="map-data" type="oc:MapDataType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="global-position-x" type="xsd:int" use="required"/>
<xsd:attribute name="global-position-y" type="xsd:int" use="required"/>
<xsd:attribute name="global-position-offset" type="xsd:int" use="required"/>
<xsd:attribute name="global-floor-height" type="xsd:int" use="optional"/>
<xsd:attribute name="gridParcel" type="xsd:string" use="optional"/>
</xsd:complexType>
The global-position-x and global-position-y is the begin coordinates of the whole map,
The global-position-offset is the size of the map, in our old 2D spaceMap, we require the map to be a square,
So, if global-position-x = 10, global-position-y = 20, global-position-offset = 50,
then the max_x = 10+50 = 60, max_y = 20+50 = 70;
global-floor-height is the height of the floor, it's optional, you dont need to include it in the message, or just set it to be 0.
gridParcel is not used now, just neglect it.
So basicly every map-info message contain the same
<xsd:attribute name="global-position-x" type="xsd:int" use="required"/>
<xsd:attribute name="global-position-y" type="xsd:int" use="required"/>
<xsd:attribute name="global-position-offset" type="xsd:int" use="required"/>
<xsd:attribute name="global-floor-height" type="xsd:int" use="optional"/>
<xsd:attribute name="gridParcel" type="xsd:string" use="optional"/>
unless your map size is changed.
And the actual information of the location etc of the entity in a map-info is in:
<xsd:element name="blip" type="oc:BlipType" minOccurs="0" maxOccurs="unbounded"/>
And you can also find the format of "blip" in the BrainProxyAxon.xsd:
<xsd:complexType name="BlipType">
<xsd:sequence>
<xsd:element name="entity" type="oc:EntityType" minOccurs="1" maxOccurs="1"/>
<xsd:element name="position" type="common:VectorDataType" minOccurs="1" maxOccurs="1"/>
<xsd:element name="rotation" type="common:RotationDataType" minOccurs="1" maxOccurs="1"/>
<xsd:element name="velocity" type="common:VectorDataType" minOccurs="1" maxOccurs="1"/>
<xsd:element name="dimension" type="common:VectorDataType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="properties" type="oc:PropertiesType" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="timestamp" type="xsd:dateTime" use="required"/>
</xsd:complexType>
And the parsing of a map-info is in PAI:
void PAI::processMapInfo(DOMElement * element, HandleSeq &toUpdateHandles)
Note: there are 2 processMapInfo() in the PAI, one is using protobuf, another one doesn't, you don't need to use the protobuf.
The protobuf one while the MapDataType xml element, no-protobuf one process the BlipType xml element.
There are corresponding xml tag definitions in opencog/embodiment/Control/PerceptionActionInterface/PVPXmlConstants.h
If you have any questions pls feel free to ask me.
Many thanks,
Shujing