diff --git a/docs/1_ASSEMBLY.md b/docs/1_ASSEMBLY.md index f147c40..efc11a7 100644 --- a/docs/1_ASSEMBLY.md +++ b/docs/1_ASSEMBLY.md @@ -61,7 +61,7 @@ Assemble the chassis according to the instructions provided by adafruit ([see he | This is how the battery shield should look like with the two wires | ![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_battery_stack_6.5.jpeg) | -7. Next, we create a connector for the female JST 2-Pin connector for pluggin in the battery: +7. Next, we create a connector for the female JST 2-Pin connector for plugin in the battery: | Description | Image| |--------------|---------------| diff --git a/docs/2_MOTOR_SHIELD_FIX.md b/docs/2_MOTOR_SHIELD_FIX.md index 6fd0966..bd2d80b 100644 --- a/docs/2_MOTOR_SHIELD_FIX.md +++ b/docs/2_MOTOR_SHIELD_FIX.md @@ -1,7 +1,5 @@ # Motor shield fix - - ### Get motor shield firmware The Wemos motor shield comes with a buggy firmware which has problems with the I2C communication ([see here]([buggy firmware](https://hackaday.io/project/18439-motor-shield-reprogramming))). Luckily, some guys figured out how to update the firmware of the STM32 on the motor shield with a custom one that fixes these issues. diff --git a/docs/3_ROBOT_SETUP.md b/docs/3_ROBOT_SETUP.md index 96bc558..ce39c33 100644 --- a/docs/3_ROBOT_SETUP.md +++ b/docs/3_ROBOT_SETUP.md @@ -1,9 +1,10 @@ # Robot setup -This file explains how to setup the software for the robots. It assumes that you already assembled your robot according to the instructions in 1_ASSEMBLY.md and 2_MOTOR_SHIELD_FIX.md +This file explains how to setup the software for the robots. It assumes that you already assembled your robot according to the instructions in 1_ASSEMBLY.md and that you updated the firmware of the motor shield as described in 2_MOTOR_SHIELD_FIX.md. -Before we start, stack the D1 mini ontop of the battery shield and connect it to your computer using a micro USB cable ![](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_battery_stack_13.jpeg) -![](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/usb_connection.jpeg) +Before we start, stack the D1 mini ontop of the battery shield and connect it to your computer using a micro USB cable: +![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/motor_battery_stack_13.jpeg) +![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/usb_connection.jpeg) ### Flash Micropython to the Wemos D1 mini The first step is to flash the micropython firmware to the D1 mini. @@ -49,11 +50,11 @@ First we enable WebREPL on the microcontroller which allows us to easily upload >>> sta_if.ifconfig() # this prints the IP ``` -Joing join the same WiFi network with your PC (either the access point or the local network) and connect to the D1 mini via the [online WebREPL](http://micropython.org/webrepl): +Join the same WiFi network with your PC (either the access point or the local network) and connect to the D1 mini via the [online WebREPL](http://micropython.org/webrepl): Enter IP from above and click connect. Login with the password you set for the WebREPL. -![](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/webrepl0.jpg) -![](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/webrepl1.jpg) -![](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/webrepl2.jpg) +![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/webrepl0.jpg) +![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/webrepl1.jpg) +![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/webrepl2.jpg) ### Making settings permanent In order to avoid having to set up the WebREPL and the WiFi everytime we reboot the robot we can upload a file called boot.py which runs each time the robot restarts: @@ -70,8 +71,9 @@ dns = '192.168.1.1' # TODO end edit ``` - Upload boot.py via WebREPL - ![](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/webrepl3.jpg) - - Now the robot will automatically connect to WiFi network you set and start a WebREPL server after reboot. *Note: If the WiFi network cannot be found it will instead open an access point* + ![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/webrepl3.jpg) + - Now the robot will automatically connect to WiFi network you set and start a WebREPL server after reboot. + *Note: If the WiFi network cannot be found the microcontroller will instead open an access point.* ### Upload robot firmware Next, upload the motor controller script to the microcontroller. At the moment the firmware consists of the following three files located in `micropython_firmware/`: @@ -80,22 +82,25 @@ Next, upload the motor controller script to the microcontroller. At the moment t - `d1motor.py` Interface for the Wemos D1 mini motor shield - `l293dmotor.py`Interface for alternative motor driver using L293D (no longer used) -You can upload these files the same way you did before within the WebREPL terminal. After uploading all the files reboot the microcontroller by pressing the reset button or by pressing `Ctrl+D` in the WebREPL prompt. +You can upload these files the same way you did before with the WebREPL. After uploading all the files reboot the microcontroller by pressing the reset button or by pressing `Ctrl+D` in the WebREPL prompt. ### Test the robot -Now it's time to test if everything is working fine. Disconnect the USB cable from the microcontroller and connect the battery to the battery connector -![](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/battery_connection.jpeg) -Next, connect the two motors of the robot to the motor shield according to the following sketch: -![](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/robot_bb.jpg) -![](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/battery_connection_overview.jpeg) +Now it's time to test if everything is working fine. -Test if you can reach the robot using +- Disconnect the USB cable from the microcontroller and connect the battery to the battery connector: +![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/battery_connection.jpeg) + +- Next, connect the two motors of the robot to the motor shield according to the following sketch: +![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/robot_bb.jpg) +![Battery Shield Wires](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/battery_connection_overview.jpeg) + +- Test if you can reach the robot using ``` $ ping 192.168.1.101 ``` *Note: Make sure you use the correct IP address for your robot.* -If everything worked, connect to the robot via WebREPL as before. Don't worry if the prompt does not appear to be working. The robot is running a program waiting for incoming connections for remote control. +- If everything worked, connect to the robot via WebREPL as before. Don't worry if the prompt does not appear to be working. The robot is running a program waiting for incoming connections for remote control. We can connect to the robot via a socket on port `1234`. There is a simple demo program which illustrates how to control the robot remotely via keyboard. The program uses `pygame` for input handling so make sure to install it using ``` $ sudo pip install pygame @@ -108,7 +113,7 @@ When running the program you should see an output in the WebREPL that a connecti You can use the arrow keys for sending commands to the microcontroller which it then passes on to the motors. Now you're all set up for controlling your robot remotely via wifi. -You can control the robot by send commands to the robot as a string containing `'(u1, u2)\n'`, where `u1` and `u2` are floats in the range `[-1.0, 1.0]`. +You can control the robot by sending commands to the robot as a string containing `'(u1, u2)\n'`, where `u1` and `u2` are floats in the range `[-1.0, 1.0]`, e.g. `'(0.3, -0.6)\n'`. Have a look at the `keyboard_controller.py` script to see how this works in python. -The next step is to setup the position detection using ROS. For this see the ROS_SETUP.txt \ No newline at end of file +The next step is to setup the position detection using ROS. For this see the 4_ROS_SETUP.txt \ No newline at end of file