Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'PoseVector' object has no attribute 'tolist' #117

Open
YHt666 opened this issue Sep 24, 2023 · 11 comments
Open

AttributeError: 'PoseVector' object has no attribute 'tolist' #117

YHt666 opened this issue Sep 24, 2023 · 11 comments

Comments

@YHt666
Copy link

YHt666 commented Sep 24, 2023

The python version is 3.11. The problem is as follows:
C:\Users\YHT.conda\envs\ur5py311\python.exe E:/UR/myproj1/test.py
tried 11 times to find a packet in data, advertised packet size: -2, type: 3
Data length: 44
tried 11 times to find a packet in data, advertised packet size: -2, type: 3
Data length: 68
tried 11 times to find a packet in data, advertised packet size: -2, type: 3
Data length: 1092
tried 11 times to find a packet in data, advertised packet size: -2, type: 3
Data length: 1418
Traceback (most recent call last):
File "E:\UR\myproj1\test.py", line 10, in
pose = rob.getl() # x,y,z,rx,ry,rz
^^^^^^^^^^
File "C:\Users\YHT.conda\envs\ur5py311\Lib\site-packages\urx\robot.py", line 211, in getl
return t.pose_vector.tolist()
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'PoseVector' object has no attribute 'tolist'

@TrinhNC
Copy link

TrinhNC commented Sep 26, 2023

got the same error. have you solved it?

@MathijsNL
Copy link

I also got this error.

It seems related to the addition of the math3d library. The following function will also give an error:

rob.getl()

It seems in general there has been some degradation in working with tposes. I will try to dive into it somewhere this or next week.

@MathijsNL
Copy link

In the meantime, downgrading to version 0.8.2 works fine if you change this line to False:

MATH3D = False

@axi92
Copy link

axi92 commented Oct 24, 2023

When you change this line https://github.com/SintefManufacturing/python-urx/blob/0.11.0/urx/robot.py#L211
to:
return t.pose_vector.get_array().tolist()
it works again.

@jorge5a
Copy link

jorge5a commented Nov 3, 2023

It didn't works with this change
return t.pose_vector.get_array().tolist()

I use the last version. Another idea?

@YHt666
Copy link
Author

YHt666 commented Nov 4, 2023

I have chosen another package called Universal_Robots_ROS_Driver. No problems so far. You can try it out. Good luck!

@FLandolt
Copy link

In the meantime, downgrading to version 0.8.2 works fine if you change this line to False:

MATH3D = False

HI this worked but have you found a better solution in the mean time ? :D

@n4z3r
Copy link

n4z3r commented Nov 21, 2023

Please fix!! I got it too

@n4z3r
Copy link

n4z3r commented Nov 21, 2023

In the meantime, downgrading to version 0.8.2 works fine if you change this line to False:

MATH3D = False

HI this worked but have you found a better solution in the mean time ? :D

This does not allow movej to work. It lets movel to work though. We need all functionality please.

@se-hwan
Copy link

se-hwan commented Dec 12, 2023

Also had this issue, but fixed it in urx version 0.11.0 with the following fix:

In addition to the fix here: #117 (comment), which addresses using the getl() method, this should address using the movel() and translate() methods for the UR5 arms.

Change this line:

prog = self._format_move(command, tpose, acc, vel, prefix="p")

to this: prog = self._format_move(command, tpose.array, acc, vel, prefix="p")

Similarly, modify this line:

self._wait_for_move(tpose[:6], threshold=threshold)

to this: self._wait_for_move(tpose.array[:6], threshold=threshold)

tpose seems to originally have been some iterable data structure, but is now a PoseVector class from the m3d package. Calling the array method on this class returns an iterable list, which is what the urx methods seem to expect.

It's likely you'll get a constant stream of terminal output warning about deprecation with the dist_squared() function. I commented out this warning in line 280 of vector.py in the math3d package (wherever it is in your virtual environment, system folder, etc.) to suppress this.

I tested that the movel() and translate() functions work, but it still causes an error with the translate_tool() function. Generally, I think a lot of code needs to be refactored to make everything work smoothly with the m3d libraries, but hope this helps.

@zp2546265641
Copy link

Also had this issue, but fixed it in urx version 0.11.0 with the following fix:

In addition to the fix here: #117 (comment), which addresses using the getl() method, this should address using the movel() and translate() methods for the UR5 arms.

Change this line:

prog = self._format_move(command, tpose, acc, vel, prefix="p")

to this: prog = self._format_move(command, tpose.array, acc, vel, prefix="p")
Similarly, modify this line:

self._wait_for_move(tpose[:6], threshold=threshold)

to this: self._wait_for_move(tpose.array[:6], threshold=threshold)
tpose seems to originally have been some iterable data structure, but is now a PoseVector class from the m3d package. Calling the array method on this class returns an iterable list, which is what the urx methods seem to expect.

It's likely you'll get a constant stream of terminal output warning about deprecation with the dist_squared() function. I commented out this warning in line 280 of vector.py in the math3d package (wherever it is in your virtual environment, system folder, etc.) to suppress this.

I tested that the movel() and translate() functions work, but it still causes an error with the translate_tool() function. Generally, I think a lot of code needs to be refactored to make everything work smoothly with the m3d libraries, but hope this helps.
great work you do! happy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants