message_conversion.py 文件源码

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

项目:Cloudroid 作者: cyberdb 项目源码 文件源码
def _from_inst(inst, rostype):
    # Special case for uint8[], we base64 encode the string
    if rostype in ros_binary_types:
        return standard_b64encode(inst)

    # Check for time or duration
    if rostype in ros_time_types:
        return {"secs": inst.secs, "nsecs": inst.nsecs}

    # Check for primitive types
    if rostype in ros_primitive_types:
        return inst

    # Check if it's a list or tuple
    if type(inst) in list_types:
        return _from_list_inst(inst, rostype)

    # Assume it's otherwise a full ros msg object
    return _from_object_inst(inst, rostype)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号