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)
评论列表
文章目录