---
tags: setup, competition, raspberry-pi
---
# 智慧創新 pi-hexapod setup
## Access
1. Auto connect to wifi
SSID:`4a0c`
password:`10000111`
2. `ssh pi@pi-hexapod`, you can replace `pi-hexapod` with local IP address.
password:`root`, this is also the password for root.
3. Nginx welcome webpage: `http://pi-hexapod/`
4. RTMP live video: `rtmp://pi-hexapod/live`
5. RTMP static webpage: `http://pi-hexapod/stat`
6. flask control server: `http://pi-hexapod:5000/`
- http request send from control PC with [Remote_controller_GUI](https://github.com/ghnmqdtg/Remote_controller_GUI)
- http request format
- `/`, GET, return `Hello World\n`
- `/`, POST, `dir` could be `up`, `down`, `left`, `right`, `stretch` or `shrink`.
```json
{
"direction": "dir",
"mode": mode_int
}
```
| dir | Movement of pi-hexapod |
| ------------- | ---------------------- |
| `up` | `walk(True)` |
| `down` | `walk(False)` |
| `left` | `rotate(True)` |
| `right` | `rotate(False)` |
| `stretch` | `stand()` |
| `shrink` | `shrink()` |
| anything else | `rest()` |
| mode_int | Movement of pi-hexapod |
| -------- | ---------------------- |
| 0 | stupid walk |
| 1 | normal walk |
| 2 | best walk |
Return: `oh you posted something\n`.
## Codes and service
Services file are located at `/etc/systemd/system/`. Services should auto start after booting and auto restart on tasks failures. You can find all the service files [here](https://github.com/ghnmqdtg/Remote_controller_GUI/tree/master/in_pi/service).
- Nginx and RTMP Server
- Nginx RTMP config: `/usr/local/nginx/conf/nginx.conf`
- Nginx Service: `nginx.service`
- RTMP push webcam service: `webcam-push-rtmp.service`
- Ref: [Video Streaming Server (nginx, rtmp)](https://hackmd.io/hAXbGzRbRg-bAuHTA2yPVg?view)
- Action control flask server
- File: `/root/hexapod/flask_http_server_service.py`
- git: [Remote_controller_GUI/in_pi/flask_http_server_service.py](https://github.com/ghnmqdtg/Remote_controller_GUI/blob/master/in_pi/flask_http_server_service.py)
- Service: `hexapod-action-server.service`
- RPlidar
Remember to modify the `hostname` in the following python file. Change it to the IP of control PC.
- File: `/root/hexapod/rplidar_tcp_socket_client.py`
- git: [Remote_controller_GUI/in_pi/rplidar_tcp_socket_client.py](https://github.com/ghnmqdtg/Remote_controller_GUI/blob/master/in_pi/rplidar_tcp_socket_client.py)
- Service: `hexapod-rplidar.service`
- Garph on PC:
[rplidar_tcp_socket_server.py](https://github.com/ghnmqdtg/Remote_controller_GUI/blob/master/rplidar_tcp_socket_server.py)
`python rplidar_tcp_socket_server.py`
- Action test file:
- `/root/hexapod/hexapod_action_test.py`, [Remote_controller_GUI/in_pi/hexapod_action_test.py](https://github.com/ghnmqdtg/Remote_controller_GUI/blob/master/in_pi/hexapod_action_test.py)
- `/root/hexapod/usr_input_servo_test.py`, [Remote_controller_GUI/in_pi/usr_input_servo_test.py](https://github.com/ghnmqdtg/Remote_controller_GUI/blob/master/in_pi/usr_input_servo_test.py)