gazeboObject.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:arm_scenario_simulator 作者: cmaestre 项目源码 文件源码
def set_color(self, rgba, link="link", ambient_coeff=0.7, specular_coeff=0.7):
        rgba = list(rgba)
        if len(rgba) is 3: rgba +=[self.color_range]
        r,g,b,a = tuple(rgba)
        a = self.color_range if a is None else a
        message = MaterialColor()
        message.color_type = [COLOR_TYPE['diffuse'], COLOR_TYPE['ambient'], COLOR_TYPE['specular']]
        message.color.append(ColorRGBA(r/self.color_range, g/self.color_range, b/self.color_range, a/self.color_range))
        message.color.append(ColorRGBA(0.7*r/self.color_range, 0.7*g/self.color_range, 0.7*b/self.color_range, a/self.color_range))
        message.color.append(ColorRGBA(1-specular_coeff*(1-r/self.color_range), 1-specular_coeff*(1-g/self.color_range), 1-specular_coeff*(1-b/self.color_range), a/self.color_range))
        self.color_publishers[link].publish(message)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号