vcServoController

vcServoController is a controller for driving independent joints. The controller itself only supports forward kinematics and cannot be used in robots rather with them. For example, a servo controller can be used for external axis systems, grippers, fixtures, weld guns, and other simple mechanical structures.

Inherits: vcBehaviour

Properties

Name Type Access Description
FlangeNode vcNode RW Defines the flange node of servo, for example the mount plate or carriage for other kinematic structures.
HeartbeatTime Real RW If UseHeartbeat is set to True, defines the interval or pulse for updating joints.
JointCount Integer R Gets the number of joints in servo.
Joints List of vcJoint R Gets a list of all joints referenced by servo.
RootNode vcNode RW Defines the root node of servo, thereby the fixed base of kinematic structure.
Speed Real RW Defines joint speed as a percentage of maximum speed for driving joints in range 0 to 100.
UseHeartbeat Boolean RW Turns on/off the use of a heartbeat or pulse to drive and update joints.

Methods

Name Return Type Parameters Description
calcMotionTime Real None Returns the calculated motion time of servo using current joint values and listed targets.
createJoint vcJoint None Adds a new joint in servo.

(Deprecated)

deleteJoint None vcJoint joint

or

Integer joint_index

Removes a given joint or one at a given index from servo.

(Deprecated)

findJoint vcJoint String joint_name Returns the first joint matching a given name in servo; otherwise returns None.
getJoint vcJoint Integer joint_index Returns a joint at a given index in servo.
getJointTarget Real Integer joint_index Returns the target value of a joint at a given index in servo.
getJointValue Real Integer joint_index Returns the current value of a joint at a given index in servo.
move Real [Real joint_0, ... Real joint_n] Drives all joints in servo to target values, and then returns the actual motion time.

Target values for each joint in servo can be given as separate, optional arguments.

moveImmediate None [Real joint_0, ... Real joint_n] Drives all joints in servo to target values in zero simulation time.

Target values for each joint in servo can be given as separate, optional arguments.

moveJoint Real Integer joint_index, Real joint_value Moves a joint at a given index in servo to a given value, and then returns the actual motion time.
setJointTarget None Integer joint_index, Real joint_value Sets the target value of a joint at a given index in servo to a given value.
setMotionTime None Real time Forces the servo to execute joint movements at a given motion time.

Events

Name Parameters Description
OnHeartbeat vcServoController servo, Enumeration event_type Triggered when a pulse or heartbeat is generated by servo.

See Controller Constants for more information.

Note: This event handler can be used by a vcRobotController object executing a vcRslProcessStatement object in robot program.

Examples

Example. Create joint and assign it to servo

from vcScript import *
 
comp = getComponent()
node = comp.findNode("Link_1")
node.JointType = VC_JOINTTYPE_CUSTOM
 
servo = comp.findBehaviour("ServoController")
node.Dof.Controller = servo

Example. Calculate motion time and targets for motion

from vcScript import *
 
def OnRun():
  comp = getComponent()
  servo = comp.findBehaviour('ServoController')
  # moves j1 to 200 and j2 to 350
  servo.move(200, 350)
 
  # moves j2 to 100 (index 0 = j1, index 1 = j2, ...)
  servo.moveJoint(1, 100)
 
  # J1: sets the target for next move but doesn't move yet
  servo.setJointTarget(0,1200)
  servo.setJointTarget(1,1400)
 
  # calculate motion time according to given joint targets and joint speeds
  # and accelerations
  predicted_motion_time = servo.calcMotionTime()
  print predicted_motion_time
  if predicted_motion_time > 6:
    # override given accelerations and speeds forcing the motion time to given value
    servo.setMotionTime( 6.0 )
 
  # call motion to set targets
  servo.move()