CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
carla
pytorch
pytorch.h
Go to the documentation of this file.
1
// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de Barcelona (UAB).
2
// This work is licensed under the terms of the MIT license.
3
// For a copy, see <https://opensource.org/licenses/MIT>.
4
5
#pragma once
6
#define _GLIBCXX_USE_CXX11_ABI 0
7
8
#include <memory>
9
#include <vector>
10
11
namespace
carla
{
12
namespace
learning {
13
14
void
test_learning
();
15
16
struct
NeuralModelImpl;
17
18
struct
WheelInput
{
19
public
:
20
int
num_particles
= 0;
21
float
*
particles_positions
;
22
float
*
particles_velocities
;
23
float
*
wheel_positions
;
24
float
*
wheel_oritentation
;
25
float
*
wheel_linear_velocity
;
26
float
*
wheel_angular_velocity
;
27
};
28
29
struct
Inputs
{
30
public
:
31
WheelInput
wheel0
;
32
WheelInput
wheel1
;
33
WheelInput
wheel2
;
34
WheelInput
wheel3
;
35
float
steering
= 0;
36
float
throttle
= 0;
37
float
braking
= 0;
38
int
terrain_type
= 0;
39
bool
verbose
=
false
;
40
};
41
42
struct
WheelOutput
{
43
public
:
44
float
wheel_forces_x
= 0;
45
float
wheel_forces_y
= 0;
46
float
wheel_forces_z
= 0;
47
float
wheel_torque_x
= 0;
48
float
wheel_torque_y
= 0;
49
float
wheel_torque_z
= 0;
50
std::vector<float>
_particle_forces
;
51
};
52
struct
Outputs
{
53
public
:
54
WheelOutput
wheel0
;
55
WheelOutput
wheel1
;
56
WheelOutput
wheel2
;
57
WheelOutput
wheel3
;
58
};
59
60
// Interface with the torch implementation
61
class
NeuralModel
{
62
public
:
63
64
NeuralModel
();
65
void
LoadModel
(
char
* filename,
int
device);
66
67
void
SetInputs
(
Inputs
input);
68
void
Forward
();
69
void
ForwardDynamic
();
70
void
ForwardCUDATensors
();
71
Outputs
&
GetOutputs
();
72
73
~NeuralModel
();
74
75
private
:
76
std::unique_ptr<NeuralModelImpl>
Model
;
77
Inputs
_input
;
78
Outputs
_output
;
79
};
80
81
}
82
}
carla::learning::NeuralModel::GetOutputs
Outputs & GetOutputs()
Definition
pytorch.cpp:286
carla::learning::NeuralModel::_input
Inputs _input
Definition
pytorch.h:77
carla::learning::NeuralModel::SetInputs
void SetInputs(Inputs input)
Definition
pytorch.cpp:177
carla::learning::NeuralModel::ForwardCUDATensors
void ForwardCUDATensors()
Definition
pytorch.cpp:253
carla::learning::NeuralModel::Model
std::unique_ptr< NeuralModelImpl > Model
Definition
pytorch.h:76
carla::learning::NeuralModel::LoadModel
void LoadModel(char *filename, int device)
Definition
pytorch.cpp:162
carla::learning::NeuralModel::NeuralModel
NeuralModel()
Definition
pytorch.cpp:159
carla::learning::NeuralModel::_output
Outputs _output
Definition
pytorch.h:78
carla::learning::NeuralModel::Forward
void Forward()
Definition
pytorch.cpp:182
carla::learning::NeuralModel::ForwardDynamic
void ForwardDynamic()
Definition
pytorch.cpp:214
carla::learning::test_learning
void test_learning()
Definition
pytorch.cpp:27
carla
This file contains definitions of common data structures used in traffic manager.
Definition
SignComponent.h:21
carla::learning::Inputs
Definition
pytorch.h:29
carla::learning::Inputs::throttle
float throttle
Definition
pytorch.h:36
carla::learning::Inputs::wheel0
WheelInput wheel0
Definition
pytorch.h:31
carla::learning::Inputs::terrain_type
int terrain_type
Definition
pytorch.h:38
carla::learning::Inputs::wheel3
WheelInput wheel3
Definition
pytorch.h:34
carla::learning::Inputs::wheel2
WheelInput wheel2
Definition
pytorch.h:33
carla::learning::Inputs::verbose
bool verbose
Definition
pytorch.h:39
carla::learning::Inputs::wheel1
WheelInput wheel1
Definition
pytorch.h:32
carla::learning::Inputs::steering
float steering
Definition
pytorch.h:35
carla::learning::Inputs::braking
float braking
Definition
pytorch.h:37
carla::learning::Outputs
Definition
pytorch.h:52
carla::learning::Outputs::wheel1
WheelOutput wheel1
Definition
pytorch.h:55
carla::learning::Outputs::wheel0
WheelOutput wheel0
Definition
pytorch.h:54
carla::learning::Outputs::wheel3
WheelOutput wheel3
Definition
pytorch.h:57
carla::learning::Outputs::wheel2
WheelOutput wheel2
Definition
pytorch.h:56
carla::learning::WheelInput
Definition
pytorch.h:18
carla::learning::WheelInput::particles_velocities
float * particles_velocities
Definition
pytorch.h:22
carla::learning::WheelInput::particles_positions
float * particles_positions
Definition
pytorch.h:21
carla::learning::WheelInput::num_particles
int num_particles
Definition
pytorch.h:20
carla::learning::WheelInput::wheel_angular_velocity
float * wheel_angular_velocity
Definition
pytorch.h:26
carla::learning::WheelInput::wheel_positions
float * wheel_positions
Definition
pytorch.h:23
carla::learning::WheelInput::wheel_oritentation
float * wheel_oritentation
Definition
pytorch.h:24
carla::learning::WheelInput::wheel_linear_velocity
float * wheel_linear_velocity
Definition
pytorch.h:25
carla::learning::WheelOutput
Definition
pytorch.h:42
carla::learning::WheelOutput::wheel_forces_z
float wheel_forces_z
Definition
pytorch.h:46
carla::learning::WheelOutput::wheel_forces_x
float wheel_forces_x
Definition
pytorch.h:44
carla::learning::WheelOutput::wheel_torque_z
float wheel_torque_z
Definition
pytorch.h:49
carla::learning::WheelOutput::wheel_forces_y
float wheel_forces_y
Definition
pytorch.h:45
carla::learning::WheelOutput::wheel_torque_x
float wheel_torque_x
Definition
pytorch.h:47
carla::learning::WheelOutput::wheel_torque_y
float wheel_torque_y
Definition
pytorch.h:48
carla::learning::WheelOutput::_particle_forces
std::vector< float > _particle_forces
Definition
pytorch.h:50
Generated by
1.18.0