10-04-2024, 07:27 AM (This post was last modified: 10-04-2024, 08:39 AM by Albert.)
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'
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.
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'
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'
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:
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?