adityadua24/robopy

animate a RRR model actor_list index out of range

lfcastro opened this issue · 2 comments

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')

@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

Thanks for the feedback, I will take a look