compas-rrc / compas_rrc

Online control for ABB robots over a simple-to-use Python interface.
https://compas-rrc.github.io/compas_rrc/
MIT License
22 stars 6 forks source link

rrc_welcome error #24

Closed inesariza closed 1 year ago

inesariza commented 1 year ago

Describe in a few sentences a summary of what the problem is.

Expected Result

welcome result, connection established

Actual Result

(rrc_lab) C:\Users\arizai\Documents\Projects\algorithmic_details>C:/Users/arizai/Anaconda3/envs/rrc_lab/python.exe c:/Users/arizai/Documents/Pro
[docker_compose.txt](https://github.com/compas-rrc/compas_rrc/files/11099758/docker_compose.txt)
jects/algorithmic_details/src/algorithmic_details/waam/rrc_welcome.py
Connected.
Traceback (most recent call last):
  File "c:/Users/arizai/Documents/Projects/algorithmic_details/src/algorithmic_details/waam/rrc_welcome.py", line 9, in <module>
    abb.send_and_wait(rrc.PrintText('Welcome to COMPAS_RRC'))
  File "C:\Users\arizai\Anaconda3\envs\rrc_lab\lib\site-packages\compas_rrc\client.py", line 253, in send_and_wait  
    future = self.send(instruction)
  File "C:\Users\arizai\Anaconda3\envs\rrc_lab\lib\site-packages\compas_rrc\client.py", line 203, in send
    self.ensure_protocol_version()
  File "C:\Users\arizai\Anaconda3\envs\rrc_lab\lib\site-packages\compas_rrc\client.py", line 146, in ensure_protocol_version
    raise Exception('Protocol version mismatch. Server={}, Client={}'.format(self._server_protocol_check['version'], CLIENT_PROTOCOL_VERSION))
Exception: Protocol version mismatch. Server=None, Client=2

Reproduction Steps

Provide a reproducible test case that is the bare minimum necessary to generate the problem.

import compas_rrc as rrc

ros = rrc.RosClient()
ros.run()

abb = rrc.AbbClient(ros, '/rob1')
print('Connected.')

abb.send_and_wait(rrc.PrintText('Welcome to COMPAS_RRC'))

ros.close()

System Information

Win 10 64-bit Python 3.8.8 compas_rrc 1.1.0 Robot C31_R31 Attached the docker_compose.yml I am running docker_compose.txt

the docker_compose attached here that I am running is not the same as the one here, could this be it?

gonzalocasas commented 1 year ago

I think the robot has an old version of RRC, is that possible? I don't think updating the compose file to match the other one you linked will change much, on the other hand, it would be 5 minutes to test that, so perhaps give it a go.

inesariza commented 1 year ago

thx for the reply!

when i run the updated docker file: the original error is gone. but I only get 'Connected.' on my side, I don't receive the message on the TP.

other potential problems: IP address incorrect on laptop (checked, should be OK). also checked: ping 192.168.125.1 and it works.

curious: when I run another file besides welcome_rrc.py, for example this, I get the same? error message posted above.

Traceback (most recent call last):
  File "c:/Users/arizai/Documents/Projects/algorithmic_details/src/algorithmic_details/waam/run_WAAM.py", line 186, in <module>
    feedback = experiment_call(exp_id, 'waam_column_conn', waam_column_conn_options, output_folder, waamconnection, abb)
  File "C:\Users\arizai\Documents\Projects\algorithmic_details\src\algorithmic_details\experiments\experiment_call.py", line 78, in experiment_call     
    feedback = fab_procedure.start(robot_client, path, fab_procedure.options)
  File "C:\Users\arizai\Documents\Projects\algorithmic_details\src\algorithmic_details\experiments\fab_procedure.py", line 43, in start
    feedback = func(robot_client, frames, options)
  File "C:\Users\arizai\Documents\Projects\algorithmic_details\src\algorithmic_details\waam\waam_column_conn.py", line 80, in waam_column_conn
    robot_client.send(SetTool('t_A036_WG1_Robacta22'))
  File "C:\Users\arizai\Anaconda3\envs\rrc_lab\lib\site-packages\compas_rrc\client.py", line 203, in send
    self.ensure_protocol_version()
  File "C:\Users\arizai\Anaconda3\envs\rrc_lab\lib\site-packages\compas_rrc\client.py", line 146, in ensure_protocol_version
    raise Exception('Protocol version mismatch. Server={}, Client={}'.format(self._server_protocol_check['version'], CLIENT_PROTOCOL_VERSION))
Exception: Protocol version mismatch. Server=None, Client=2
gonzalocasas commented 1 year ago

To expand on my previous comment: I'm almost sure one or more of the 3 components of RRC (the code on the robot, the code inside Ros, or the python code on the user side) is outdated because this error used to pop up very often in the past, but nowadays i haven't received it in a long time.

gonzalocasas commented 1 year ago

If "Connected" shows, it means the connection up to ROS is correct, but from ROS to the robot might still be failing. Could you check the logs of the rrc service in the docker desktop app and see if there's any error there?

inesariza commented 1 year ago

Indeed docker_errors.txt

gonzalocasas commented 1 year ago

This is trying to connect to a robot on 192.168.125.1, you mentioned the IP is ping-able so i assume that part is fine. (However your first compose file used a different IP address).

If the IP is correct , the something is not correct on the robot side: is RRC starting correctly when you PP to main and then Play?

inesariza commented 1 year ago

(However your first compose file used a different IP address).

thank you for catching that! the new docker file is using 192.168.125.1, which is pingable, correct.

is RRC starting correctly when you PP to main and then Play?

can't remember what's "correctly". it prints this and that's it:

T_ROB1 -> RRC Main
T_CTRL -> RRC Main
T_RX -> RRC Main
T_TX -> RRC Main

now I tried to connect to a newer project installed on the robot controller and the rrc_welcome.py runs completely (print on the TP, sends feedback, ends). is then the problem that the project setup is not updated on the robot controller? could you let me know @fleischp which update should i make?

thank you!

fleischp commented 1 year ago

after a successful connection you should see this "T_CTRL -> Connected" or at least something similar. In the RFL we have the special project management and the issue is there because during the initial project startup the project specific rrc configuration is loaded. In your project "A036" we have the following configuration:

    PROC r_A036_RRC_Config()

       ! IP Address
        b_RRC_AutoIPAddress:=TRUE;

This means the controller selects the IP automatically, so in your case you need to use the WAN Port (insede the controller on the main computer) instead of the Service Port at the front of the controller. I will switch Aurèle's Project to this configuration too and then both have to us the IP "192.168.0.31" in docker.

inesariza commented 1 year ago

great. that works for running welcome_rrc.py!

but I get the same error when I run my file, and I can't tell the difference:

Traceback (most recent call last):
  File "c:/Users/arizai/Documents/Projects/algorithmic_details/src/algorithmic_details/waam/run_WAAM.py", line 186, in <module>
    feedback = experiment_call(exp_id, 'waam_column_conn', waam_column_conn_options, output_folder, waamconnection, abb)
  File "C:\Users\arizai\Documents\Projects\algorithmic_details\src\algorithmic_details\experiments\experiment_call.py", line 78, in experiment_call
    feedback = fab_procedure.start(robot_client, path, fab_procedure.options)
  File "C:\Users\arizai\Documents\Projects\algorithmic_details\src\algorithmic_details\experiments\fab_procedure.py", line 43, in start
    feedback = func(robot_client, frames, options)
  File "C:\Users\arizai\Documents\Projects\algorithmic_details\src\algorithmic_details\waam\waam_column_conn.py", line 80, in waam_column_conn  
    robot_client.send(SetTool('t_A036_WG1_Robacta22'))
  File "C:\Users\arizai\Anaconda3\envs\rrc_lab\lib\site-packages\compas_rrc\client.py", line 203, in send
    self.ensure_protocol_version()
  File "C:\Users\arizai\Anaconda3\envs\rrc_lab\lib\site-packages\compas_rrc\client.py", line 146, in ensure_protocol_version
    raise Exception('Protocol version mismatch. Server={}, Client={}'.format(self._server_protocol_check['version'], CLIENT_PROTOCOL_VERSION))  
Exception: Protocol version mismatch. Server=None, Client=2

I am running these two files in the same conda environment (I understand they are calling the same version of rrc).

any ideas?

fleischp commented 1 year ago

Can you share the first rrc lines (creating and connecting to ROS client and ABB client) of your code? Plus your compos file for the rrc driver?

inesariza commented 1 year ago

My code:

from compas_rrc import AbbClient
from compas_rrc import Zone
from compas_fab.backends import RosClient

# Create Ros Client
ros = RosClient()
ros.run()

abb = AbbClient(ros, '/')
print('Connected')

prints Connected correctly!

docker file attached: compose.txt

inesariza commented 1 year ago

If I replace from compas_fab.backends import RosClient with from compas_rrc import RosClient I see the message on the TP: T_CTRL -> RRC-Connected > so that's good.

But the program stops and the error in the terminal is the same:

Traceback (most recent call last):
  File "c:/Users/arizai/Documents/Projects/algorithmic_details/src/algorithmic_details/waam/run_WAAM.py", line 186, in <module>
    feedback = experiment_call(exp_id, 'waam_column_conn', waam_column_conn_options, output_folder, waamconnection, abb)
  File "C:\Users\arizai\Documents\Projects\algorithmic_details\src\algorithmic_details\experiments\experiment_call.py", line 78, in experiment_call
    feedback = fab_procedure.start(robot_client, path, fab_procedure.options)
  File "C:\Users\arizai\Documents\Projects\algorithmic_details\src\algorithmic_details\experiments\fab_procedure.py", line 43, in start
    feedback = func(robot_client, frames, options)
  File "C:\Users\arizai\Documents\Projects\algorithmic_details\src\algorithmic_details\waam\waam_column_conn.py", line 80, in waam_column_conn  
    robot_client.send(SetTool('t_A036_WG1_Robacta22'))
  File "C:\Users\arizai\Anaconda3\envs\rrc_lab\lib\site-packages\compas_rrc\client.py", line 203, in send
    self.ensure_protocol_version()
  File "C:\Users\arizai\Anaconda3\envs\rrc_lab\lib\site-packages\compas_rrc\client.py", line 146, in ensure_protocol_version
    raise Exception('Protocol version mismatch. Server={}, Client={}'.format(self._server_protocol_check['version'], CLIENT_PROTOCOL_VERSION))  
Exception: Protocol version mismatch. Server=None, Client=2
inesariza commented 1 year ago

OK, fixed. I replaced: abb = AbbClient(ros, '/') with abb = AbbClient(ros, '/rob1')