Sending EcScript

Purpose

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.

Download & Setup:

  1. Project Requirements

    Project Prerequisites

  2. Project Startup:

    Project Startup

  3. Download this zip file, which contains the example code:

    pyEcScriptPlayer.zip

  4. Open a terminal window

    Unzip into a new folder. we suggest: projects/examples/pyEcScriptPlayer

  5. 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/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

Run the python gRPC Example:

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 "Model & Control" tab to display the robot model.

ActinViz

Open a new terminal window, then run the python gui script:

$ python ecs_player_gui_sync.py

EcScript Python

  • Click the Connect button to RCF
  • Click the select button to load a script file (choose SimpleMotion.ecs)
  • Click Play button to start the script.

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.

Clean up

After testing the python application, clean up in this order:

  • Close the python app
  • Close ActinViz
  • Stop RCF (Ctrl-C)

Note: You can shutdown and restart the python app while RCF remains running. Just reconnect, load a script, and play.

Getting Help

If you are running into problems running this python example, please contact us at support@energid.com. We can help!