test_sprofi_part.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 #
3 # Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 
17 
18 import time
19 
20 import rospy
21 from std_msgs.msg import ColorRGBA
22 from cob_light.msg import LightMode
23 
25  pub = rospy.Publisher('light_controller/command_mode', LightMode, queue_size=1)
26  rospy.init_node('light_test')
27  light_mode = LightMode()
28  #color in rgb color space ranging from 0 to 1
29  red = ColorRGBA()
30  red.r = 1
31  red.g = 0
32  red.b = 0
33  red.a = 1
34 
35  yellow = ColorRGBA()
36  yellow.r = 0.4
37  yellow.g = 1
38  yellow.b = 0
39  yellow.a = 1
40 
41  green = ColorRGBA()
42  green.r = 0
43  green.g = 1
44  green.b = 0
45  green.a = 1
46 
47  blue = ColorRGBA()
48  blue.r = 0
49  blue.g = 0
50  blue.b = 1
51  blue.a = 1
52 
53  white = ColorRGBA()
54  white.r = 0.3
55  white.g = 1
56  white.b = 0.3
57  white.a = 1
58 
59  for color in [red,yellow,green,white,blue,green]:
60  rospy.loginfo("Setting rgb to %s [%d, %d, %d]",color.r,color.g,color.b,color.a)
61  light_mode.colors= 27*[color]
62  pub.publish(light_mode)
63  time.sleep(3)
64 
65 if __name__ == '__main__':
66  try:
67  changeColor()
68  except rospy.ROSInterruptException: pass
69 


cob_light
Author(s): Benjamin Maidel
autogenerated on Thu Mar 19 2020 03:23:09