-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hi Aaron,
The line below in the animateMechanism() function is generating an error where it wasn't before, possibly from an update in Morpho 2.8(?):
transformed <- applyTransform(mechanism[["body.points"]][mechanism[["points.assoc"]][[body_num]], ], mechanism[["tmat"]][, , body_num, ])It works and generates a single-matrix as an output when the matrix is indexed in the final dimension of mechanism[["tmat"]][, , body_num, ] (ex: mechanism[["tmat"]][, , body_num,1]), but it cannot handle the array that is supplied to it for the full animation.
thanks
Reproducible example:
links<-matrix(c(-0.39069962,-0.32840783,0.07768959,0.06216360, -0.09013900,0.12704082,-0.12182534,-0.08699318,0.13069155,0.14548724,0.01777761,0.05029505),nrow=4,ncol=3, dimnames=list(c("vOp","Op","12","11"),c("X","Y","Z")))
## Define the joint coordinates
joint.coor<-links[,]
# Define the joint types
joint.types <- c("S", "R", "S", "R")
# Define joint constraints
joint.cons <- list(diag(3), c(0,0,1), diag(3), c(0,0,1))
# Define two links connected by each joint
joint.conn <- rbind( c('Op2','Op1'),c('Op1','Op3'), c('Op2','OpM'), c('OpM','Op3'))
# Define ground link
ground.link <- "Op3"
# Define linkage
mechanism <- defineMechanism(joint.coor=joint.coor, joint.types=joint.types,
joint.cons=joint.cons, body.conn=joint.conn, fixed=ground.link, input.joint= "Op",
print.progress=FALSE)
# Set input parameters
input.param <- seq(0,-pi/18,length=30)
# Create simple rectangles representing each body
mechanism <- associatePointShape(mechanism, shape='rect', body='Op1', ends=joint.coor[c('vOp', 'Op'), ], nvector=c(0,0,1), width=0.01)
mechanism <- associatePointShape(mechanism, shape='rect', body='Op3', ends=joint.coor[c('Op', '11'), ], nvector=c(0,0,1), width=0.01)
mechanism <- associatePointShape(mechanism, shape='rect', body='Op2', ends=joint.coor[c('vOp', '12'), ], nvector=c(0,0,1), width=0.01)
mechanism <- associatePointShape(mechanism, shape='rect', body='OpM', ends=joint.coor[c('12', '11'), ], nvector=c(0,0,1), width=0.01)
# Animate mechanism
Op4.3d.animated <- animateMechanism(mechanism, input.param=input.param, print.progress=FALSE, check.inter.joint.dist=FALSE)
# Draw mechanism
Op4.3d.animate_mechanism <- drawMechanism(Op4.3d.animated, file='Op4.3D.html')
Metadata
Metadata
Assignees
Labels
No labels