CARLA
载入中...
搜索中...
未找到
Unreal
CarlaUE4
Plugins
Carla
Source
Carla
Recorder
CarlaRecorderKinematics.cpp
浏览该文件的文档.
1
// Copyright (c) 2020 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
#include "
CarlaRecorderKinematics.h
"
8
#include "
CarlaRecorder.h
"
9
#include "
CarlaRecorderHelpers.h
"
10
11
void
CarlaRecorderKinematics::Write
(std::ostream &OutFile)
12
{
13
WriteValue<uint32_t>(OutFile, this->
DatabaseId
);
14
WriteFVector
(OutFile, this->
LinearVelocity
);
15
WriteFVector
(OutFile, this->AngularVelocity);
16
}
17
18
void
CarlaRecorderKinematics::Read
(std::istream &InFile)
19
{
20
ReadValue<uint32_t>(InFile, this->
DatabaseId
);
21
ReadFVector
(InFile, this->
LinearVelocity
);
22
ReadFVector
(InFile, this->AngularVelocity);
23
}
24
25
// ---------------------------------------------
26
27
void
CarlaRecorderActorsKinematics::Clear
(
void
)
28
{
29
Kinematics
.clear();
30
}
31
32
void
CarlaRecorderActorsKinematics::Add
(
const
CarlaRecorderKinematics
&InObj)
33
{
34
Kinematics
.push_back(InObj);
35
}
36
37
void
CarlaRecorderActorsKinematics::Write
(std::ostream &OutFile)
38
{
39
if
(
Kinematics
.size() == 0)
40
{
41
return
;
42
}
43
// write the packet id
44
WriteValue<char>(OutFile,
static_cast<
char
>
(
CarlaRecorderPacketId::Kinematics
));
45
46
// write the packet size
47
uint32_t Total = 2 +
Kinematics
.size() *
sizeof
(
CarlaRecorderKinematics
);
48
WriteValue<uint32_t>(OutFile, Total);
49
50
// write total records
51
Total =
Kinematics
.size();
52
WriteValue<uint16_t>(OutFile, Total);
53
54
// write records
55
for
(
auto
& Kinematic :
Kinematics
)
56
{
57
Kinematic.Write(OutFile);
58
}
59
}
WriteFVector
void WriteFVector(std::ostream &OutFile, const FVector &InObj)
Definition
CarlaRecorderHelpers.cpp:38
ReadFVector
void ReadFVector(std::istream &InFile, FVector &OutObj)
Definition
CarlaRecorderHelpers.cpp:68
CarlaRecorderHelpers.h
CarlaRecorderKinematics.h
CarlaRecorder.h
CarlaRecorderPacketId::Kinematics
@ Kinematics
CarlaRecorderActorsKinematics::Clear
void Clear(void)
Definition
CarlaRecorderKinematics.cpp:27
CarlaRecorderActorsKinematics::Add
void Add(const CarlaRecorderKinematics &InObj)
Definition
CarlaRecorderKinematics.cpp:32
CarlaRecorderActorsKinematics::Write
void Write(std::ostream &OutFile)
Definition
CarlaRecorderKinematics.cpp:37
CarlaRecorderActorsKinematics::Kinematics
std::vector< CarlaRecorderKinematics > Kinematics
Definition
CarlaRecorderKinematics.h:37
CarlaRecorderKinematics
Definition
CarlaRecorderKinematics.h:14
CarlaRecorderKinematics::LinearVelocity
FVector LinearVelocity
Definition
CarlaRecorderKinematics.h:16
CarlaRecorderKinematics::Write
void Write(std::ostream &OutFile)
Definition
CarlaRecorderKinematics.cpp:11
CarlaRecorderKinematics::Read
void Read(std::istream &InFile)
Definition
CarlaRecorderKinematics.cpp:18
CarlaRecorderKinematics::DatabaseId
uint32_t DatabaseId
Definition
CarlaRecorderKinematics.h:15
制作者
1.10.0