Provide vs2020-sentinel
that controls the program VisualStage 2020
.
This command enables users to develop a program by talking to VisualStage 2020
.
The command vs2020-sentinel
is for control VisualStage 2020
via network.
YY confirmed this work with VisualStage Version 1.2.2.0.
Include "C:\Python37;C:\Python37\Scripts" in %PATH%.
Install this package as Administrator as:
ADMIN.CMD> pip install git+https://github.com/misasa/vs2020/archive/refs/heads/master.zip
or download vs2020-master.zip to a local directory and install it as Administrator as:
$ cd ~/Downloads/
$ wget https://github.com/misasa/vs2020/archive/refs/heads/master.zip
ADMIN.CMD> cd %USERPROFILE%\Downloads\
ADMIN.CMD> pip list
ADMIN.CMD> pip uninstall vs2020
ADMIN.CMD> pip install vs2020-master.zip
Successful installation is confirmed by:
CMD> vs2020-sentinel --help
Commands are summarized as:
command | description | note |
---|---|---|
vs2020-sentinel | Control VisualStage 2020 via network |
See online document with option --help
.
Start VisualStage2020 and lunch vs2020-sentinel as shown below. Revise configuration file (~/.vs2020rc) when necessary.
> vs2020-sentinel
reading |C:\Users\SEM\.vs2020rc| ...
2022-01-27 16:28:14,345 INFO:version 0.0.1
2022-01-27 16:28:14,345 INFO:connecting database.misasa.okayama-u.ac.jp:1883
2022-01-27 16:28:14,365 INFO:Connected with result code 0
2022-01-27 16:28:14,365 INFO:subscribe topic |stage/ctrl/stage-of-5fBX60| to receive stage control command...
2022-01-27 16:28:15,474 INFO:connecting stage controller...
2022-01-27 16:28:15,474 INFO:starting thread_position...
2022-01-27 16:28:15,474 INFO:publish message {"isStageConnected": "false", "isVSRunning": "true", "isAPIAvailable": "true", "isStageMoving": "false", "dataname": "", "updated_at": "2022-01-27T16:28:15"} on topic stage/status/stage-of-5fBX6
2022-01-27 16:28:15,484 INFO:POSITION -> POSITION SUCCESS,-338.86148,471.68106 (response: 0.01 sec) in position
2022-01-27 16:28:15,494 INFO:publish message {"x_world": "-338.86148", "y_world": "471.68106", "updated_at": "2022-01-27T16:28:15"} on topic stage/position/stage-of-5fBX60
2022-01-27 16:28:15,494 INFO:publish message {"command": "POSITION", "output": "POSITION SUCCESS,-338.86148,471.68106", "response": 0.010000228881835938, "updated_at": "2022-01-27T16:28:15"} on topic stage/info/stage-of-5fBX60
2022-01-27 16:28:16,475 INFO:publish message {"isStageConnected": "true", "isVSRunning": "true", "isAPIAvailable": "true", "isStageMoving": "false", "dataname": "", "updated_at": "2022-01-27T16:28:16"} on topic stage/status/stage-of-5fBX60
2022-01-27 16:28:16,495 INFO:POSITION -> POSITION SUCCESS,-338.86148,471.68106 (response: 0.00 sec) in position
2022-01-27 16:28:16,495 INFO:publish message {"x_world": "-338.86148", "y_world": "471.68106", "updated_at": "2022-01-27T16:28:16"} on topic stage/position/stage-of-5fBX60
2022-01-27 16:28:16,495 INFO:publish message {"command": "POSITION", "output": "POSITION SUCCESS,-338.86148,471.68106", "response": 0.0, "updated_at": "2022-01-27T16:28:16"} on topic stage/info/stage-of-5fBX60
2022-01-27 16:28:17,475 INFO:publish message {"isStageConnected": "true", "isVSRunning": "true", "isAPIAvailable": "true", "isStageMoving": "false", "dataname": "", "updated_at": "2022-01-27T16:28:17"} on topic stage/status/stage-of-5fBX60
2022-01-27 16:28:17,495 INFO:POSITION -> POSITION SUCCESS,-338.86148,471.68106 (response: 0.00 sec) in position
2022-01-27 16:28:17,495 INFO:publish message {"x_world": "-338.86148", "y_world": "471.68106", "updated_at": "2022-01-27T16:28:17"} on topic stage/position/stage-of-5fBX60
2022-01-27 16:28:17,495 INFO:publish message {"command": "POSITION", "output": "POSITION SUCCESS,-338.86148,471.68106", "response": 0.0, "updated_at": "2022-01-27T16:28:17"} on topic stage/info/stage-of-5fBX60
....
> cat ~/.vs2020rc
---
stage_name: stage-of-sisyphus-THINK
timeout: 8000
vsdata_path: Z:\
world_origin: ld
stage_origin: ru
Access machine list and open an Edit Machine (ex. SIMS-1280) for the machine you want to control (by clicking the gear icon next to the machine name on the list).
Input the stage name (for example stage-of-sisyphus-THINK
) and click OK.
Then you can see the XY position of the stage on web browser in real time.
Download and install a MQTT client software mosquitto
To receive current position (and status) of stage-of-sisyphus-THINK
, issue following command.
> mosquitto_sub -h database.misasa.okayama-u.ac.jp -t stage/info/stage-of-sisyphus-THINK
In order to move the stage stage-of-sisyphus-THINK
to the specified position (for example [0.0, 0.0]), issue following command.
> mosquitto_pub -h database.misasa.okayama-u.ac.jp -t stage/ctrl/stage-of-sisyphus-THINK -m "{\"command\":\"GOTO\",\"d_x\":\"0.0\",\"d_y\":\"0.0\"}"