Please advice about the error message of RoboView

Hello,

Several days ago, I was attracted by the fascinating picture of KDL. I wish to learn more about it. After google for a while, I found that RoboView might be a good start point. So, I download it, compile it, and unfortunately I got some error messages.

Would you please provide some hint about the root cause of the error message? And, how should I resolve it?

 ysli@nemea:~/proj/orocos/roboview$ ./roboview robodef.py Traceback (most recent call last): 
  File "./roboview", line 6, in 1
    import main
  File "/home/ysli/proj/orocos/roboview/main.py", line 216, in 2
    scene.add_to(display)
  File "/home/ysli/proj/orocos/roboview/main.py", line 131, in add_to
    self.robot.add_to(display)
  File "/home/ysli/proj/orocos/roboview/ui.py", line 270, in add_to
    widget.add_to(display)
  File "/home/ysli/proj/orocos/roboview/ui.py", line 135, in add_to
    display.add(None, t(make_link_cylinder(self.joint)), opacity=.3)
  File "/home/ysli/proj/orocos/roboview/ui.py", line 115, in make_link_cylinder
    make_vector_x_base(link_frame, vec_from_matrix(frame))
  File "/home/ysli/proj/orocos/roboview/ui.py", line 88, in vec_from_matrix
    return m[0, 3], m[1, 3], m[2, 3]
TypeError: argument 1 of Frame.__getitem__() has an invalid type

The roboview is obtained from the Git Repositiory

 git clone http://www9.in.tum.de/~kleinehe/roboview.git 

Thanks in advance,

Yishin

Ruben Smits's picture

Please advice about the error message of RoboView

> File "/home/ysli/proj/orocos/roboview/ui.py", line 88, in vec_from_matrix
> return m[0, 3], m[1, 3], m[2, 3]
> TypeError: argument 1 of Frame.__getitem__() has an invalid type

This is the problem, m[0,3] is a __get_item__ function with 2
arguments which is not very pythonic, therefor the python bindings
have been changed. You have to replace all code that uses Frame[i,j]
or Rotation[i,j] with Frame[(i,j)] and Rotation[(i,j)].

That should do the trick.

Ruben

On Sat, May 23, 2009 at 12:33 PM, yishin [dot] li [..] ...
<yishin [dot] li [..] ...> wrote:
> Hello,
>
> Several days ago, I was attracted by the fascinating [http://www.orocos.org/node/28 picture of KDL]. I wish to learn more about it. After google for a while, I found that [http://www9.cs.tum.edu/~kleinehe/roboview.html RoboView] might be a good start point. So, I download it, compile it, and unfortunately I got some error messages.
>
> Would you please provide some hint about the root cause of the error message? And, how should I resolve it?
>
> <pre>
> ysli@nemea:~/proj/orocos/roboview$ ./roboview robodef.py
> Traceback (most recent call last):
>  File "./roboview", line 6, in <module>
>    import main
>  File "/home/ysli/proj/orocos/roboview/main.py", line 216, in <module>
>    scene.add_to(display)
>  File "/home/ysli/proj/orocos/roboview/main.py", line 131, in add_to
>    self.robot.add_to(display)
>  File "/home/ysli/proj/orocos/roboview/ui.py", line 270, in add_to
>    widget.add_to(display)
>  File "/home/ysli/proj/orocos/roboview/ui.py", line 135, in add_to
>    display.add(None, t(make_link_cylinder(self.joint)), opacity=.3)
>  File "/home/ysli/proj/orocos/roboview/ui.py", line 115, in make_link_cylinder
>    make_vector_x_base(link_frame, vec_from_matrix(frame))
>  File "/home/ysli/proj/orocos/roboview/ui.py", line 88, in vec_from_matrix
>    return m[0, 3], m[1, 3], m[2, 3]
> TypeError: argument 1 of Frame.__getitem__() has an invalid type
> </pre>
>
> The roboview is obtained from the Git Repositiory
> <pre>
> git clone http://www9.in.tum.de/~kleinehe/roboview.git
> </pre>
>
> Thanks in advance,
>
> Yishin
>
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>

Re: Please advice about the error message of RoboView

Ruben Smits wrote:
> File "/home/ysli/proj/orocos/roboview/ui.py", line 88, in vec_from_matrix > return m[0, 3], m[1, 3], m[2, 3] > TypeError: argument 1 of Frame.__getitem__() has an invalid type

This is the problem, m[0,3] is a __get_item__ function with 2 arguments which is not very pythonic, therefor the python bindings have been changed. You have to replace all code that uses Frame[i,j] or Rotation[i,j] with Frame[(i,j)] and Rotation[(i,j)].

That should do the trick.

Ruben

Hello Ruben,

Do you mean that I should replace m[0, 3] with m[(0, 3)]?

I tried the following combinations:

  • print m ... pass (print a matrix)
  • print m[0, 3] ... fail (TypeError: argument 1 of Frame.__gettime__() has an invalid type)
  • print m[(0, 3)] ... fail (TypeError: argument 1 of Frame.__gettime__() has an invalid type)

I checked the README of RoboView. It's requirement is Pythen2.4, while I was using Python 2.5. Is it the reason why I got the TypeError?

Yishin