本文整理汇总了Python中std_msgs.msg.ColorRGBA.a方法的典型用法代码示例。如果您正苦于以下问题:Python ColorRGBA.a方法的具体用法?Python ColorRGBA.a怎么用?Python ColorRGBA.a使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std_msgs.msg.ColorRGBA
的用法示例。
在下文中一共展示了ColorRGBA.a方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: callback
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import a [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)
示例2: __init__
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import a [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)
示例3: SetColour
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import a [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
示例4: __init__
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import a [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)
示例5: __init__
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import a [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]
示例6: to_msg
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import a [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
示例7: hex_to_color_msg
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import a [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
示例8: get_color
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import a [as 别名]
def get_color(self, obj):
if obj in self.objects:
return self.objects[obj]
else:
c = ColorRGBA()
c.r, c.g, c.b = self.COLORS[len(self.objects) % len(self.COLORS)]
c.a = 1.0
self.objects[obj] = c
return c
示例9: robot_position_marker
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import a [as 别名]
def robot_position_marker(self):
color = ColorRGBA()
scale = Point()
scale.x = 0.1
scale.y = 0.1
scale.z = 0.1
color.r = 1.0
color.a = 1.0
self.robot_position = self.visual_test(self.pose, Marker.CUBE, color, scale)
示例10: static_area_makers
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import a [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)
示例11: set_light
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import a [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
示例12: create_trajectory_marker
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import a [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
示例13: clear_area_makers
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import a [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)
示例14: visual_markers
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import a [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)
示例15: LaserDataMarker
# 需要导入模块: from std_msgs.msg import ColorRGBA [as 别名]
# 或者: from std_msgs.msg.ColorRGBA import a [as 别名]
def LaserDataMarker(self,LaserData): ####################visual_test
color=ColorRGBA()
scale=Point()
scale.x=0.04
scale.y=0.04
color.r=0.0
color.g=2.0
color.b=0.0
color.a=1.0
self.laser_points_marker=self.visual_test(LaserData, Marker.POINTS, color, scale)