| Download Server Source: TAMUBotServer.zip Download Client Source: TAMUBotClient.zip Introduction:------------------------------------------------------------------------------------------------------------------------------------------------------The purpose of this software package is to facilitate the use of the TAMU Bot robotic research platform. The software allows the user to control the robot, set experiment and sensor parameters, and receive data input from the robot and its sensors. The goal of this software is to eliminate any need for a laptop riding with the robot, which is dangerous as well as inefficient in terms of accessing and controlling experiment data and parameters.===================================================================================Visual Overview:------------------------------------------------------------------------------------------------------------------------------------------------------The higher-level code is organized in the following manner:![]() ===================================================================================Files:------------------------------------------------------------------------------------------------------------------------------------------------------
===================================================================================Socket Communication Details:------------------------------------------------------------------------------------------------------------------------------------------------------A more detailed explanation for the socket communication system is described below.------------------------------------------------------------------------------------------------------------------------------------------------------Socket data-flow overview:Client-side data flow
Server-side data flow
-----------------------------------------------------------------------------------------------------------------------------------------------------Communication and Synchronization Details:A linked FIFO queue is used to push data from each sensor and be popped by the write_socket thread to write the data over the socket. Queue.h is the class that supports this data structure. Since each sensor must independently write to the shared memory of the queue, mutex locks and signals must be implemented to ensure correct thread synchronization. There is one shared mutex for control over the queue, as well as one mutex per thread to deal with handling the signal. Whenever data is pushed to the queue from a sensor, the sensor thread signals that txQ is not full, and waits for the write_socket thread to signal that txQ is empty once again before writing more data to it. The write_socket queue runs continuously to empty the queue. ------------------------------------------------------------------------------------------------------------------------------------------------------Parser Details:In order for the server to know exactly which sensor sent the data it is observing, the client attaches a single character to the beginning of each line of data. The server then notices this flag and selects the correct output file for the rest of the data read until another flag is read, in which case it selects another output file for writing. A similar method is used for parsing server commands sent to the client. When the server sends a command, however, it need only be a single character since there are very few transmissions sent to the client. The character is simply parsed by the client and whatever needs to be executed is called directly from where the parser is implemented in the read_socket function. ===================================================================================Adding Additional Sensor Support:------------------------------------------------------------------------------------------------------------------------------------------------------It is quite simple to implement another sensor into this system if the same method is followed as was with the first three. The focus should be mainly on the IMU-605 and the 3DM-GX1 IMU since these are standalone sensors and not integrated into another thread like the encoders are. The new sensor will need its own thread function, including all supporting files for the serial or other communication it needs to acquire data. To integrate the sensor, simply follow the same procedure used in the other two sensor threads:
===================================================================================Adding Additional Robot Support:------------------------------------------------------------------------------------------------------------------------------------------------------It is less trivial to add the option for additional robots. The client software will remain almost unchanged except for changing the port it listens on and the identifiers used for the sensors. On the server, there will need to be several iterations of almost the exact same code, possibly implemented on tabs or other dialog area options. The server will need to be able to select which socket it wants to communicate with, as well as have the option to control all at once. This will require much of the same code as for the single robot instance, however the functions may need to change to allow for broad usage as opposed to specific usage for a particular parsing scheme. =================================================================================== |


