Reading Actin Logs

Purpose

To demonstrate how to use Python read the ActinRCF logs via gRPC. This tool helpful for debugging. The python client reads the log messages from the gRPC log service and prints it out to the console.

Download & Install Example:

Download & Setup:

  1. Project Requirements:

    Project Prerequisites

  2. Project Startup:

    Project Startup

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

    pyLogExample.zip

  4. Open a terminal window

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

  5. Build the gRPC bindings using the actin proto files:

    $ python compile_protos_log.py

    This will create an actin folder in ~/projects/examples/pyLogExample with these contents:

    actin/rpc/api/log/log_service_pb2.py
    actin/rpc/api/log/log_types_pb2.py
    actin/rpc/api/log/log_service_pb2_grpc.py
    actin/rpc/api/common/common_types_pb2.py

Run the python gRPC Example:

The python log example interfaces to ActinRCF over gRPC. It is an example of how to get log data from Actin.

Note: Make sure Actin RCF and Actin Viz is running.

Open a new terminal window, then run the log client:

$ python log_client.py

You should see that it is waiting to receive logs:

Demo client for Actin Log gRPC Service.
Connecting to RCF via gRPC...
Connected to Log Service at 127.0.0.1:50055.
Available Tags: default OR ecscript, ecsx, none, prototype, rcf
Selected Tags: default
Waiting to receive log messages from service (press CTRL-C to exit)...

In Actin RCF Connection press Connect, you will see:

[<time>][info][log_service]: dist sink added to tag ecscript

Now in Robot Connection toggle Connect, Power, and Control on, the output will show something similar to:

[<time>][info][rcf]: State machine (path = /manipulator_controllers/ur/state_machines/networking) transits to: CONNECTING
[<time>][info][default]: Found Robot Controller for : UR5

[<time>][info][rcf]: State machine (path = /manipulator_controllers/ur/state_machines/networking/dashboard) transits to: CONNECTING
[<time>][info][rcf]: State machine (path = /manipulator_controllers/ur/state_machines/networking/dashboard) transits to: CONNECTED
[<time>][info][rcf]: State machine (path = /manipulator_controllers/ur/state_machines/networking/primary) transits to: CONNECTING
[<time>][info][rcf]: State machine (path = /manipulator_controllers/ur/state_machines/networking/primary) transits to: CONNECTED
[<time>][info][rcf]: State machine (path = /manipulator_controllers/ur/state_machines/networking/rtde) transits to: CONNECTING
[<time>]][info][rcf]: State machine (path = /manipulator_controllers/ur/state_machines/networking/rtde) transits to: CONNECTED
[<time>][info][rcf]: State machine (path = /manipulator_controllers/ur/state_machines/networking) transits to: CONNECTED
[<time>][info][rcf]: State machine (path = /manipulator_controllers/ur/state_machines/robot_mode) transits to: RUNNING
[<time>][info][rcf]: State machine (path = /manipulator_controllers/ur/state_machines/safety_mode) transits to: NORMAL
[<time>][info][rcf]: State machine (path = /manipulator_controllers/ur/state_machines/runtime_state) transits to: STOPPED
[<time>][info][rcf]: State machine (path = /manipulator_controllers/ur/state_machines/synchronization) transits to: ROBOT_TO_ACTIN
[<time>][info][rcf]: State machine (path = /manipulator_controllers/ur/state_machines/networking_check) transits to: CONNECTION_CHECK
[<time>][info][rcf]: State machine (path = /manipulator_controllers/ur/state_machines/runtime_state) transits to: ENABLING_ACTIN_CONTROL
[<time>][info][rcf]: State machine (path = /manipulator_controllers/ur/state_machines/runtime_state) transits to: UNKNOWN
[<time>][info][rcf]: State machine (path = /manipulator_controllers/ur/state_machines/runtime_state) transits to: RUNNING
[<time>][info][rcf]: State machine (path = /manipulator_controllers/ur/state_machines/actin_mode) transits to: IDLE

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