rpiRobotics / abb_robot_client

Python clients for ABB Robot IRC5 controller RWS and EGM
https://abb-robot-client.readthedocs.io/
Apache License 2.0
15 stars 5 forks source link

Readme improvements - some inputs after testing! #11

Open mattiskoh opened 2 months ago

mattiskoh commented 2 months ago

To start, I'd like to commend you for your work! It works great so far. After testing this repository for some while I've noticed so not so obvious configuration 'issues' that are poorly documented (primarily from ABB)

Some background information: I work with live robots as well as using ABB RobotStudio. We run most of our code from Ubuntu or from WSL (Ubuntu) and so far this has been working rather well.

Two points of feedback, that perhaps could be included in the ReadMe or as a FAQ/Troubleshooting

Situation 1: Setting Digital IOs without the correct access level

Certain ABB IOs can't be set if their access level isn't with the user's access rights. Most users will probably be using the Default User with password robotics I imagine. The function get_digital_io() has default inputs network: str='Local', unit: str='DRV_1', most of these signals are ReadOnly or Default, which can't be access by default by the Default User.

When this happens we receive : abb_robot_client.rws.ABBException: C:\BUILDAGENTS\SEABB-IS-13906.3\_work\12\s\Areas\RobApi2\Components\rws_iosystem\rws_resource_iosystem.cpp[3554] Rejected code:-1073445881 icode:-2

Which after some extensive digging shows us that we need to look at the access level in the robot's configuration.

The way to properly set this up is to either:

  1. Create a user with all access rights
  2. update the Default User's access rights
  3. Change the signals access level (RobotStudio -> Controller -> Configuration -> I/O System -> Signals -> double click signal to modify)

Situation 2 : Accessing RWS from WSL

This is not so specific to this repository but can still be useful for those using WSL, when trying to access RWS via WSL we are encountered with the following error

from abb_robot_client.rws import RWS
# Robot RWS IP of Virtual controller
robot_ip = "172.23.160.1" # my windows IP (vEthernet WSL) in this case
rws= RWS("http://{}:80".format(robot_ip), username='Default User', password='robotics')

# So far everything is fine
rws.get_execution_state()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mattis/meshenv/lib/python3.8/site-packages/abb_robot_client/rws.py", line 335, in get_execution_state
    res_json = self._do_get("rw/rapid/execution")
  File "/home/mattis/meshenv/lib/python3.8/site-packages/abb_robot_client/rws.py", line 213, in _do_get
    return self._process_response(res)
  File "/home/mattis/meshenv/lib/python3.8/site-packages/abb_robot_client/rws.py", line 242, in _process_response
    if response.headers["Content-Type"] == 'application/json' and len(response.content) > 0:
  File "/home/mattis/meshenv/lib/python3.8/site-packages/requests/structures.py", line 52, in __getitem__
    return self._store[key.lower()][1]
KeyError: 'content-type'

After some digging into the python library I found that the response string from the _do_get() function contains "RAPI Unidentified Error" After some googling I found the solution here Which requires us to whitelist our WSL IP address for the virtual controller by adding or editing the file vcconf.xml in `"C:\Users\{user}\AppData\Roaming\ABB Industrial IT\Robotics IT\RobVC\"

with the following content:

<VCConfiguration><RemoteVCConfiguration PublicationEnabled="true" /><hosts><host ip="IP_OF_WSL"/></hosts>

</VCConfiguration>

After this RWS can be accessed normally.

** After some more digging I realized that if I use a different IP this issue doesn't occur. Rather than using the windows WSL IP I use the Windows IP (normal wifi or eth) so in my case 192.168.76.34 and then there is no need to use the whitelisting method.

Windows IP Configuration

Ethernet adapter vEthernet (WSL (Hyper-V firewall)):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::1876:6f73:419c:b04e%53
   IPv4 Address. . . . . . . . . . . : 172.23.160.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :

Wireless LAN adapter Wi-Fi:

   Connection-specific DNS Suffix  . : lan
   IPv6 Address. . . . . . . . . . . : 
   Temporary IPv6 Address. . . . . . : 
   Link-local IPv6 Address . . . . . : 
   IPv4 Address. . . . . . . . . . . : 192.168.76.34
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.76.1

Hope this helps somehow!

johnwason commented 2 months ago

Thanks! This is valuable information.