本文整理汇总了Python中std_msgs.msg.ColorRGBA.b方法的典型用法代码示例。如果您正苦于以下问题:Python ColorRGBA.b方法的具体用法?Python ColorRGBA.b怎么用?Python ColorRGBA.b使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std_msgs.msg.ColorRGBA
的用法示例。
在下文中一共展示了ColorRGBA.b方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: callLedsForDancing
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import b [as 别名]
def callLedsForDancing(self, blinking_freq):
"""
fColor : the first Color
sColor : the second Color
By defining LedGroup, we will have RGBA of color of each
set of colours.
I suppose that the last parameter of LEDS_BLINK is the frequency,
although its not on the server definition that I have.
"""
fColor = ColorRGBA()
sColor = ColorRGBA()
fColor.r = 0.5
fColor.g = 1.0
fColor.b = 0.5
sColor.r = 0.0
sColor.g = 0.0
sColor.b = 0.0
ledGroup = LedGroup()
first_color_duration = rospy.Duration(FIRST_COLOR_DURATION)
second_color_duration = rospy.Duration(SECOND_COLOR_DURATION)
try:
self.LEDS_BLINK(ledGroup, fColor, sColor, first_color_duration, second_color_duration, BLINK_EFECT_DURATION_DANCING, blinking_freq)
except rospy.ServiceException, e:
print "Service call To Blinking LEDs failed: %s" % e
示例2: SetColour
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import b [as 别名]
def SetColour(colour):
rgb_colour = ColorRGBA()
rgb_colour.a = 1.0
if colour == "RED":
rgb_colour.r = 1.0
rgb_colour.g = 0.0
rgb_colour.b = 0.0
return rgb_colour
if colour == "GREEN":
rgb_colour.r = 0.0
rgb_colour.g = 1.0
rgb_colour.b = 0.0
return rgb_colour
if colour == "BLUE":
rgb_colour.r = 0.0
rgb_colour.g = 0.0
rgb_colour.b = 1.0
return rgb_colour
if colour == "RANDOM":
rgb_colour.r = random.random()
rgb_colour.g = random.random()
rgb_colour.b = random.random()
return rgb_colour
assert (), "COLOUR not supported, changed to default RED type"
rgb_colour.r = 1.0
rgb_colour.g = 0.0
rgb_colour.b = 0.0
return rgb_colour
示例3: callback
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import b [as 别名]
def callback(joy):
motor = ColorRGBA()
color = ColorRGBA()
if joy.buttons[0]>0:
color.r = 0
color.g = 0
color.b = 150
if joy.buttons[1]>0:
color.r = 0
color.g = 150
color.b = 0
if joy.buttons[2]>0:
color.r = 150
color.g = 0
color.b = 0
if joy.buttons[3]>0:
color.r = 150
color.g = 80
color.b = 0
y=joy.axes[3]*100.0
x=joy.axes[2]*-100.0
##Ouputs throttle from -100 to 100
f = math.fabs(y/100.0)
left = y*f+(1-f)*x
right = y*f -(1-f)*x
#Change to 0..127..255
motor.b = left*254.0/200.0 +127.0
motor.a = left*254.0/200.0 +127.0
motor.r = right*254.0/200.0 +127.0
motor.g = right*254.0/200.0 +127.0
pub_motor.publish(motor)
pub_color.publish(color)
示例4: __init__
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import b [as 别名]
def __init__(self):
super(CCA, self).__init__()
#UIの初期化
self.initUI()
#ROSのパブリッシャなどの初期化
rospy.init_node('roscca', anonymous=True)
self.mpub = rospy.Publisher('visualization_marker_array', MarkerArray, queue_size=10)
self.ppub = rospy.Publisher('joint_diff', PointStamped, queue_size=10)
#rvizのカラー設定(未)
self.carray = []
clist = [[1,1,0,1],[0,1,0,1],[1,0,0,1]]
for c in clist:
color = ColorRGBA()
color.r = c[0]
color.g = c[1]
color.b = c[2]
color.a = c[3]
self.carray.append(color)
self.fnames=["20151222_a1.json","20151222_a2.json","20151222_a3.json","20151222_b1.json","20151222_b2.json","20151222_b3.json"]
#self.fnames=["20151222_a1.json"]
self.winSizes = [90]
示例5: __init__
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import b [as 别名]
def __init__(self):
super(CCA, self).__init__()
#UIの初期化
self.initUI()
#ファイル入力
#self.jsonInput()
#ROSのパブリッシャなどの初期化
rospy.init_node('ros_cca_table', anonymous=True)
self.mpub = rospy.Publisher('visualization_marker_array', MarkerArray, queue_size=10)
self.ppub = rospy.Publisher('joint_diff', PointStamped, queue_size=10)
self.carray = []
clist = [[1,1,0,1],[0,1,0,1],[1,0,0,1]]
for c in clist:
color = ColorRGBA()
color.r = c[0]
color.g = c[1]
color.b = c[2]
color.a = c[3]
self.carray.append(color)
示例6: main
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import b [as 别名]
def main():
display_pub = rospy.Publisher('leds/display', Keyframe, queue_size=10)
anim_pub = rospy.Publisher('leds/animation', Animation, queue_size=10)
set_pub = rospy.Publisher('leds/set', Command, queue_size=10)
rospy.init_node('led_anim_clear', anonymous = True)
time.sleep(0.5)
keyframe_msg = Keyframe()
command_msg = Command()
color_msg = ColorRGBA()
anim_msg = Animation()
rospy.loginfo("Single frame test ...")
keyframe_msg.color_pattern = []
color_msg.r = 0.0
color_msg.g = 0.0
color_msg.b = 0.0
keyframe_msg.color_pattern.append(copy.deepcopy(color_msg))
display_pub.publish(keyframe_msg)
time.sleep(0.5)
rospy.loginfo("Clearing the animation...")
anim_msg.iteration_count = 1
anim_pub.publish(anim_msg)
time.sleep(1)
示例7: to_msg
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import b [as 别名]
def to_msg(self):
msg = ColorRGBA()
msg.r = self.r / 255.0
msg.g = self.g / 255.0
msg.b = self.b / 255.0
msg.a = 1.0
return msg
示例8: __init__
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import b [as 别名]
def __init__(self):
super(CCA, self).__init__()
#UIの初期化
self.initUI()
#クラス間のデータ渡しテスト
self.test = 100
#ROSのパブリッシャなどの初期化
rospy.init_node('roscca', anonymous=True)
self.mpub = rospy.Publisher('visualization_marker_array', MarkerArray, queue_size=10)
self.ppub = rospy.Publisher('joint_diff', PointStamped, queue_size=10)
#rvizのカラー設定(未)
self.carray = []
clist = [[1,1,0,1],[0,1,0,1],[1,0,0,1]]
for c in clist:
color = ColorRGBA()
color.r = c[0]
color.g = c[1]
color.b = c[2]
color.a = c[3]
self.carray.append(color)
示例9: hex_to_color_msg
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import b [as 别名]
def hex_to_color_msg(hex_str):
rgb = struct.unpack('BBB', hex_str.decode('hex'))
msg = ColorRGBA()
msg.r = rgb[0]
msg.g = rgb[1]
msg.b = rgb[2]
msg.a = 1
return msg
示例10: callLedsForCmplxMv
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import b [as 别名]
def callLedsForCmplxMv(self):
fColor = ColorRGBA()
sColor = ColorRGBA()
fColor.r = 1.0
fColor.g = 1.0
fColor.b = 1.0
sColor.r = 0.0
sColor.g = 0.0
sColor.b = 0.0
ledGroup = LedGroup()
ledGroup.ledMask = 3 # binary mask to decide which leds are active
try:
self.LEDS_BLINK(ledGroup, fColor, sColor, rospy.Duration(0.75), rospy.Duration(0.25), rospy.Duration(5), 50)
except rospy.ServiceException, e:
print "Service call failed: %s" % e
示例11: static_area_makers
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import b [as 别名]
def static_area_makers(self):
color = ColorRGBA()
scale = Point()
scale.x = 0.05
scale.y = 0.05
color.r = 1.0
color.g = 1.0
color.b = 0.0
color.a = 1.0
self.points_marker = self.visual_test(self.static_area, Marker.POINTS, color, scale)
示例12: set_light
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import b [as 别名]
def set_light(self,parameter_name,blocking=False):
ah = action_handle("set", "light", parameter_name, blocking, self.parse)
if(self.parse):
return ah
else:
ah.set_active(mode="topic")
rospy.loginfo("Set light to <<%s>>",parameter_name)
# get joint values from parameter server
if type(parameter_name) is str:
if not rospy.has_param(self.ns_global_prefix + "/light/" + parameter_name):
rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/light/" + parameter_name)
return 2
param = rospy.get_param(self.ns_global_prefix + "/light/" + parameter_name)
else:
param = parameter_name
# check color parameters
if not type(param) is list: # check outer list
rospy.logerr("no valid parameter for light: not a list, aborting...")
print "parameter is:",param
ah.error_code = 3
return ah
else:
if not len(param) == 3: # check dimension
rospy.logerr("no valid parameter for light: dimension should be 3 (r,g,b) and is %d, aborting...",len(param))
print "parameter is:",param
ah.error_code = 3
return ah
else:
for i in param:
#print i,"type1 = ", type(i)
if not ((type(i) is float) or (type(i) is int)): # check type
#print type(i)
rospy.logerr("no valid parameter for light: not a list of float or int, aborting...")
print "parameter is:",param
ah.error_code = 3
return ah
else:
rospy.logdebug("accepted parameter %f for light",i)
# convert to ColorRGBA message
color = ColorRGBA()
color.r = param[0]
color.g = param[1]
color.b = param[2]
color.a = 1 # Transparency
# publish color
self.pub_light.publish(color)
ah.set_succeeded()
ah.error_code = 0
return ah
示例13: create_trajectory_marker
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import b [as 别名]
def create_trajectory_marker(self, traj):
# create an interactive marker for our server
int_marker = InteractiveMarker()
int_marker.header.frame_id = "/map"
int_marker.name = traj.uuid
int_marker.description = traj.uuid
pose = Pose()
pose.position.x = traj.pose[0]['position']['x']
pose.position.y = traj.pose[0]['position']['y']
int_marker.pose = pose
line_marker = Marker()
line_marker.type = Marker.LINE_STRIP
line_marker.scale.x = 0.05
# random.seed(traj.uuid)
# val = random.random()
# line_marker.color.r = r_func(val)
# line_marker.color.g = g_func(val)
# line_marker.color.b = b_func(val)
# line_marker.color.a = 1.0
line_marker.points = []
MOD = 1
for i, point in enumerate(traj.pose):
if i % MOD == 0:
x = point['position']['x']
y = point['position']['y']
p = Point()
p.x = x - int_marker.pose.position.x
p.y = y - int_marker.pose.position.y
line_marker.points.append(p)
line_marker.colors = []
for i, vel in enumerate(traj.vel):
if i % MOD == 0:
color = ColorRGBA()
val = vel / traj.max_vel
color.r = r_func(val)
color.g = g_func(val)
color.b = b_func(val)
color.a = 1.0
line_marker.colors.append(color)
# create a control which will move the box
# this control does not contain any markers,
# which will cause RViz to insert two arrows
control = InteractiveMarkerControl()
control.markers.append(line_marker)
int_marker.controls.append(control)
return int_marker
示例14: clear_area_makers
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import b [as 别名]
def clear_area_makers(self):
color = ColorRGBA()
scale = Point()
scale.x = 0.05
scale.y = 0.05
color.r = 0.0
color.g = 1.0
color.b = 0.0
color.a = 1.0
self.ClearPoints_marker = self.visual_test(self.clear_area, Marker.POINTS, color, scale)
print 'finish build markers', len(self.ClearPoints_marker.points)
示例15: visual_markers
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import b [as 别名]
def visual_markers(self):
color=ColorRGBA()
scale=Point()
scale.x=0.05
scale.y=0.05
color.r=0.0
color.g=1.0
color.b=0.0
color.a=0.5
self.line_marker=self.visual_test(self.cut_points, Marker.LINE_LIST, color, scale)#标记出区域划分(testing)
color=ColorRGBA()
scale=Point()
scale.x=0.1
scale.y=0.1
color.r=0.0
color.g=0.0
color.b=1.0
color.a=1.0
self.centre_points_marker=self.visual_test(self.centre_points,Marker.POINTS, color, scale)