def __init__(self, smo_init_mode='new', rc_path=None, rc_name=None, connection_name=None, **kwd): self.rc_path = RCInitTkGui.rc_init_tk_path if rc_path is not None: self.rc_path = rc_path self.rc_name = rc_util.rc_default_model_name if rc_name is not None: self.rc_name = rc_name self.connection_name = rc_util.rc_default_model_name if connection_name is not None: self.connection_name = connection_name self.rc_top_level_widget = None self.rc_header_widget = None # window structure for restore self.rc_widget_structure = None # data for data exchange data between nodes self.sync_widget = None self.sync_run = False self.sync_period = rc_util.rc_control_sample_rate # display methods, dictionary structure { <portName>:[list of set_methods, ...], ...} self.sync_display_dict = {} RCInit.__init__(self, smo_init_mode=smo_init_mode, **kwd) return
def __init__(self, smo_init_mode='new', rc_path=None, rc_name=None, connection_name=None, cam_index=0, mae_id=None, cont_sample_rate=rob_control_sample_rate, img_sample_rate=rob_vision_sample_rate, **kwd): self.rc_path = os.getcwd() if rc_path is not None: self.rc_path = rc_path self.rc_name = rc_util.rc_default_model_name if rc_name is not None: self.rc_name = rc_name self.connection_name = rc_util.rc_default_model_name if connection_name is not None: self.connection_name = connection_name self.cam_index = cam_index self.img_sample_rate = img_sample_rate self.mae_id = mae_id self.cont_sample_rate = cont_sample_rate self.state = 'undef' # {name: (token value list, init} input_port = { 'instr': (None, rc_util.rc_token), 'setdrive': ([0, 0], rc_util.rc_token), 'setcampos': ([0, 0], rc_util.rc_value), 'imgtoken': (0, rc_util.rc_token) } output_port = { 'state': (None, rc_util.rc_token), 'getdrive': ([0, 0], rc_util.rc_token), 'getcampos': ([0, 0], rc_util.rc_value), 'img': ([0, 0, None], rc_util.rc_token) } RCInit.__init__(self, smo_init_mode=smo_init_mode, input_port=input_port, output_port=output_port, in_pred=None, out_succ=None) #SMOBaseObject.debug_handler.out( 'Camera index: ', self.cam_index) self.cam = CameraDevice.create(CAMERA_TYPE) self.dev = RCMAESimpleControl(mae_id=mae_id) self.cycle = rc_loop(robot=self, period=self.cont_sample_rate) return
def __init__(self, smo_init_mode='new', host=test_host, port=test_port, rc_path=None, rc_name=rc_default_model_name, connection_name=test_connection_name, robot_name=test_robot_name, **kwd): self.rc_path = os.getcwd() if rc_path is not None: self.rc_path = rc_path self.rc_name = rc_name # file name self.connection_name = connection_name self.robot_name = robot_name self.host = host self.port = port self.cont_sample_rate = rob_control_sample_rate self.img_token = 3 self.cycle = CallRobotConnectLoop(robot_proxy=self, period=self.cont_sample_rate) self.state = 'undef' # initialize interface input_port = { 'instr': (None, rc_token), 'setdrive': ([0, 0], rc_token), 'setcampos': ([0, 0], rc_value), 'imgtoken': (0, rc_token) } output_port = { 'state': (None, rc_token), 'getdrive': ([0, 0], rc_token), 'getcampos': ([0, 0], rc_value), 'img': ([0, 0, None], rc_token) } RCInit.__init__(self, smo_init_mode=smo_init_mode, input_port=input_port, output_port=output_port, in_pred=None, out_succ=None) self.robot_ipid = SMOIPID(server_host=self.host, server_port=self.port, obj_id_str=self.robot_name, glob=None, smo_init_mode='new', **kwd) return
def __init__(self, host='localhost', port=_DEFAULT_PORT, smo_init_mode='new', path=None, fname=TEST_FNAME, connection_name=TEST_CONNECTION_NAME, robot_name=TEST_ROBOT_NAME, **kwd): """Instantiates the stub. :param host: The robot's hostname. :param port: The port on which to connect to the robot. All additional parameters are mostly unused or used for object de-/serialization. """ RCInit.__init__(self, smo_init_mode=smo_init_mode, input_port=ROB_INPUT_PORT, output_port=ROB_OUTPUT_PORT, in_pred=None, out_succ=None) self.path = os.getcwd() if path is not None: self.path = path self.fname = fname # file name self.connection_name = connection_name # for registration as rc_node in GUI self.robot_name = robot_name # robot name, should be pi hostname self.host = host # pi hostname (robot) self.port = port # server port of pi (robot) self.connection_sample_rate = ROB_CONNECTION_SAMPLE_RATE self.cycle = CCSCallRobotConnectLoop( self, period=self.connection_sample_rate) self.robot_ipid = SMOIPID(server_host=self.host, server_port=self.port, obj_id_str=self.robot_name, glob=None, smo_init_mode='new', **kwd) return
def __init__(self, smo_init_mode='new', host=_LISTEN_ADDRESS, port=_DEFAULT_PORT, path=None, fname=TEST_FNAME, robot_name=TEST_ROBOT_NAME, cam_index=0, control_sample_rate=ROB_CONTROL_SAMPLE_RATE, vision_sample_rate=ROB_VISION_SAMPLE_RATE, **kwd): RCInit.__init__(self, smo_init_mode=smo_init_mode, input_port=ROB_INPUT_PORT, output_port=ROB_OUTPUT_PORT, in_pred=None, out_succ=None) self.path = os.getcwd() if path is not None: self.path = path self.fname = fname self.robot_name = robot_name self.host = host self.port = port self.test_val = 0.5 self.cam_index = cam_index self.img_sample_rate = vision_sample_rate self.control_sample_rate = control_sample_rate self.disco = 0 # disco mode status self.state = 'idle' self.cam = CameraDevice.create('pi') self.drive_dev = CCSDev() self.cycle = CallRobotLoop(self, period=self.control_sample_rate, robot_name=self.robot_name) return
def get_restore_dict(self): """Returns a dict containing all persistent data.""" ret_dict = RCInit.get_restore_dict(self) local_dict = { 'rc_path': self.rc_path, 'rc_name': self.rc_name, 'robot_name': self.robot_name, 'cam_index': self.cam_index, 'img_sample_rate': self.img_sample_rate, 'mae_id': self.mae_id, 'cont_sample_rate': self.cont_sample_rate } ret_dict.update(local_dict) return ret_dict
def get_restore_dict(self): """ This method returns a dictionary which contain all persistent data for all members of restore eval(repr(restore)) has to work especially for init values """ if SMOBaseObject.trace: SMOBaseObject.debug_handler.out( '*** INFO *** CCSCallRobot_1 get_restore_dict') ret_dict = RCInit.get_restore_dict(self) local_dict = { 'rc_path': self.path, 'rc_name': self.fname, 'robot_name': self.robot_name, 'cam_index': self.cam_index, 'img_sample_rate': self.img_sample_rate, 'control_sample_rate': self.control_sample_rate } ret_dict.update(local_dict) return ret_dict
def get_restore_dict(self): """ This method returns a dictionary which contain all persistent data for all members of restore eval(repr(restore)) has to work especially for init values """ if SMOBaseObject.trace: SMOBaseObject.debug_handler.out( '*** TRACE *** PKRobotInit get_restore_dict: return {}') ret_dict = RCInit.get_restore_dict(self) local_dict = { 'rc_path': self.rc_path, 'rc_name': self.rc_name, 'connection_name': self.connection_name, 'cam_index': self.cam_index, 'img_sample_rate': self.img_sample_rate, 'mae_id': self.mae_id, 'cont_sample_rate': self.cont_sample_rate } ret_dict.update(local_dict) return ret_dict
def get_restore_dict(self): """ This method returns a dictionary which contain all persistent data for all members of restore eval(repr(restore)) has to work especially for init values """ if SMOBaseObject.trace: SMOBaseObject.debug_handler.out('*** TRACE *** PKRobotInit get_restore_dict: return {}') ret_dict = RCInit.get_restore_dict(self) local_dict = { 'rc_path': self.rc_path, 'rc_name': self.rc_name, 'connection_name': self.connection_name, 'rc_widget_structure': self.rc_widget_structure, 'rc_path': self.rc_path, 'rc_path': self.rc_path, 'init_inport': self.init_inport, 'init_outport': self.init_outport, 'out_succ': self.out_succ, 'in_pred': self.in_pred} ret_dict.update(local_dict) return ret_dict
def __init__(self, smo_init_mode='new', host=test_host, port=test_port, rc_path=None, rc_name=rc_util.rc_default_model_name, connection_name=test_connection_name, robot_name=test_robot_name, **kwd): ### self.rc_path = os.getcwd() if rc_path is not None: self.rc_path = rc_path self.rc_name = rc_name # file name self.connection_name = connection_name self.robot_name = robot_name self.host = host self.port = port ### self.img_sample_rate = img_sample_rate self.cont_sample_rate = rob_control_sample_rate self.img_token = 3 self.cycle = CallRobotConnectLoop(robot_proxy=self, period=self.cont_sample_rate) # definition der schnittstelle input_port = { 'instr': (None, rc_util.rc_token), 'setdrive': ([0, 0], rc_util.rc_token), 'setcampos': ([0, 0], rc_util.rc_value), 'imgtoken': (0, rc_util.rc_token) } output_port = { 'state': (None, rc_util.rc_token), 'getdrive': ([0, 0], rc_util.rc_token), 'getcampos': ([0, 0], rc_util.rc_value), 'img': ([0, 0, None], rc_util.rc_token) } RCInit.__init__(self, smo_init_mode=smo_init_mode, input_port=input_port, output_port=output_port, in_pred=None, out_succ=None) # verbindung zum Roboter # self.client_connect = SMO_IP_connect(server_host=self.host, server_port=self.port, # reconnect_period=smo_IP_default_reconnect_period, # glob=globals(), **kwd) self.robot_ipid = SMOIPID(server_host=self.host, server_port=self.port, obj_id_str=self.robot_name, glob=None, smo_init_mode='new', **kwd) # fuer send robot # self.gui_ipid = # self.client_connect.publish(self) # self.cycle.start_serialize() # self.cycle.start_compute() return
def __init__(self, smo_init_mode='new', host=test_host, port=test_port, rc_path=None, rc_name=rc_util.rc_default_model_name, robot_name=test_robot_name, cam_index=-1, mae_id=None, cont_sample_rate=rob_control_sample_rate, img_sample_rate=rob_vision_sample_rate, **kwd): self.rc_path = os.getcwd() if rc_path is not None: self.rc_path = rc_path self.rc_name = rc_name self.robot_name = robot_name self.host = host # for robotserver self.port = port # for robot server self.control_server_list = {} ### self.test_val = 0.5 self.cam_index = cam_index self.img_sample_rate = img_sample_rate self.mae_id = mae_id self.cont_sample_rate = cont_sample_rate # {name: (token value list, init} input_port = { 'instr': (None, rc_util.rc_token), 'setdrive': ([0, 0], rc_util.rc_token), 'setcampos': ([0, 0], rc_util.rc_value), 'imgtoken': (0, rc_util.rc_token) } output_port = { 'state': (None, rc_util.rc_token), 'getdrive': ([0, 0], rc_util.rc_token), 'getcampos': ([0, 0], rc_util.rc_value), 'img': ([0, 0, None], rc_util.rc_token) } RCInit.__init__(self, smo_init_mode=smo_init_mode, input_port=input_port, output_port=output_port, in_pred=None, out_succ=None) #SMOBaseObject.debug_handler.out( 'Camera index: ', self.cam_index) self.cam = rc_cam(index=self.cam_index, cam_type='web_cam') self.img_token = 3 self.dev = rc_mae_control(mae_id=mae_id) self.cycle = CallRobotLoop(call_robot=self, period=self.cont_sample_rate, robot_name=self.robot_name) # connecting robot, start server and publish robot object self.server = SMO_IP_new_server( server_host=self.host, server_port=self.port, IP_prot='TCP', reconnect_period=smo_util.smo_IP_default_reconnect_period, glob=globals(), **kwd) self.server.publish(self.cycle) # self.cycle.start_serialize() # self.cycle.start_compute() return
def __init__(self, smo_init_mode='new', host=test_host, port=test_port, rc_path=None, rc_name=rc_default_model_name, robot_name=test_robot_name, cam_index=0, mae_id=None, cont_sample_rate=rob_control_sample_rate, img_sample_rate=rob_vision_sample_rate, **kwd): self.rc_path = os.getcwd() if rc_path is not None: self.rc_path = rc_path self.rc_name = rc_name self.robot_name = robot_name self.host = host self.port = port self.test_val = 0.5 self.cam_index = cam_index self.img_sample_rate = img_sample_rate self.mae_id = mae_id self.cont_sample_rate = cont_sample_rate self.state = 'undef' input_port = { 'instr': (None, rc_token), 'setdrive': ([0, 0], rc_token), 'setcampos': ([0, 0], rc_value), 'imgtoken': (0, rc_token) } output_port = { 'state': (None, rc_token), 'getdrive': ([0, 0], rc_token), 'getcampos': ([0, 0], rc_value), 'img': ([0, 0, None], rc_token) } RCInit.__init__(self, smo_init_mode=smo_init_mode, input_port=input_port, output_port=output_port, in_pred=None, out_succ=None) self.cam = CameraDevice.create(CAMERA_TYPE) self.img_token = 3 self.dev = RCMAESimpleControl(mae_id=mae_id) self.cycle = CallRobotLoop(call_robot=self, period=self.cont_sample_rate, robot_name=self.robot_name) # Spawn server and make ports accessible self.server = SMO_IP_new_server( server_host=self.host, server_port=self.port, IP_prot='TCP', reconnect_period=smo_IP_default_reconnect_period, glob=globals(), **kwd) self.server.publish(self.cycle) return