Octopus arm simulator Description: Functions for initiating and moving the simulated octopus arm. Usage: initOctarm(...) initOctarm( nComp=10, State=initiateArm(), bdefAct=TRUE, baseAct=0, muscAct=array(0,c(length(baseAct),nComp+1,3)), Ta=1320,Tp=200,alpha0=9, kv = 1e-6, rho_arm=1200,rho_water=1025, ga=9.8, goal=c(-1,-1,0.1), bdraw=FALSE) moveOctarm(state, action, ...) moveOctarm( state, action, dt=0.01, nsteps=1, userActM=matrix(0,NC1,3), userActB=0, draw=1, sleep=0.01) Arguments: nComp the number of compartment bdefAct use defined action set, if FALSE need to set below three baseAct base activations ( vector with naction values ) muscAct muscle activations (3 dimensional array [action, nComp+1, 3] value for each action element in range of [0,1] Ta the active stiffness Tp the passive stiffness alpha0 the linear dampening coefficient kv kinetic velocity rho_arm density for an octopus arm rho_water density for seawater ga gravitational acceleration goal the position and radius of goal state initial state action predefined action index (>=1) 0 for user-defined activation -1 for random action dt time interval for each step nsteps the number of steps userActM user defined muscle activation (action should be set to -2) userActB user defined base activation (action should be set to -2) draw draw the simulation sleep interval between each steps Return Value: State with position and velocity after initiating and moving the arm Example: st <- initOctarm(bdefAct=FALSE) st <- moveOctarm(st, -1, nsteps=1000) st <- moveOctarm(st, 0, nsteps=10000, userActM=matrix(c(1,0,0),NC1,3,byr st <- moveOctarm(st, 0, nsteps=10000, userActM=matrix(c(0,1,0),NC1,3,byr st <- initOctarm() st <- moveOctarm(st, 1, nsteps=1000)