Exemple #1
0
	def run(self):
		#create the drone controller
		droneController = DroneController(robotName)
		path = [1,2,3,4,5,6,7,1,8,9,10,11,12,13]
		droneController.setPath(path)

		#randomize how much this guy cares about angular error
		angleMult = (random.random() * 2) + 1.0

		while not rospy.is_shutdown() and self.isRunning:
			twist = Twist()

			angle = droneController.getAngleError()
			angle *= angleMult
			if math.fabs(angle) > 0.8:
				if angle > 0:
					twist.angular.z=1
				elif angle < 0:
					twist.angular.z=-1
			else:
				twist.linear.x=1
			self.pub.publish(twist)

			delay = (random.random() * 1.8) + 0.2
			rospy.sleep(delay)
Exemple #2
0
	def run(self):
		#create the drone controller
		droneController = DroneController(robotName)
		path = [1,2,3,4,5,6,7,1,8,9,10,11,12,13]
		droneController.setPath(path)

		while not rospy.is_shutdown():
			twist = Twist()

			angle = droneController.getAngleError()
			#if math.fabs(angle) > 0.1:
			twist.angular.z=angle
			#else:
			twist.linear.x=1
	
			self.pub.publish(twist)
			rospy.sleep(1)