def sendLEDs():
    led = Led()
    if (stopMode):
        led.value = 3
    else:
        led.value = 1
    pubLED.publish(led)
Пример #2
0
 def light(self):
   """
   Flashes the light on the robot (useful for checking connection or for raves)
   """
   #r:	var used  to control the flashing frequenzy in hz
   # cmd:	data structure for the led() information, for more information refer to msg docs on Led()
   
   #create a publisher which talks to the lights
   #rate at chich to publish
   r = rospy.Rate(10);
   #create the message to  the node
   cmd = Led()
   #set value 
   cmd.value = 1	
   t = 10
   while not rospy.is_shutdown() and t > 0:
     cmd.value = 1	
     #publish the message
     self.led1.publish(cmd)
     rospy.loginfo("published the info to the node")
     r.sleep()
     cmd.value = 3
     self.led1.publish(cmd)
     r.sleep()
     t = t-1
   rospy.sleep(1)		
Пример #3
0
def mitsos():

	pub = rospy.Publisher('/mobile_base/commands/led1', Led, queue_size=10)
	
	rospy.init_node('talker', anonymous=True)
   	rate = rospy.Rate(10) # 10hz
	rate1 = rospy.Rate(1)
  	while not rospy.is_shutdown():
		z=0
 		while z < 5:		
			ledstate = Led()
			ledstate.value = 1
			pub.publish(ledstate)
			z += 0.1
			print(z)
			rate.sleep()
		y=0

		while y < 5:

			ledstate = Led()
			ledstate.value = 0
			pub.publish(ledstate)
			y += 0.5
			print(y)
			rate1.sleep()
def cleanUp():
    global currentCommand
    currentCommand.linear.x = 0.0
    currentCommand.angular.z = 0.0
    led = Led()
    led.value = 0
    pubLED.publish(led)
    pub.publish(currentCommand)
    rospy.sleep(1)
Пример #5
0
def callback(data):
	rospy.loginfo(rospy.get_caller_id() + "I heard %s", data.linear)

	pub = rospy.Publisher('/mobile_base/commands/led1', Led, queue_size=10)

	
	print "L I N E A R"	
	print data.linear.x

	if  data.linear.x == 0.1:
		ledstate = Led()
		ledstate.value = 1
		ledstate.value = 2
		pub.publish(ledstate)		
	else:
		ledstate = Led()
		ledstate.value = 0
		pub.publish(ledstate)	
Пример #6
0
def sendLEDs():
    rospy.init_node('leds_sender', anonymous=True)
    pub1 = rospy.Publisher('/mobile_base/commands/led1', Led, queue_size=10)
    pub2 = rospy.Publisher('/mobile_base/commands/led2', Led, queue_size=10)
    while pub1.get_num_connections() == 0 or pub2.get_num_connections() == 0:
        pass
    led = Led()
    x = 3
    while x != -1:
        led.value = x
        pub1.publish(led)
        x = x - 1
        rospy.sleep(1)

    x = 3
    while x != -1:
        led.value = x
        pub2.publish(led)
        x = x - 1
        rospy.sleep(1)
Пример #7
0
def ledUpdate(value):
    global pub_led1
    led = Led()
    led.value = value
    pub_led1.publish(value)
Пример #8
0
	def disable_LEDs(self):
		msg = Led()
		msg.value = Led.BLACK
		for pub in self.led_publishers:
			pub.publish(msg)
Пример #9
0
	def enable_LEDs(self):
		msg = Led()
		msg.value = Led.GREEN
		for pub in self.led_publishers:
			pub.publish(msg)
Пример #10
0
 def disable_LEDs(self):
     msg = Led()
     msg.value = Led.BLACK
     for pub in self.led_publishers:
         pub.publish(msg)
Пример #11
0
 def enable_LEDs(self):
     msg = Led()
     msg.value = Led.GREEN
     for pub in self.led_publishers:
         pub.publish(msg)
#!/usr/bin/env python

import rospy
from kobuki_msgs.msg import Led

if __name__ == '__main__':
    rospy.init_node("checkpoint1_3_2_led_python", anonymous=True)

    pub = rospy.Publisher("/mobile_base/commands/led1", Led, queue_size=1)
    rospy.sleep(1)

    msg = Led()
    for i in range(3):
        msg.value = i + 1
        rospy.loginfo("publish msg [value: %d]" % (msg.value))
        pub.publish(msg)
        rospy.sleep(1)
    msg.value = 0
    rospy.loginfo("publish msg [value: %d]" % (msg.value))
    pub.publish(msg)
        print goal
        rospy.wait_for_service('goal_nav_service')
        driveToGoal = rospy.ServiceProxy('goal_nav_service', GoToGoal)
        response = driveToGoal(goal[0], goal[1])
        if (response.status == 0):
            break
        print "done with current frontier"
        preexplorationMove()
        print "identifying new frontiers"
        frontiersList = identifyFrontiers()

    #call("spd-say 'I'm done.'");
    i = 1
    ledmsg = Led()
    while (not rospy.is_shutdown()):
        print "DONE EXPLORING"
        if ((i % 2) == 0):
            ledmsg.value = 0
        else:
            ledmsg.value = (i + 1) / 2

        i += 1
        i = i % 6

        led1Pub.publish(ledmsg)
        led2Pub.publish(ledmsg)
        time.sleep(0.5)
    ledmsg.value = 0
    led1Pub.publish(ledmsg)
    led2Pub.publish(ledmsg)
        print goal
    	rospy.wait_for_service('goal_nav_service')
    	driveToGoal = rospy.ServiceProxy('goal_nav_service', GoToGoal)
    	response = driveToGoal(goal[0], goal[1])
        if (response.status == 0):
            break
        print "done with current frontier"
    	preexplorationMove()
        print "identifying new frontiers"
    	frontiersList = identifyFrontiers()

    #call("spd-say 'I'm done.'");
    i = 1
    ledmsg = Led()
    while (not rospy.is_shutdown()):
    	print "DONE EXPLORING"
        if ((i%2) == 0):
            ledmsg.value = 0
        else:
            ledmsg.value = (i+1)/2

        i += 1
        i = i%6

        led1Pub.publish(ledmsg)
        led2Pub.publish(ledmsg)
    	time.sleep(0.5)
    ledmsg.value = 0
    led1Pub.publish(ledmsg)
    led2Pub.publish(ledmsg)