Skip to content

Commit

Permalink
modify doc
Browse files Browse the repository at this point in the history
modified documentation
  • Loading branch information
seehma committed Jun 7, 2014
1 parent 943f1d5 commit da2a0f8
Showing 1 changed file with 64 additions and 41 deletions.
105 changes: 64 additions & 41 deletions KukaMatlabConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,54 @@ private System.Xml.XmlDocument getXMLCommandDocument(String pathToXMLDocument)
return localXMLDocument;
}

/* ----------------------------------------------------------------------------------------------------------------------------------------------- */
/**
* @brief Helper method for robot-listen-thread;
* waits for the robot to establish a connection and then starts the communication task
*
* @retval none
*/
/* ----------------------------------------------------------------------------------------------------------------------------------------------- */
private void kukaListenerTCP()
{
// prepare sendString for first transport to robot
setCommandString(getCommandInnerXML());

// check if the ipAddress is set
if (robotListenIPAddress_ != null)
{
while ((getRobotConnectionState() == ConnectionState.running) || (getRobotConnectionState() == ConnectionState.starting))
{
// start the server and wait for the connection which has to be established from the kuka robot
// goto ST_SKIPSENS in the kuka robot programm...
comRobotHandler_ = startRobotComServerAndWaitForConnection();
if (comRobotHandler_ != null)
{
// now start the server and periodically receive the robot data and send the prepared XML file
// should stay in the following line till the connection is refused
robotServerLoopTCP(comRobotHandler_);

// when the loop is finished then close the socket
comRobotHandler_.Close();
}
else
{
makeLoggingEntry("could not open the server-robot client connection => check network connection!");
}
}
}
else
{
// otherwise throw an error
makeLoggingEntry("no ip host entry found to connect => check network connection!");
}

makeLoggingEntry("connection closed, server closed, see you next time...");

setRobotConnectionState(ConnectionState.init);
}


/* ----------------------------------------------------------------------------------------------------------------------------------------------- */
/**
* @brief starts the server and waits for a connection which has to be established from a client (robot or virtual)
Expand Down Expand Up @@ -464,52 +512,15 @@ private System.Net.Sockets.Socket startRobotComServerAndWaitForConnection()
return localComHandler;
}


/* ----------------------------------------------------------------------------------------------------------------------------------------------- */
/**
* @brief robot listen thread starting helper method, connects to the robot and initiates the synchron communication
* @brief Helper method for robot-listen-thread;
* listens on the previously defined udp port and waits till the robot initiates the connection
*
* @retval none
*/
/* ----------------------------------------------------------------------------------------------------------------------------------------------- */
private void kukaListenerTCP()
{
// prepare sendString for first transport to robot
setCommandString(getCommandInnerXML());

// check if the ipAddress is set
if (robotListenIPAddress_ != null)
{
while ((getRobotConnectionState() == ConnectionState.running) || (getRobotConnectionState() == ConnectionState.starting))
{
// start the server and wait for the connection which has to be established from the kuka robot
// goto ST_SKIPSENS in the kuka robot programm...
comRobotHandler_ = startRobotComServerAndWaitForConnection();
if (comRobotHandler_ != null)
{
// now start the server and periodically receive the robot data and send the prepared XML file
// should stay in the following line till the connection is refused
robotServerLoopTCP(comRobotHandler_);

// when the loop is finished then close the socket
comRobotHandler_.Close();
}
else
{
makeLoggingEntry("could not open the server-robot client connection => check network connection!");
}
}
}
else
{
// otherwise throw an error
makeLoggingEntry("no ip host entry found to connect => check network connection!");
}

makeLoggingEntry("connection closed, server closed, see you next time...");

setRobotConnectionState(ConnectionState.init);
}

private void kukaListenerUDP()
{
System.Net.IPEndPoint localEndPoint;
Expand Down Expand Up @@ -551,7 +562,9 @@ private void kukaListenerUDP()

/* ----------------------------------------------------------------------------------------------------------------------------------------------- */
/**
* @brief server loop which waits for data from robot and answers with XML File
* @brief server loop which waits for data from robot and answers with XML File, prepared for TCP/IP protocol
*
* @param comHandler ... Socket on which the whole communication is based
*
* @retval none
*/
Expand Down Expand Up @@ -710,6 +723,16 @@ private void robotServerLoopTCP(System.Net.Sockets.Socket comHandler)
}
}

/* ----------------------------------------------------------------------------------------------------------------------------------------------- */
/**
* @brief server loop which waits for data from robot and answers with XML File, based on the UDP/IP protocol
*
* @param comHandler ... Socket which is created after the connection is established
* @param robotListener ... .Net UDP-Client to receive the messages from the robot
*
* @retval none
*/
/* ----------------------------------------------------------------------------------------------------------------------------------------------- */
private void robotServerLoopUDP(System.Net.Sockets.Socket comHandler, System.Net.Sockets.UdpClient robotListener)
{
// variable declarations
Expand Down

0 comments on commit da2a0f8

Please sign in to comment.