To demonstrate how to use Python to control a robot in either SIM mode or SERVO mode via gRPC. The python app attaches to the a running ActinRCF process over a network connection, The RCF process controls the simulation or robot hardware under direction of EcScript.
Project Requirements
Project Startup:
Download this zip file, which contains the example code:
Open a terminal window
Unzip into a new folder. we suggest: projects/examples/pyEcScriptPlayer
Build the gRPC bindings using the actin proto files.
$ python compile_protos.py
This will create an actin
folder in ~/projects/examples/pyEcScriptPlayer
with the following contents:
actin
actin/rpc
actin/rpc/api
actin/rpc/api/ec_script
actin/rpc/api/ec_script/ec_script_service_pb2.py
actin/rpc/api/ec_script/ec_script_service_pb2_grpc.py
actin/rpc/api/ec_script/ec_script_types_pb2.py
The python example interfaces to ActinRCF over gRPC. It serves as example of how to use gRPC to submit scripts to ActinRCF and control scripts.
Connect to RCF by clicking the connect button In ActinViz.
Click on the cube icon (upper left) to display the robot model.
Open a new terminal window, then run the python gui script:
$ python ecs_player_gui_sync.py
You can Play | Pause | Resume | Stop
from the python app or ActinViz. Noticed that their states are synchronized and that the sim is running running.
Repeat, this time using either URSim or connected to your UR robot. If you switch between URSim and the physical robot, remember to update the project workspace.json
file and restart ActinRCF.
After testing the python application, clean up in this order:
Note: You can shutdown and restart the python app while RCF remains running. Just reconnect, load a script, and play.
If you are running into problems running this python example, please contact us at support@energid.com. We can help!