28 from std_msgs.msg
import ColorRGBA
35 rospy.loginfo(
"setting service mode")
38 srv_light = rospy.ServiceProxy(
'/light_torso/set_light', SetLightMode)
41 duration = random.uniform(0, 0.5)
45 req = SetLightModeRequest()
49 req.mode.mode=LightModes.BREATH
50 req.mode.frequency = 0.3
53 req.mode.colors.append(ColorRGBA(1.0,1.0,1.0,1.0))
56 req.mode.mode=LightModes.FLASH
57 req.mode.frequency = 2
60 req.mode.colors.append(ColorRGBA(1.0,1.0,1.0,1.0))
63 req.mode.mode=LightModes.BREATH
64 req.mode.frequency = 0.4
67 req.mode.colors.append(ColorRGBA(170.0/255.0, 250.0/255.0, 70.0/255.0, 1.0))
70 req.mode.mode=LightModes.BREATH
71 req.mode.frequency = 0.3
74 req.mode.colors.append(ColorRGBA(70.0/255.0, 140.0/255.0, 250.0/255.0, 1.0))
77 req.mode.mode=LightModes.BREATH
78 req.mode.frequency = 0.3
81 req.mode.colors.append(ColorRGBA(240.0/255.0, 250.0/255.0, 70.0/255.0, 1.0))
84 req.mode.mode=LightModes.BREATH
85 req.mode.frequency = 0.3
88 req.mode.colors.append(ColorRGBA(70.0/255.0, 240.0/255.0, 250.0/255.0, 1.0))
91 yellow = ColorRGBA(70.0/255.0, 240.0/255.0, 250.0/255.0, 1.0)
93 req.mode.mode=LightModes.BREATH
94 req.mode.frequency = 0.3
99 iterations = int(num_segs/2)
100 seg_div = int(58/num_segs)
101 for i
in range(0, iterations):
102 for j
in range (0, seg_div):
103 req.mode.colors.append(yellow)
104 for j
in range (0, seg_div):
105 req.mode.colors.append(black)
108 req.mode.mode=LightModes.BREATH
109 req.mode.frequency = 0.3
112 req.mode.colors.append(ColorRGBA(250.0/255.0, 70.0/255.0, 70.0/255.0, 1.0))
115 req.mode.mode=LightModes.BREATH
116 req.mode.frequency = 0.3
119 req.mode.colors.append(ColorRGBA(230.0/255.0, 250.0/255.0, 250.0/255.0, 1.0))
122 req.mode.mode=LightModes.FADE_COLOR
123 req.mode.frequency = 0.5
126 req.mode.colors.append(ColorRGBA(1,1,1,1))
129 req.mode.mode=LightModes.FLASH
130 req.mode.frequency = 4
133 req.mode.colors.append(ColorRGBA(230.0/255.0, 250.0/255.0, 250.0/255.0, 1.0))
136 req.mode.mode=LightModes.STATIC
137 req.mode.frequency = 1
140 req.mode.colors.append(ColorRGBA(150.0/255.0, 120.0/255.0, 255.0/255.0, 1.0))
143 req.mode.mode=LightModes.STATIC
144 req.mode.frequency = 1
147 req.mode.colors.append(ColorRGBA(255.0/255.0, 95.0/255.0, 1.0/255.0, 1.0))
150 req.mode.mode=LightModes.BREATH
151 req.mode.frequency = 0.8
154 req.mode.colors.append(ColorRGBA(1.0, 0.0, 0.0, 1.0))
157 req.mode.mode=LightModes.XMAS
158 req.mode.frequency = 0.8
161 req.mode.colors.append(ColorRGBA(1.0, 0.0, 0.0, 1.0))
166 if __name__ ==
'__main__':
167 rospy.init_node(
'light_service_test')
def getLightMode(self, mode)
def executeMode(self, event)