Improving communications
Removed lots of PMD and Checkstyle complaints. Create own PortCom class to encapsulate repeatedly needed COM functionality, especially blocking reads with time-out. Added calibration functions to the servo class. Refactored the package structure (less deep, and more meaningful). Put simulation classes into their own package. Debugged the SensorIntegrator. Added an optional "return to zero" function that decays the current value to 0 when the input value is 0.0.
Created x and y component sensors for the POV switch. Did not realize the "idle" position of the POV switch is indicated by a negative value, not 0 (which stands for "Up"). This caused the integrated value to run away, and the "idle" position was not recognized properly.
I noticed that steadily increasing servo position values resulted in jerky advance of the servo position. Fixed problem with transmitting servo position: I had created a command string using "+ char(value)" to add byte size values, and used String.getBytes() to get a byte representation to write to the controller output stream. This goes wrong for a number of values: the default encoding seems to get into the way. Now, I still use a string converted to a byte array, but I change the values in the byte array, not the string - works! This inspired me to try again for the baud rate switching of the servo controller (see below).
Increased the integration timer tick from 20 times to 50 times per second (decreased loop delay from 50ms to 20ms), surprised it worked at that rate. The value changes much smoother now.
Managed to switch the servo controller to fast baud rate, though I'm never able to receive the complete switch confirmation message (the last byte is always missing). The software detects by time out if the controller is in slow mode, and tries to switch to fast mode accordingly. The result: the reaction time of the servos has clearly improved (really smooth movement closely following the stick input).
Created x and y component sensors for the POV switch. Did not realize the "idle" position of the POV switch is indicated by a negative value, not 0 (which stands for "Up"). This caused the integrated value to run away, and the "idle" position was not recognized properly.
I noticed that steadily increasing servo position values resulted in jerky advance of the servo position. Fixed problem with transmitting servo position: I had created a command string using "+ char(value)" to add byte size values, and used String.getBytes() to get a byte representation to write to the controller output stream. This goes wrong for a number of values: the default encoding seems to get into the way. Now, I still use a string converted to a byte array, but I change the values in the byte array, not the string - works! This inspired me to try again for the baud rate switching of the servo controller (see below).
Increased the integration timer tick from 20 times to 50 times per second (decreased loop delay from 50ms to 20ms), surprised it worked at that rate. The value changes much smoother now.
Managed to switch the servo controller to fast baud rate, though I'm never able to receive the complete switch confirmation message (the last byte is always missing). The software detects by time out if the controller is in slow mode, and tries to switch to fast mode accordingly. The result: the reaction time of the servos has clearly improved (really smooth movement closely following the stick input).


0 Comments:
Post a Comment
<< Home