parameters: (topic,klampt_obj,convert_kwargs=None,**kwargs)
return_statement: return subscriber(topic,type,shim,convert_kwargs,**kwargs)
docstring: Convenience function.  Every time a message arrives on the ROS topic,
      the given klampt object is updated. 
  
      Only valid for:
  
          * points / transforms provided as lists
          * Config (Float32MultiArray or JointState messages)
          * RobotModel (JointState messages)
          * SimRobotController (JointState messages)
          * Trajectory  (JointTrajectory messages)
  
      Returns:
          rospy.Subscriber
docstring_summary: Convenience function.  Every time a message arrives on the ROS topic,
      the given klampt object is updated.
docstring_tokens: Convenience function . Every time a message arrives on the ROS topic the given klampt object is updated .
function: def object_subscriber(topic,klampt_obj,convert_kwargs=None,**kwargs):
      """Convenience function.  Every time a message arrives on the ROS topic,
      the given klampt object is updated. 
  
      Only valid for:
  
          * points / transforms provided as lists
          * Config (Float32MultiArray or JointState messages)
          * RobotModel (JointState messages)
          * SimRobotController (JointState messages)
          * Trajectory  (JointTrajectory messages)
  
      Returns:
          rospy.Subscriber
      """
      if convert_kwargs is None:
          convert_kwargs = dict()
      type = _compatibleKlamptType(klampt_obj)
      copy_fn = None
      if type in ['Config','Point','Vector3','Matrix3','Rotation','RigidTranform']:
          def default_copy(vin,out):
              assert isinstance(out,list),"Can only copy into lists, not tuples"
              assert len(vin) == len(out)
              for i in xrange(len(vin)):
                  out[i] = vin[i]
          copy_fn = default_copy
      elif type == 'RobotModel':
          def copyrobot(jointstate_res,robot=klampt_obj):
              robot.setConfig(jointstate_res[0])
          copy_fn = copyrobot
          convert_kwargs['robot'] = klampt_obj
      elif type == 'SimRobotController':
          def copycontroller(jointstate_res,controller=klampt_obj):
              q,dq,effort = jointstate_res
              if dq is None and q is not None:
                  dq = [0.0]*len(q)
              if effort is not None:
                  if q is None:
                      controller.setTorque(effort)
                  else:
                      controller.setPIDCommand(q,dq,effort)
              elif q is not None:
                  controller.setPIDCommand(q,dq)
          copy_fn = copycontroller
          convert_kwargs['robot'] = klampt_obj.model()
      elif type == 'Trajectory':
          def copytraj(jointtrajectory_res,traj=klampt_obj):
              traj.times,traj.milestones = jointtrajectory_res.times,jointtrajectory_res.milestones
          copy_fn = copytraj
      else:
          raise ValueError("Hmm... not clear how to update that Klamp't object")
  
      def shim(new_klampt_obj,klampt_obj_ptr=klampt_obj):
          copy_fn(new_klampt_obj,klampt_obj_ptr)
          
      return subscriber(topic,type,shim,convert_kwargs,**kwargs)
function_tokens: def object_subscriber ( topic , klampt_obj , convert_kwargs = None , * * kwargs ) : if convert_kwargs is None : convert_kwargs = dict ( ) type = _compatibleKlamptType ( klampt_obj ) copy_fn = None if type in [ 'Config' , 'Point' , 'Vector3' , 'Matrix3' , 'Rotation' , 'RigidTranform' ] : def default_copy ( vin , out ) : assert isinstance ( out , list ) , "Can only copy into lists, not tuples" assert len ( vin ) == len ( out ) for i in xrange ( len ( vin ) ) : out [ i ] = vin [ i ] copy_fn = default_copy elif type == 'RobotModel' : def copyrobot ( jointstate_res , robot = klampt_obj ) : robot . setConfig ( jointstate_res [ 0 ] ) copy_fn = copyrobot convert_kwargs [ 'robot' ] = klampt_obj elif type == 'SimRobotController' : def copycontroller ( jointstate_res , controller = klampt_obj ) : q , dq , effort = jointstate_res if dq is None and q is not None : dq = [ 0.0 ] * len ( q ) if effort is not None : if q is None : controller . setTorque ( effort ) else : controller . setPIDCommand ( q , dq , effort ) elif q is not None : controller . setPIDCommand ( q , dq ) copy_fn = copycontroller convert_kwargs [ 'robot' ] = klampt_obj . model ( ) elif type == 'Trajectory' : def copytraj ( jointtrajectory_res , traj = klampt_obj ) : traj . times , traj . milestones = jointtrajectory_res . times , jointtrajectory_res . milestones copy_fn = copytraj else : raise ValueError ( "Hmm... not clear how to update that Klamp't object" ) def shim ( new_klampt_obj , klampt_obj_ptr = klampt_obj ) : copy_fn ( new_klampt_obj , klampt_obj_ptr ) return subscriber ( topic , type , shim , convert_kwargs , * * kwargs )