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 from cob_light.msg import LightMode
00023
00024 def changeColor():
00025 pub = rospy.Publisher('light_controller/command_mode', LightMode, queue_size=1)
00026 rospy.init_node('light_test')
00027 light_mode = LightMode()
00028
00029 red = ColorRGBA()
00030 red.r = 1
00031 red.g = 0
00032 red.b = 0
00033 red.a = 1
00034
00035 yellow = ColorRGBA()
00036 yellow.r = 0.4
00037 yellow.g = 1
00038 yellow.b = 0
00039 yellow.a = 1
00040
00041 green = ColorRGBA()
00042 green.r = 0
00043 green.g = 1
00044 green.b = 0
00045 green.a = 1
00046
00047 blue = ColorRGBA()
00048 blue.r = 0
00049 blue.g = 0
00050 blue.b = 1
00051 blue.a = 1
00052
00053 white = ColorRGBA()
00054 white.r = 0.3
00055 white.g = 1
00056 white.b = 0.3
00057 white.a = 1
00058
00059 for color in [red,yellow,green,white,blue,green]:
00060 rospy.loginfo("Setting rgb to %s [%d, %d, %d]",color.r,color.g,color.b,color.a)
00061 light_mode.colors= 27*[color]
00062 pub.publish(light_mode)
00063 time.sleep(3)
00064
00065 if __name__ == '__main__':
00066 try:
00067 changeColor()
00068 except rospy.ROSInterruptException: pass
00069