CARLA
 
载入中...
搜索中...
未找到
IMUSerializer.h
浏览该文件的文档.
1// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7#pragma once
8
9#include "carla/Buffer.h"
10#include "carla/Memory.h"
12
13namespace carla {
14namespace sensor {
15
16 class SensorData;
17
18namespace s11n {
19
21 {
22 public:
23
24 struct Data {
25
27
29
30 float compass;
31
32 MSGPACK_DEFINE_ARRAY(accelerometer, gyroscope, compass)
33 };
34
35 template <typename SensorT>
36 static Buffer Serialize(
37 const SensorT &sensor,
38 const geom::Vector3D &accelerometer,
39 const geom::Vector3D &gyroscope,
40 const float compass);
41
42 static Data DeserializeRawData(const RawData &message) {
43 return MsgPack::UnPack<Data>(message.begin(), message.size());
44 }
45
47 };
48
49 template <typename SensorT>
51 const SensorT &,
52 const geom::Vector3D &accelerometer,
53 const geom::Vector3D &gyroscope,
54 const float compass) {
55 return MsgPack::Pack(Data{accelerometer, gyroscope, compass});
56 }
57
58} // namespace s11n
59} // namespace sensor
60} // namespace carla
A piece of raw data.
static Buffer Pack(const T &obj)
Definition MsgPack.h:19
Wrapper around the raw data generated by a sensor plus some useful meta-information.
Definition RawData.h:21
auto begin() noexcept
Begin iterator to the data generated by the sensor.
Definition RawData.h:52
size_t size() const
Size in bytes of the data generated by the sensor.
Definition RawData.h:83
static Buffer Serialize(const SensorT &sensor, const geom::Vector3D &accelerometer, const geom::Vector3D &gyroscope, const float compass)
static SharedPtr< SensorData > Deserialize(RawData &&data)
static Data DeserializeRawData(const RawData &message)
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
Definition Memory.h:20