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

animate a RRR model actor_list index out of range #29

Open
lfcastro opened this issue Jul 3, 2019 · 2 comments
Open

animate a RRR model actor_list index out of range #29

lfcastro opened this issue Jul 3, 2019 · 2 comments

Comments

@lfcastro
Copy link

lfcastro commented Jul 3, 2019

Hi, I was able to install the lib and run some of the samples... I tried to create a simple animation for a RRR manipulator but I get the following error

line 106, in fkine actor_list[self.length].SetUserMatrix(transforms.np2vtk(t)) IndexError: list index out of range

I really appreciate if you can guide me... The code that I create is the following

import robopy as r
import numpy as np
from robopy import transforms as tr

base = tr.trotx(-90, unit='deg')

L = r.serial_link.Revolute(0,theta=0,d=0,a=0.1,alpha=0,offset=0,qlim=(-180np.pi/180, 180np.pi/180)) #qlim=0
L2 = r.serial_link.Revolute(0,theta=0,d=0,a=0.1,alpha=0,offset=0,qlim=(-180np.pi/180, 180np.pi/180)) #qlim=0
L3 = r.serial_link.Revolute(0,theta=0,d=0,a=0.1,alpha=0,offset=0,qlim=(-180np.pi/180, 180np.pi/180)) #qlim=0

a = np.transpose(np.asmatrix(np.linspace(0, 6, 500)))
b = np.transpose(np.asmatrix(np.linspace(0, 6, 500)))
c = np.transpose(np.asmatrix(np.linspace(0, 6, 500)))

f = np.concatenate((a,b,c), axis=1)
robot = r.SerialLink([L,L2,L3],colors=[[100,100,100],[100,50,50],[100,50,50]],stl_files=['link0.stl','link1.stl','link1.stl'], q=[0,0,0],base=base)
robot.plot(f, unit='deg')
robot.animate(stances=f, frame_rate=30, unit='deg')

@Divvet
Copy link

Divvet commented Jul 29, 2019

@lfcastro Hope this helps, I just encountered the same error. I tracked it down to not providing enough STL files in my SerialLink. So in my case I had configured a 6 DOF robot, and only provided 6 STL files. Adding a 7th in at the beginning as link0 to represent the robot base and incrementing the remaining STL numbers resolved the problem

@lfcastro
Copy link
Author

lfcastro commented Aug 1, 2019

Thanks for the feedback, I will take a look

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

2 participants