Software_Servo/Motor controller service
I am going to cover both Servo and Motor controller services in this post since they are quite similar internally and have similar functionalities. Starting with the servo controller service, its responsibilities are to find the servo control unit port by sending the "query" command and assessing the response, connect to the servo_ctrl queue, connect to the servo controller through serial, read incoming messages from the servo_ctrl queue and to send them to the controller unit using serial. It also has a separate thread constantly checking to see if the port is still accessible and to stop the service throwing an exception if it is not, and a simple mechanism for stopping the service if a few consecutive commands send to the controller were missed (a simple implementation of the leaky bucket counter pattern). As you can see: servo_controller_service this part consists of serial command, responsible for sending commands through serial to controller, which has a serial connec...