/RoboCup-2018-Driving-Code

This is the final edit of the code that the King's Legacy team will be using during the RoboCup Rapidly Manufactured Robotics League, Montreal, 2018

Primary LanguagePythonMIT LicenseMIT

RoboCup-2018-Driving-Code

This is the final edit of the code that the King's Legacy team will be using during the RoboCup Rapidly Manufactured Robotics League, Montreal, 2018. Please note that the following documentation is for our system as it is currently set up with a raspberry pi and laptop running linux.

Resetting a Dynamixel ID

  1. Navigate to RoboCup-2018-Driving-Code/Dynamixel-Utilities
  2. Run the file dxl_utils.py
  3. Follow the steps as outlined by the code

Testing A Servo’s Capability

  1. Navigate to RoboCup-2018-Driving-Code/Dynamixel-Utilities
  2. Run the file testServo.py

Driving the EmuBot with Camera Feed

  1. Go to any MacBook
  2. Connect to WiFi called Kings_Legacy.Emubot.1 (or .2, depending on which emuBot is being used)
  3. Open a terminal window
  4. Enter ssh pi@192.168.100.1
  5. Enter cd Desktop/Server-Code-2018/
  6. Enter python3 RoboCupServer-Current.py
  7. The server is now running, leave this terminal window be
  8. Navigate to Desktop/RoboCup-2018-Driving-Code/CurrentEmuBotCode2
  9. Make sure the gamepad is plugged in to the laptop
  10. Open client.py in IDLE3 and run
  11. Go to, under the linux control bar at the top Terminal > New Terminal
  12. In this new window, navigate to Desktop/RoboCup-2018-Driving-Code/CurrentEmuBotCode2 via terminal
  13. Enter bash Start_MacStream_MVidPlayer.sh
  14. Go to, under the linux control bar at the top Terminal > New Terminal
  15. In this new code window, follow steps 5-7
  16. Enter bash Start_PiStream.sh
  17. Cache should fill up and have a camera stream via mplayer

Driving the FlipperBot with Camera Feed

  1. Go to any MacBook
  2. Enter the password (“raspberry”)
  3. Connect to WiFi called Kings_Legacy.Flipperbot (or .2, depending on which emuBot is being used) If prompted with password, enter “raspberry”
  4. Open a terminal window
  5. Enter ssh pi@192.168.100.1
  6. Enter cd Desktop/Server-Code-2018/
  7. Enter python3 RoboCupServer-Current.py
  8. The server is now running, leave this terminal window be
  9. Navigate to Desktop/RoboCup-2018-Driving-Code/Client-Code-2018/CurrentFlipperCode
  10. Make sure the gamepad is plugged in to the laptop
  11. Open client.py in IDLE3 and run
  12. Go to, under the linux control bar at the top Terminal > New Terminal
  13. In this new window, navigate to Desktop/RoboCup-2018-Driving-Code/Client-Code-2018/CurrentEmuBotCode2 via terminal
  14. Enter bash Start_MacStream_MVidPlayer.sh
  15. Go to, under the linux control bar at the top Terminal > New Terminal
  16. In this new code window, follow steps 5-7
  17. Enter bash Start_PiStream.sh
  18. Cache should fill up and have a camera stream via mplayer

Driving Code Troubleshooting

  • When running robot code:
    • Incomplete packet: Make sure servos are recieving power and connected to the USB2AX
    • Wrong Header: Source is unknown. Run the code multiple times until the error stops working. If repeated more than 10 times, reboot the robot, make sure all cables are plugged in and all hardware is recieving necesssary power requirements.
    • Broken Joint or Broken Wheel: A number of servos would have broken. The ID will be displayed on the screen. The most common reason of this is if too much torque experienced by the servo. This is fixed by turning the servos on and off. If this error continues with no pressure on the servo, this servo will be required to be replaced.
  • When running laptop code:
    • Broken Pipe error: Make sure the robot's code is still running and does not contain print statments describing which joint or wheel is broken. See above "Broken Joint or Broken Wheel" after quitting the code and before repeating steps 6 and 8.

Sensors: CO2 and Temperature

  1. Follow Steps 1-5 under “Driving the EmuBot”
  2. Enter cd Desktop/Server-Sensor-Code
  3. Enter python3 sensors.py

Sensors: Visual

  1. Follow Steps 1-5 under “Driving the EmuBot”
  2. Go to, under the linux control bar at the top Terminal > New Terminal
  3. Enter cd /Desktop/RoboCup-Driving-Code-2018/Sensor-Code-2018/Vision-Code
  4. Run any of: a. QR Code (my_motion_QRCode.py) b. Movement Code (my_motion_rotation_shadow.py) With the command: bash Start_MacStreamSensors.sh | python
  5. Leave this terminal window be
  6. Connect to robot WiFi
  7. Go to, under the linux control bar at the top Terminal > New Terminal
  8. Enter ssh pi@192.168.100.1
  9. Enter cd Desktop/Server-Code-2018/
  10. Run bash Start_PiStream.sh
  11. Cache should fill up and have a camera stream via python

Sensors: Audio (Microphone)

  1. On a mac, open a new terminal window
  2. Enter cd Desktop/RoboCup-2018-Driving-Code/Sensor-Code-2018/Audio-Code
  3. Enter python3 audioServer.py
  4. Leave this terminal window be
  5. Go to, under the linux control bar at the top Terminal > New Terminal
  6. Enter ssh pi@192.168.100.1
  7. Enter cd Desktop/Server-Sensor-Code/Audio-Code
  8. Enter python3 audioClient.py