Tutorials

Installation Guidance:


Preparation:

Install mongodb

Install redis

Install anaconda

Environment:

Python==3.9.12

django==4.0.6

channels==3.0.5

pymongo==4.2.0

Port: Django server: 8000

Tcp server: 9000

Local deployment (please see notes_aws.txt for aws deployment)

run Django server: python manage.py runserver

run tcp server: python main.py


Send msg to TCP server (format: bytes) 

You will need to send the message, especially the id to the TCP server right after connection. Thus, the TCP server could recognise the robot id.

Examples: sensors: b'{"time": "2022-07-22 16:14:33","location":'Location1',"id": "humidity", "value": 15}' b'{"time": "2022-07-22 16:14:33", "location":'Location1',"id": "temperature", "value": 5}'

robots: b'{"time": "2022-07-22 16:14:33", "id": "RoboticDog_mobilerobot_0", "action": "location response", "location": {"X":"33", "Y":"99", "Yaw":"99"}}'

actuators: b'{"time": "2022-07-22 16:14:33", "id":"Home_actuator_0", "action": "location response", "location": {"Servo_motor":{"Button": "1", "Reply": "0", "Display": "0"},"DC_motor":{"Button": "0", "Reply": "0", "Display": "0"},"Step_motor":{"Button": "0", "Reply": "0", "Display": "0"}}}'


Please read notes.

We write a shell script for quickly start. 

Please note that you should modify the server_start.sh before everything start. 

Please change the dir of virtual Env if you use conda, otherwise, comment it.

Then the django and tcp server will be started. The port of this django is 8000 and the port of the tcp server is 9000. 

Please make sure you don't have any conflicts. 

For video streaming, please see the instructions at https://github.com/leen-coding/Django_Live_Video

Please change the ip to your ip in var socket = new WebSocket('ws://127.0.0.1:8000/ws/graph/') Iort_aws/web_http/static/sensors.js