Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 import time
00019
00020 import rospy
00021 from std_msgs.msg import ColorRGBA
00022
00023 def changeColor():
00024 pub = rospy.Publisher('light_controller/command', ColorRGBA, queue_size=1)
00025 rospy.init_node('light_test')
00026
00027 red = ColorRGBA()
00028 red.r = 1
00029 red.g = 0
00030 red.b = 0
00031 red.a = 1
00032
00033 yellow = ColorRGBA()
00034 yellow.r = 0.4
00035 yellow.g = 1
00036 yellow.b = 0
00037 yellow.a = 1
00038
00039 green = ColorRGBA()
00040 green.r = 0
00041 green.g = 1
00042 green.b = 0
00043 green.a = 1
00044
00045 blue = ColorRGBA()
00046 blue.r = 0
00047 blue.g = 0
00048 blue.b = 1
00049 blue.a = 1
00050
00051 white = ColorRGBA()
00052 white.r = 0.3
00053 white.g = 1
00054 white.b = 0.3
00055 white.a = 1
00056
00057 for color in [red,yellow,green,white,blue,green]:
00058 rospy.loginfo("Setting rgb to %s [%d, %d, %d]",color.r,color.g,color.b,color.a)
00059 pub.publish(color)
00060 time.sleep(3)
00061
00062 if __name__ == '__main__':
00063 try:
00064 changeColor()
00065 except rospy.ROSInterruptException: pass
00066