fixed a few small errors

This commit is contained in:
Simon Pirkelmann 2019-07-30 22:32:36 +02:00
parent a6af1aa5a6
commit 50b3779de3
3 changed files with 25 additions and 22 deletions

View File

@ -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) | | 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| | Description | Image|
|--------------|---------------| |--------------|---------------|

View File

@ -1,7 +1,5 @@
# Motor shield fix # Motor shield fix
### Get motor shield firmware ### 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))). 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. 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.

View File

@ -1,9 +1,10 @@
# Robot setup # 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) 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/usb_connection.jpeg) ![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 ### Flash Micropython to the Wemos D1 mini
The first step is to flash the micropython firmware to the 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 >>> 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. 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) ![Battery Shield Wires](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) ![Battery Shield Wires](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/webrepl2.jpg)
### Making settings permanent ### 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: 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 # TODO end edit
``` ```
- Upload boot.py via WebREPL - Upload boot.py via WebREPL
![](https://imaginaerraum.de/git/Telos4/RoboRally/raw/branch/master/docs/images/webrepl3.jpg) ![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 it will instead open an access point* - 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 ### 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/`: 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 - `d1motor.py` Interface for the Wemos D1 mini motor shield
- `l293dmotor.py`Interface for alternative motor driver using L293D (no longer used) - `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 ### 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 Now it's time to test if everything is working fine.
![](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)
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 $ ping 192.168.1.101
``` ```
*Note: Make sure you use the correct IP address for your robot.* *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 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 $ 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. 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. 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. 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 The next step is to setup the position detection using ROS. For this see the 4_ROS_SETUP.txt