def __init__(self): print("loading model...") self.cnn = Model() self.new_goal = False self.message_sent = False self.goals = GoalManager() self.laser = None self.goal = None self.command = None self.pose = None print("...done.") self.cmd_pub = rospy.Publisher("/cmd_vel", Twist, queue_size=10) self.goal_pub = rospy.Publisher("/goal_reached", String, queue_size=10) self.acc_pub = rospy.Publisher("/accuracy",String, queue_size=10) self.data_pub = rospy.Publisher('/data', Float64MultiArray,queue_size=10) self.scan_sub = rospy.Subscriber("/base_scan", numpy_msg(LaserScan), self.laser_callback) self.goal_sub = rospy.Subscriber("/move_base/goal", MoveBaseActionGoal, self.goal_callback) self.pose_sub = rospy.Subscriber("/amcl_pose", PoseWithCovarianceStamped, self.pose_callback) self.stall_sub = rospy.Subscriber("/stall", Bool, self.stall_callback) self.twist_msg = Twist() self.string_msg = String() self.data_msg = Float64MultiArray() print("\nAwaiting first goal!") time.sleep(2) self.string_msg.data = 's' self.goal_pub.publish(self.string_msg) self.string_msg.data = ''
def __init__(self, settings): print("loading model...") self.dae1 = Model(settings.model1) self.dae2 = None if hasattr(settings, 'model2'): self.dae2 = Model(settings.model2) self.new_goal = False self.message_sent = False self.goals = GoalManager(settings) self.laser1 = None self.goal1 = None self.command1 = None in_count = 0 if self.dae1.model.mmdae_type[0]: self.laser1 = SequenceInput(self.dae1.model.dims[in_count], self.dae1.model.mean[in_count], self.dae1.model.std[in_count], self.dae1.model.sequence, self.dae1.model.normalise[in_count]) in_count += 1 if self.dae1.model.mmdae_type[1]: self.goal1 = SequenceInput(self.dae1.model.dims[in_count], self.dae1.model.mean[in_count], self.dae1.model.std[in_count], self.dae1.model.sequence, self.dae1.model.normalise[in_count]) in_count += 1 if self.dae1.model.mmdae_type[2]: self.command1 = SequenceInput(self.dae1.model.dims[in_count], self.dae1.model.mean[in_count], self.dae1.model.std[in_count], self.dae1.model.sequence, self.dae1.model.normalise[in_count]) in_count += 1 self.laser2 = None self.goal2 = None self.command2 = None if self.dae2 is not None: in_count = 0 if self.dae2.model.mmdae_type[0]: self.laser2 = SequenceInput( self.dae2.model.dims[in_count], self.dae2.model.mean[in_count], self.dae2.model.std[in_count], self.dae2.model.sequence, self.dae2.model.normalise[in_count]) in_count += 1 if self.dae2.model.mmdae_type[1]: self.goal2 = SequenceInput(self.dae2.model.dims[in_count], self.dae2.model.mean[in_count], self.dae2.model.std[in_count], self.dae2.model.sequence, self.dae2.model.normalise[in_count]) in_count += 1 if self.dae2.model.mmdae_type[2]: self.command2 = SequenceInput( self.dae2.model.dims[in_count], self.dae2.model.mean[in_count], self.dae2.model.std[in_count], self.dae2.model.sequence, self.dae2.model.normalise[in_count]) in_count += 1 print("...done.") self.cmd_pub = rospy.Publisher("/cmd_vel", Twist, queue_size=10) self.goal_pub = rospy.Publisher("/goal_reached", String, queue_size=10) self.acc_pub = rospy.Publisher("/accuracy", String, queue_size=10) self.data_pub = rospy.Publisher('/data', Float64MultiArray, queue_size=10) self.scan_sub = rospy.Subscriber(settings.topic, numpy_msg(LaserScan), self.laser_callback) self.goal_sub = rospy.Subscriber("/goal", String, self.goal_callback) self.pose_sub = rospy.Subscriber("/amcl_pose", PoseWithCovarianceStamped, self.pose_callback) self.stall_sub = rospy.Subscriber("/stall", Bool, self.stall_callback) self.twist_msg = Twist() self.string_msg = String() self.data_msg = Float64MultiArray() print("\nAwaiting first goal!") time.sleep(2) self.string_msg.data = 's' self.goal_pub.publish(self.string_msg) self.string_msg.data = ''