Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

How to deal with errors related to kortex api

#1
I used the Fusion plugin to generate a robot program from an apt file. However, the following error occurs during execution. I think it has something to do with the kortex api, but could you tell me how to deal with it? Thank you in advance.
Code:
Traceback (most recent call last):
  File "C:\Users\user\Desktop\python_lesson\robodk_program\baritori_fusion.py", line 421, in <module>
    P360_bari1()
  File "C:\Users\user\Desktop\python_lesson\robodk_program\baritori_fusion.py", line 351, in P360_bari1
    robot.MoveL([-74.353700,-53.392600,57.257600,-99.977100,134.674000,-82.047700,-6.895, -6.895, 41.000,  180.000, -0.000, -100.000])
  File "C:\Users\user\Desktop\python_lesson\robodk_program\baritori_fusion.py", line 129, in MoveL
    from kortex_api.autogen.messages import Base_pb2
  File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\kortex_api\autogen\messages\Base_pb2.py", line 9, in <module>
    from google.protobuf import reflection as _reflection
  File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\google\protobuf\reflection.py", line 58, in <module>
    from google.protobuf.internal import python_message as message_impl
  File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\google\protobuf\internal\python_message.py", line 62, in <module>
    from google.protobuf.internal import containers
  File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\google\protobuf\internal\containers.py", line 182, in <module>
    MutableMapping = collections.MutableMapping
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'MutableMapping'
#2
This issue happens when you try to generate a program for a Kinova robot. Correct?

Are you using the UI or the API?
Can you provide us with your RoboDK project?
Are you using the latest version of RoboDK?
#3
Albert, sorry for the late reply.

The program I am trying to create is for mycobot 280 M5 by elephant robotics. At present, the robot configuration is complete, so I am importing apt data from Fusion and trying to reproduce the machining path movement.

Therefore, I would like to know if the current settings are effective for creating a cobot program. I am using mycobot as the post processor.

I am using pymycobot and other UI and API. The version of RoboDK is the latest. I will provide the project, so I would appreciate it if you could check it. I have corrected the program, so I will also add the new error content after execution.


Attached Files
.rdk   test1.rdk (Size: 757.53 KB / Downloads: 28)
#4
Albert, I forgot to attach the error message. I'll attach it now. Thank you.

The python version is Python 3.12.5.

Connecting to robot COM4:12345
Traceback (most recent call last):
File "C:\Users\user\Desktop\python_lesson\robodk_program\P360_bari1.py", line 421, in <module>
P360_bari1()
File "C:\Users\user\Desktop\python_lesson\robodk_program\P360_bari1.py", line 351, in P360_bari1
robot.MoveL([81.923600,-62.959400,137.360000,3.787420,-136.251000,-73.881300,-6.895, -6.895, 41.000,  180.000, -0.000, -160.354]) File "C:\Users\user\Desktop\python_lesson\robodk_program\P360_bari1.py", line 129, in MoveL from kortex_api.autogen.messages import Base_pb2 File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\kortex_api\ autogen\messages\Base_pb2.py", line 9, in <module> from google.protobuf import reflection as _reflection File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\google\protobuf\reflection.py", line 58, in <module> from google.protobuf.internal import python_message as message_impl File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\google\protobuf\internal\python_message.py", line 62, in <module> from google.protobuf.internal import containers File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\google\protobuf\in internal\containers.py", line 182, in <module> MutableMapping = collections.MutableMapping ^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'collections' has no attribute 'MutableMapping'
#5
Can you try using the default version of Python provided with RoboDK for Windows? You should follow these steps:
  1. Select Tools-Options
  2. Select the Python tab
  3. Enter this path as Python interpreter:
    C:/RoboDK/Python-Embedded/python.exe
Or simply select Set Default Settings.
#6
Albert, sorry for the late reply.

Thanks to your advice, I've made some progress.

As per your advice, I've reconfigured it so that I can use the default version of Python that comes with RoboDK for Windows. However, the error still persists. Here is the error. The MutableMapping error from the previous error has now disappeared.

C:\Users\user\Documents\RoboDK\Programs>
python P360_bari1.py Connecting to robot COM4:12345
Traceback (most recent call last): File "C:\Users\user\Documents\RoboDK\Programs\P360_bari1.py", line 421, in <module> P360_bari1() File "C:\Users\ user\Documents\RoboDK\Programs\P360_bari1.py", line 351, in P360_bari1

robot.MoveL([-15.373100,-57.279600,139.407000,-6.433430,-136.862000,-70.253900,-6.895, -6 .895, 41.000, 180.000, -0.000, -150.354]) File "C:\Users\user\Documents\RoboDK\Programs\P360_bari1.py", line 129, in MoveL from kortex_api.autogen.messages import Base_pb2 File "C:\RoboDK\Python-Embedded\Lib\site-packages \shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import return original_import(name, *args, **kwargs) ModuleNotFoundError: No module named 'kortex_api'
#7
It looks like you are running the script from the console. In this case you should install the kortex_api library or include it in your project. A quick workaround is to take this folder:
Code:
C:/RoboDK/Python/kortex_api
And copy it to your Programs folder.
#8
Albert, I apologize for not explaining it well enough.

As you said, I currently connect the robot to the PC and run the program from the console. The reason is that there is no robot driver for the cobot 280 M5, so I thought that this was the only way to run the program.

Or is it possible to run the program on the cobot 280 M5 connected from the RoboDK screen without the robot driver, instead of the console?

By the way, when you say "copy this folder C:/RoboDK/Python/kortex_api," does that mean copying this folder to the default C:\Users\user\Documents\RoboDK\Programs?
#9
Yes, copying the folder to the Programs folder should work as a workaround if you trigger the program by double clicking on it from the same folder.

We are woking on a better fix so you won't need to copy the folder using this workaround.
  




Users browsing this thread:
1 Guest(s)