POLARIS Serial Communication Protocol

From Lofaro Lab Wiki
Revision as of 20:58, 23 April 2015 by Jfogle (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Upon detection detection of USB->Serial connection

http://wiki.lofarolabs.com/index.php/Creation_of_special_Kernel_event_handling_(USB_auto_connection_for_serial_communication)

The port will auto open a serial connection and always remain in a wait state for communication from the robot

Location Module recieves message to send the robot the map

"req: Map\n"

Location module sends the map to the robot

"ans: "+Map.pgm+"\n"

Location Module recieves message to send the robot the meta data file

"req: Meta Data\n"

Location Module sends meta file information line by line

"ans: Meta Data Transmitting"
char line[255];//buffer
//send data line by line
while(fgets(line,255,mfile)!=NULL){
  std::string send(line);
  asio::write(port,asio::buffer(send.c_str(), send.length()));
  printf("%s",send.c_str());
}

Location Module recives message to send location information

"req: Location\n"

Location Module sends the current location of the module with a update rate of 5hz

"ans: Location Stream Started"
"Current Location: "+Location+"\n"

Location is collected using the following

ros::Subscriber sub = n.subscribe("pose",1000,LocationCallBack); //subscriber to advertiser pose 
ros::Rate r(5); //5hz update rate
while (ros::ok())
{
 ros::spinOnce();
 r.sleep();
}