Skip to content

Setup Web Service

Ks Tan edited this page Feb 1, 2021 · 1 revision

This project running as Python Flask, if you have experience in Flask you may feel it is handy for you:

  1. Checkout this repository
  2. Edit ar3_robotarm_webservice/ar3_webservice/include/values.py, change the teensy and arduino port value to match your computer setting.
Example:
windows, Teensy=COM3, Arduino Mega: COM4)
linux, Teensy=/dev/ttyACM0, Arduino Mega=/dev/ttyUSB0
MAC, Teensy=/dev/tty.usbmodem70426001 (or /dev/cu.usbmodem...), Arduino Mega=/dev/tty.usbserial-14410 (or /dev/cu.usbserial...)

You can double check port using Arduino IDE if you not sure.

  1. in terminal, cd into ar3_robotarm_webservice/ar3_webservice, run following command
export FLASK_APP=route.py
flask run

You will notice your statement like ARM conneced, and show "Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)". Remain terminal open and go to another new terminal, continue next step

  1. use terminal, execute sh path_to_ar3_webservice/tools/trymotor.sh

  2. If success, you will notice AR3 gripper and joint move by itself, important content of trymotor.sh as below:

curl http://127.0.0.1:5000/servo/mygripper?degree=90
curl http://127.0.0.1:5000//move_j/j1?degree=10
  1. Use web browser to browse, hope it work fine
curl http://127.0.0.1:5000//move_j/j1?degree=10
curl http://127.0.0.1:5000//move_j/j1?degree=-10
Clone this wiki locally