(ros_msg, agent)
return sample
Convert a SampleResult ROS message into a Sample Python object.
Convert a SampleResult ROS message into a Sample Python object.
Convert a SampleResult ROS message into a Sample Python object .
def msg_to_sample(ros_msg, agent):
    """
    Convert a SampleResult ROS message into a Sample Python object.
    """
    sample = Sample(agent)
    for sensor in ros_msg.sensor_data:
        sensor_id = sensor.data_type
        shape = np.array(sensor.shape)
        data = np.array(sensor.data).reshape(shape)
        sample.set(sensor_id, data)
    return sample
def msg_to_sample ( ros_msg , agent ) : sample = Sample ( agent ) for sensor in ros_msg . sensor_data : sensor_id = sensor . data_type shape = np . array ( sensor . shape ) data = np . array ( sensor . data ) . reshape ( shape ) sample . set ( sensor_id , data ) return sample