28 from std_msgs.msg
import ColorRGBA
34 rospy.logdebug(
"waiting for /light_torso/set_light action server to start")
35 if not self.client.wait_for_server(rospy.Duration(5)):
37 rospy.logerr(
"/light_torso/set_light action server not ready within timeout, aborting...")
39 rospy.logdebug(
"/light_torso/set_light action server ready")
44 rospy.loginfo(
"setting action mode")
47 goal = SetLightModeGoal()
50 self.client.send_goal(goal)
51 self.client.wait_for_result()
52 res = self.client.get_result()
54 duration = random.uniform(0.0, 0.2)
58 req = SetLightModeRequest()
62 req.mode.mode=LightModes.BREATH
63 req.mode.frequency = 0.3
66 req.mode.colors.append(ColorRGBA(1.0,1.0,1.0,1.0))
69 req.mode.mode=LightModes.FLASH
70 req.mode.frequency = 2
73 req.mode.colors.append(ColorRGBA(1.0,1.0,1.0,1.0))
76 req.mode.mode=LightModes.BREATH
77 req.mode.frequency = 0.4
80 req.mode.colors.append(ColorRGBA(170.0/255.0, 250.0/255.0, 70.0/255.0, 1.0))
83 req.mode.mode=LightModes.BREATH
84 req.mode.frequency = 0.3
87 req.mode.colors.append(ColorRGBA(70.0/255.0, 140.0/255.0, 250.0/255.0, 1.0))
90 req.mode.mode=LightModes.BREATH
91 req.mode.frequency = 0.3
94 req.mode.colors.append(ColorRGBA(240.0/255.0, 250.0/255.0, 70.0/255.0, 1.0))
97 req.mode.mode=LightModes.BREATH
98 req.mode.frequency = 0.3
101 req.mode.colors.append(ColorRGBA(70.0/255.0, 240.0/255.0, 250.0/255.0, 1.0))
104 yellow = ColorRGBA(70.0/255.0, 240.0/255.0, 250.0/255.0, 1.0)
106 req.mode.mode=LightModes.BREATH
107 req.mode.frequency = 0.3
112 iterations = int(num_segs/2)
113 seg_div = int(58/num_segs)
114 for i
in range(0, iterations):
115 for j
in range (0, seg_div):
116 req.mode.colors.append(yellow)
117 for j
in range (0, seg_div):
118 req.mode.colors.append(black)
121 req.mode.mode=LightModes.BREATH
122 req.mode.frequency = 0.3
125 req.mode.colors.append(ColorRGBA(250.0/255.0, 70.0/255.0, 70.0/255.0, 1.0))
128 req.mode.mode=LightModes.BREATH
129 req.mode.frequency = 0.3
132 req.mode.colors.append(ColorRGBA(230.0/255.0, 250.0/255.0, 250.0/255.0, 1.0))
135 req.mode.mode=LightModes.FADE_COLOR
136 req.mode.frequency = 0.5
139 req.mode.colors.append(ColorRGBA(1,1,1,1))
142 req.mode.mode=LightModes.FLASH
143 req.mode.frequency = 4
146 req.mode.colors.append(ColorRGBA(230.0/255.0, 250.0/255.0, 250.0/255.0, 1.0))
149 req.mode.mode=LightModes.STATIC
150 req.mode.frequency = 1
153 req.mode.colors.append(ColorRGBA(150.0/255.0, 120.0/255.0, 255.0/255.0, 1.0))
156 req.mode.mode=LightModes.STATIC
157 req.mode.frequency = 1
160 req.mode.colors.append(ColorRGBA(255.0/255.0, 95.0/255.0, 1.0/255.0, 1.0))
163 req.mode.mode=LightModes.BREATH
164 req.mode.frequency = 0.8
167 req.mode.colors.append(ColorRGBA(1.0, 0.0, 0.0, 1.0))
170 req.mode.mode=LightModes.XMAS
171 req.mode.frequency = 0.8
174 req.mode.colors.append(ColorRGBA(1.0, 0.0, 0.0, 1.0))
179 if __name__ ==
'__main__':
180 rospy.init_node(
'light_action_test')
def getLightMode(self, mode)
def executeMode(self, event)