Index: colonet_wireless.cpp
===================================================================
--- colonet_wireless.cpp	(revision 617)
+++ colonet_wireless.cpp	(revision 618)
@@ -50,6 +50,14 @@
 static int log_packet(unsigned char* packet, int len);
 
 /**************************** Public functions *******************************/
+/**
+ * @brief Initializes the wireless library
+ *
+ * @param wl_port_ The port to listen for wireless messages on
+ * @param log_filename_ The name of the log file
+ *
+ * @return 0 on success, negative error code on failure
+ */
 int colonet_wl_init(char* wl_port_, char* log_filename_) {
   if (log_filename_ != NULL) {
     logging_enabled = true;
@@ -78,10 +86,18 @@
   return 0;
 }
 
+/**
+ * @brief This function will kill the thread that is listening for wireless messages
+ */
 void colonet_wl_kill_listener_thread() {
   pthread_kill(listener_thread, 9);
 }
 
+/**
+ * @brief This function spawns a thread to listen for wireless messages
+ *
+ * @return 0 on success, negative error code on failure
+ */
 int colonet_wl_run_listener_thread() {
   dbg_printf("Spawning listener thread...\n");
 
@@ -93,14 +109,30 @@
   return 0;
 }
 
+/**
+ * @brief This function sends a message out on the wireless
+ *
+ * @param client_source The index in the connection pool of the client that is sending the message
+ * @param dest The robot that is meant to receive this message
+ * @param msg_type The type of the message
+ * @param msg_code The message code
+ * @param args The arguments to send with the message
+ *
+ * @return 0 on success, a negative error code on failure
+ */
 int colonet_wl_send(short client_source, short dest, ColonetRobotMessageType msg_type, unsigned char msg_code,
   unsigned char* args) {
   //printf("colonet_wl_send: client_source:%d, dest:%d, msg_code:%d\n", client_source, dest, msg_code);
 
+  //create a new packet to be sent
   ColonetRobotServerPacket pkt;
+
+  //set up the packet
+
   pkt.client_id = client_source;
   pkt.msg_code = msg_code;
 
+  //copy over the args into the data portion of the packet
   for (int i = 0; i < PACKET_DATA_LEN; i++) {
     //printf("data %i: %u\n", i, args[i]);
     pkt.data[i] = args[i];
@@ -123,10 +155,23 @@
   return 0;
 }
 
+/**
+ * @brief Used to get the number of robots in the token ring
+ *
+ * @return The result of wl_token_get_num_robots()
+ */
 int colonet_get_num_robots(void) {
   return wl_token_get_num_robots();
 }
 
+/**
+ * @brief Gets a list of the xbee ids of the ones in the token ring
+ *
+ * @param numrobots A pointer to the variable where you want the number of robots to be stored
+ *
+ * @return A dynamically allocated piece of memory that contains the list of xbee ids.
+ *   The function calling this function must free this memory when done with it.
+ */
 int* colonet_get_xbee_ids(int* numrobots) {
   int num_robots = wl_token_get_num_robots();
   int* ids = (int*)malloc(num_robots * sizeof(int));
@@ -143,7 +188,14 @@
   return ids;
 }
 
-// Returns int**; should be freed
+/**
+ * @brief Gets the sensor matrix from the wireless library
+ *
+ * @param numrobots A pointer to the variable where you want the number of robots to be stored
+ * @param ids_ A pointer to a pointer that you want to point to the list of xbee ids.  This memory is dynamically allocated and should be freed by the calling process when it is done with it
+ *
+ * @return The 2d matrix reprsenting the sensor matrix.  This memory is dynamically allocated and should be freed by the calling process when it is done with it
+ */
 int** colonet_get_sensor_matrix(int* numrobots, int** ids_) {
   int num_robots;
   int* ids = colonet_get_xbee_ids(&num_robots);
@@ -189,11 +241,13 @@
     log_packet(data, len);
   }
 
+  //see if a robot wants the server to tell it where it is
   if (pkt->msg_code == ROBOT_REQUEST_POSITION_FROM_SERVER) {
     /* Robot has requested its position. */
     int robot_x, robot_y;
     PositionMonitor* pm = colonet_server.getPositionMonitor();
     int num_robots = pm->getNumVisibleRobots();
+    //ask the position monitor for where that robot is.
     int ret = pm->getRobotPosition(source, &robot_x, &robot_y);
     if (ret != 0 && num_robots != 1) {
       fprintf(stderr, "Robot %d requested position, but its position is not known.\n", source);
