SoW-B Remote Control


1SoW-B Remote Control MVP

Previous test of the board demonstrated that the HotBlack Shield V1 and the Raspberry Pi are working as intended.
Next steps are:
  • Serial Interface: Test bidirectional data transfer between RPI and HotBlack Shield V1
  • Firmware: Running on HotBlack Shield V1. Port from servomotors to DC motors. Bugfix.
  • Software: Running on the RPI. Change OS image name. Test webserver and remote control.

2Software Upgrade

The operating system is a cloned flash image transplanted directly from Maze Runner to Seeker Of Ways B.
Two configurations needed to be updated:
  • IP Address: Ethernet. Changed to 192.168.1.203
  • Image Name: Changed to “Seeker Of Ways B”

Illustration 1: OS Robot Name



3Test: Serial Interface

In order to test the serial interface, two test modules have been implemented.
  • NODE.JS application that sends and receive data through the serial interface on the GPIO connector.
  • Added driver for the UART to the firmware running inside the shield. Implements loopback and send one character every second.
For the serial test, the NODE.JS application send the string “P” including the terminator two times a second, and print on the console every character received from the UART.
UNIPARSER V4 is the firmware library that decodes an incoming serial streams in commands and automatically call handler functions with arguments like you would do with a scanf.
The Firmware is configured to toggle LED0 each time a command is fully decoded . Valid commands for this test are:
  • “P” Pin command. Used to reset the communication timeout.
  • “F” Find command. The board answers with its signature “SeekerOfWaysB-00002”
  • “PWMR%SL%S” PWM command. Set the PWM of two DC motors to the 16 bit integer provided in input.

Illustration 2: Serial Test Architecture
Through a SSH client is possible to launch the NODE.JS application in execution and receive the console output.


Illustration 3: Serial Test SSH Console Output
The test was a success on first try with a baud rate settings of 56Kb/s.

Illustration 4: 56Kb/s AT644 UART0 TX channel waveform and decoding
With the success of the test, baud rate was increased to 256Kb/s on the RPI side and to 250Kb/s on the AT644 side. The mismatch is due to imperfection in the UART prescaler. Increasing the UART speed decreases the latency of the commands.

Illustration 5: 256Kb/s RPI ttyS0 TX channel waveform and decoding
The waveforms look clean enough and there seems to be no trouble with the UART channel transmission in both directions.


4Test: Motor Control

With the serial interface operational, next step was to test control of the motors from the NODE.JS application running inside the RaspberryPi through the PWM command.
The architecture remains pretty much the same as the previous test.


Illustration 6: Serial Test Architecture
Two additional features were developed for this test, both tested and working:
  • Communication timeout: If the Raspberry pi dies and communication ceases, the HotBlack Shield stops all motors. Without it the robot would keep executing the last valid command, aka running straight into a wall.
  • Slew Rate limiter: The actual command to the motors cannot vary by more than a user defined value in PWM units per second. This makes sure the robot cannot be reversed in directions in short intervals, avoiding damage to both the motor drivers and the motors themselves.



Video 1: PWM waveforms



Video 2: Motor test with commands generated by the RPI


4.1Uniparser V4 Bug

Testing revealed a bug within the uniparser v4 library.

Illustration 7: Uniparser V4 bug
The command “PWMR-127L127” is translated as R=-127 | L = -127 (wrong) instead of R=-127 | L = +127. This likely happens because the argument sign flag is not reset from previous argument if an explicit sign is not used. Workaround is to explicitly send the + sign with positive numbers.

5Test: Remote Control

The stack to allow SoW-B to be controlled remotely via browser was developed for the Maze Runner MVP DEMO. Only a change in baud rate from 56Kb/s to 256Kb/s and a modification of the DC motor PWM command were necessary to port the software to SoW-B.
This application does not make use of the video stream component as SoW-B uses a raspicam while MR used an USB camera. A redesign of the video streaming software stack was due for a redesign anyway since the current pipeline only performs to about 300[ms] of latency.

Illustration 8: Seeker Of Ways B Remote Control MVP Architecture
The architecture of the remote control MVP demo works as intended. The test was made with a very slow slew rate limiting factor of 5.12[s]



Video 3: SoW-B Remote control MVP Demo
In this demo the wasd keys are bind to the direction of the platform.
Default PWM is 50% and can be increased/decreased with the +/- keys.


6Source Code Repositories

Link to the GitHub repositories for the NODE.JS application and the AtMega644A Firmware.

7Conclusions

The remote control of Seeker Of Ways B through a web browser is operational.
Next steps:
  • Install Wi-Fi access point functionality on the platform to allow control through web browser through Wi-Fi connection
  • Develop the Raspicam UDP WebRTC streaming pipeline
  • Fix Uniparser V4 issue
  • Add speed PID motor control on the PID




No comments: