CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
carla
road
Deformation.h
Go to the documentation of this file.
1
// Copyright (c) 2026 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 <memory>
10
#include <vector>
11
12
#include <
carla/geom/Mesh.h
>
13
#include <
carla/road/Road.h
>
14
#include <
carla/road/LaneSection.h
>
15
#include <
carla/road/Lane.h
>
16
#include <
carla/rpc/OpendriveGenerationParameters.h
>
17
18
namespace
carla
{
19
namespace
geom
{
20
namespace
deformation
{
21
inline
float
GetZPosInDeformation
(
float
posx,
float
posy){
22
// Amplitud
23
const
float
A1 = 0.6f;
24
const
float
A2 = 1.1f;
25
// Fases
26
const
float
F1 = 1000.0;
27
const
float
F2 = -1500.0;
28
// Modifiers
29
const
float
Kx1 = 0.035f;
30
const
float
Kx2 = 0.02f;
31
32
const
float
Ky1 = -0.08f;
33
const
float
Ky2 = 0.05f;
34
35
return
A1 * sin((Kx1 * posx + Ky1 * posy + F1)) +
36
A2 * sin((Kx2 * posx + Ky2 * posy + F2));
37
}
38
39
inline
float
GetBumpDeformation
(
float
posx,
float
posy){
40
const
float
A3 = 0.10f;
41
float
bumpsoffset = 0;
42
43
float
constraintX = 17.0f;
44
float
constraintY = 12.0f;
45
46
float
BumpX =
static_cast<
float
>
(std::ceil(posx / constraintX));
47
float
BumpY =
static_cast<
float
>
(std::floor(posy / constraintY));
48
49
BumpX *= constraintX;
50
BumpY *= constraintY;
51
52
float
DistanceToBumpOrigin =
static_cast<
float
>
(sqrt(pow(BumpX - posx, 2) + pow(BumpY - posy, 2)));
53
float
MaxDistance = 2.0f;
54
55
if
(DistanceToBumpOrigin <= MaxDistance) {
56
bumpsoffset =
static_cast<
float
>
(sin(DistanceToBumpOrigin));
57
}
58
59
return
A3 * bumpsoffset;
60
}
61
62
63
64
}
// namespace deformation
65
}
// namespace geom
66
}
// namespace carla
Mesh.h
OpendriveGenerationParameters.h
carla::geom::deformation
Definition
Deformation.h:20
carla::geom::deformation::GetBumpDeformation
float GetBumpDeformation(float posx, float posy)
Definition
Deformation.h:39
carla::geom::deformation::GetZPosInDeformation
float GetZPosInDeformation(float posx, float posy)
Definition
Deformation.h:21
carla::geom
Definition
Misc.h:24
carla
This file contains definitions of common data structures used in traffic manager.
Definition
SignComponent.h:21
LaneSection.h
Lane.h
Road.h
Generated by
1.18.0