@import url(http://kodlab.seas.upenn.edu/pub/skins/sinorca/basic.css); @import url(http://kodlab.seas.upenn.edu/pub/skins/sinorca/layout.css); @import url(http://kodlab.seas.upenn.edu/pub/skins/sinorca/sinorca.css);
This summer, my primary task was to integrate a COTS motor controller into the X-RHex/Dynamism system. As with many systems integration tasks, the primary challenges arose due to small errors that had a large and often unexpected effects. By solving these problems, I learned a lot about the inner workings of various systems.
One of the first tasks was to learn how to use the AS5040 magnetic encoder. This encoder uses hall effect sensors to detect the orientation of a diametrically charged magnet. After battling some issues with noise and faulty equipment, I was able to get the AS5040 to output both a quadrature (incremental) and PWM (absolute) signal.
One of the primary tasks this summer was to create a low-level API to interface with the off-the-shelf motor controller we bought (AMC DZRALTE-020L080). The AMC drive has a binary packet protocol, but came with no library. I coded up a c library to construct packets of information according to their protocol specifications. This was fairly straight forward. Most of the problems that initially seemed like library problems ended up being serial problems.
Since I had never touched serial communications, this task first required a lot of background reading on the various aspects of serial programming. I used a unix library called “termios” to interface with the serial UART. One problem that I faced was that termios was replacing certain characters in the packet causing the checksum to fail. Also, I was later able to reduce roundtrip latency significantly by essentially knowing exactly how many bytes to read, thus bypassing the read timeout. I was finally able to get a typical block of data to have a roundtrip time under 5ms (using 921600 baud)
On the actual X-RHex robot, we are using USB for communications, therefore we needed a way to use USB as a serial port. This was accomplished using the FT232 chip from FTDI. We then used the MAX490 chip to convert the 3.3V single ended serial signal to an RS485 differential signal. This allowed us to go up to the highest baud rate of 921600 baud. Unfortunately, USB is optimized for burst data flow instead of continuous data flow. We reduced the ~16ms “chunk” delay by writing data to a file in sysfs.
The last step of my work was to interface with Clark’s Dynamism layer. This was done by taking my low level library, abstracting it to a middle layer update loop, and abstracting that again to the Dynamism layer (which can remain the same for all types of robots). This required quite a bit of troubleshooting and design in order to make everything work together.
Copyright Kodlab, 2017