message_conversion.py 文件源码

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

项目:Cloudroid 作者: cyberdb 项目源码 文件源码
def _to_time_inst(msg, rostype, inst=None):
    # Create an instance if we haven't been provided with one
    if rostype == "time" and msg == "now":
        return rospy.get_rostime()

    if inst is None:
        if rostype == "time":
            inst = rospy.rostime.Time()
        elif rostype == "duration":
            inst = rospy.rostime.Duration()
        else:
            return None

    # Copy across the fields
    for field in ["secs", "nsecs"]:
        try:
            if field in msg:
                setattr(inst, field, msg[field])
        except TypeError:
            continue

    return inst
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号