def setup(): shared_data = Settings() shared_data.next_state = state.RemoteControlled shared_data.sim_mode = rospy.get_param('sim_mode', False) shared_data.self_color = 'turtle1' slaves = rospy.get_param('master/slaves', []) shared_data.nb_slaves = len(slaves) shared_data.visible_slaves = len(slaves) # To disable switch to search mode. # TODO: set to 0 when search mode works, it will find the slaves itself for slave_name in slaves: shared_data.slaves[slave_name] = SlaveData() return shared_data
def setup(): shared_data = Settings() shared_data.next_state = state.RemoteControlled shared_data.sim_mode = rospy.get_param("sim_mode", False) shared_data.self_color = "turtle1" slaves = rospy.get_param("master/slaves", []) shared_data.nb_slaves = len(slaves) shared_data.visible_slaves = len(slaves) # To disable switch to search mode. # TODO: set to 0 when search mode works, it will find the slaves itself for slave_name in slaves: shared_data.slaves[slave_name] = SlaveData() return shared_data
def setup_shared_data(): ''' Must be executed AFTER rospy.init_node so that get get_param calls properly work ''' shared_data = Settings() shared_data.next_state = state.Obey shared_data.sim_mode = rospy.get_param('sim_mode', False) shared_data.self_color = rospy.get_param('~name', 'turtleX') shared_data.slaves[shared_data.self_color] = SlaveData() if shared_data.sim_mode: shared_data.spawn_position = rospy.get_param('~spawn_position', [5, 7]) return shared_data