Compare commits

...

66 Commits

Author SHA1 Message Date
Jose 87dce70aa5
Merge 1ec58b4cf5 into 2a2cc5f1be 2024-10-07 16:31:59 +02:00
MattRoweEAIF 2a2cc5f1be
added unreal coord system, fixed v2x (#8251) 2024-10-07 15:27:01 +02:00
MattRoweEAIF f7ed6c25e9
fix typo in title (#8225) 2024-09-30 13:45:22 +02:00
Blyron 4feeb77b2b Merge branch 'dev' of https://github.com/carla-simulator/carla into dev 2024-09-25 08:26:25 +02:00
Ylmdrin 92a6e71c6b
Correcting makefile typo to avoid override warning for target "downloadplugins" (#8167)
The downloadplugins target is already defined below (line 162).
2024-09-20 10:53:29 +02:00
Sergio Paniego Blanco c7339367b9
Fixed typo in CityScapes palette (#8137) 2024-09-13 21:07:25 +02:00
Jorge Virgos 4d09f0a660 Porting the changes done to UE5 to fix the recording leak to UE4
The slowdown is considerably more noticeable here since the engine runs much smoother. This makes evident that this is a stopgap measure, and should be looked into further down the line.
2024-09-12 14:26:28 +02:00
AreopagX 9e94feb3a5 navigation information is now loaded when changing maps 2024-09-11 22:01:15 +02:00
Blyron 00df447670 Merge branch 'dev' of https://github.com/carla-simulator/carla into dev 2024-09-02 10:50:07 +02:00
MattRoweEAIF c097d7acf1
added digital twins video (#8090) 2024-08-29 14:58:48 +02:00
Daniel 334740ae53 Fixed Vector arithmetic 2024-08-28 12:58:24 +02:00
Daniel 7633334063 Corrections and additions
more setters
missing, wrong types corrected
spelling
2024-08-28 12:58:24 +02:00
Daniel 2b465bcd66 Improved Callable and callbacks signature 2024-08-28 12:58:24 +02:00
Daniel aec0b261af Added Transform.inverse_transform and corrected signature
parameter is called in_point not in_vector
2024-08-28 12:58:24 +02:00
Daniel 58e0374f4f Corrected [try_]spawn_actor keyword name 2024-08-28 12:58:24 +02:00
Daniel 26dc386724 Improved get_waypoints and Literal type hints 2024-08-28 12:58:24 +02:00
Daniel 798c9e144c Added setters for VehicleControl 2024-08-28 12:58:24 +02:00
Daniel 77856f467c Various fixes
- wrong signatures
- wrong names
2024-08-28 12:58:24 +02:00
Daniel ca81e35d59 Added self parameter to property signatures 2024-08-28 12:58:24 +02:00
Daniel da80757e27 Fixes for wrong stubs
- OpendriveGenerationParameter had no init
- missing @property
- wrong signatures
2024-08-28 12:58:24 +02:00
Daniel 453ceca112 Fix: Enum values were tuples. Added Flag or Int to Enums 2024-08-28 12:58:24 +02:00
Daniel a959577ccf Better usage of Enum if typing.Self is availiable
Using Self will not report an override / incompatible error.
2024-08-28 12:58:24 +02:00
Daniel b061f9e951 Fix spelling mistakes 2024-08-28 12:58:24 +02:00
Daniel f797e1593a Improved get_waypoint disambiguation
correctly added two overload function
2024-08-28 12:58:24 +02:00
Daniel 41e595c056 Corrected and more precise type-hints
- fixed carla.Waypoint.next_until_lane_end
2024-08-28 12:58:24 +02:00
Daniel d9c217ee3c Added stubs for HUD drawing
Functions from #7168
2024-08-28 12:58:24 +02:00
Daniel a089c3b800 Formatted some docstring to be shorter 2024-08-28 12:58:24 +02:00
Daniel 19b892f76b Fix missing @property 2024-08-28 12:58:24 +02:00
Daniel 8df99c0414 Fix intendation shadowing methods 2024-08-28 12:58:24 +02:00
Daniel 2935897950 Added type hints for `values` attribute on enums 2024-08-28 12:58:24 +02:00
Daniel ddb5834e38 Corrected Sensor.is_listening
Was changed to a function in 0.9.15. More info see: https://github.com/carla-simulator/carla/pull/7439
2024-08-28 12:58:24 +02:00
Daniel e765559384 Added undocumented variables
FutureActor
laod_world_if_different
2024-08-28 12:58:24 +02:00
Daniel df1eb25721 Disambiguated get_waypoint signature
Syntax fix (squased)
2024-08-28 12:58:24 +02:00
Daniel caac503fdb Fixed CityObjectLabels 2024-08-28 12:58:24 +02:00
Daniel 4c086ad7d9 ActorList.filter actually returns ActorList 2024-08-28 12:58:24 +02:00
Daniel 1d4450b026 Filled in missing information and types. 2024-08-28 12:58:24 +02:00
Daniel 0197e0ae5b FIX: added ApplyTransform, fixed ApplyTorque 2024-08-28 12:58:24 +02:00
Daniel de33210abd FIX: __init__ methods do not return 2024-08-28 12:58:24 +02:00
Daniel a0cff71434 Added missing return value to reload_world 2024-08-28 12:58:24 +02:00
Daniel 232cb8c250 Added missing -> World to load_world 2024-08-28 12:58:24 +02:00
Daniel 755c0d827d Removed wrong unit indication 2024-08-28 12:58:24 +02:00
Daniel 4c1104dc47 Fixed spelling misstakes 2024-08-28 12:58:24 +02:00
Daniel f275e47f4e Added missing type for Labelled Point 2024-08-28 12:58:24 +02:00
Daniel 7b2c1db39b Added DSVEventArray iterator 2024-08-28 12:58:24 +02:00
Daniel 251b293d61 Updated changelog
needs merge with dev version
2024-08-28 12:58:24 +02:00
Daniel bc6e7cd5ea Fixed missing return types 2024-08-28 12:58:24 +02:00
Daraan be8735fc28 Fixed Actor.parent
Can be None or an Actor
2024-08-28 12:58:24 +02:00
Daniel 951fcc4cc9 Fixes and missing Iterators 2024-08-28 12:58:24 +02:00
Minokori fd44ea0ca1 Add a `*.pyi` file for auto-completion & hints.
To enable auto-completion and hints in code editors such as VScode, create a `*.pyi` file. This feature is compatible with `python 3.9` and later versions.
2024-08-28 12:58:24 +02:00
Blyron e83b79be74 Merge branch 'dev' of https://github.com/carla-simulator/carla into dev 2024-07-31 11:47:56 +02:00
Blyron 32f97eae66 Merge branch 'dev' of https://github.com/carla-simulator/carla into dev 2024-07-19 09:33:24 +02:00
Blyron c83c045ada Merge branch 'dev' of https://github.com/carla-simulator/carla into dev 2024-07-10 10:01:02 +02:00
Blyron 7c47e7db37 Merge branch 'dev' of https://github.com/carla-simulator/carla into dev 2024-07-08 08:36:42 +02:00
Blyron 17963902e5 Merge branch 'dev' of https://github.com/carla-simulator/carla into dev 2024-05-30 14:58:53 +02:00
Blyron 5043ad73fc Merge branch 'dev' of https://github.com/carla-simulator/carla into dev 2024-05-28 11:49:41 +02:00
Blyron b86b1997fc Merge branch 'dev' of https://github.com/carla-simulator/carla into dev 2024-05-21 11:38:39 +02:00
Blyron 2a507990d3 Merge branch 'dev' of https://github.com/carla-simulator/carla into dev 2024-05-15 08:55:48 +02:00
Blyron d854ab5f89 Merge branch 'dev' of https://github.com/carla-simulator/carla into dev 2024-05-14 12:40:04 +02:00
Blyron 649e2aa56b Merge branch 'dev' of https://github.com/carla-simulator/carla into dev 2024-05-13 16:07:17 +02:00
Blyron 5be0e2fd17 Fix OSM2ODR build 2024-05-06 16:29:17 +02:00
JoseM98 1ec58b4cf5 Merge with dev 2024-04-18 13:46:04 +02:00
Blyron bc96c5feb9
Merge branch 'dev' into jose/adjustvehiclebb 2024-02-13 14:17:32 +01:00
Blyron 200b138dbc
Merge branch 'dev' into jose/adjustvehiclebb 2024-02-09 11:32:06 +01:00
JoseMartinez 19227624d7 Removed KistmetSystemLibrary include. 2024-02-08 13:14:05 +01:00
JoseMartinez 914007b2ce Updating changelog 2024-02-08 10:17:56 +01:00
JoseMartinez 5488f1bea6 Adjusted BB when doors are oppened. 2024-02-08 10:12:38 +01:00
16 changed files with 5845 additions and 39 deletions

View File

@ -1,6 +1,8 @@
## Latest Changes ## Latest Changes
* Fixed a bug that caused navigation information not to be loaded when switching maps
* Prevent from segfault on failing SignalReference identification when loading OpenDrive files * Prevent from segfault on failing SignalReference identification when loading OpenDrive files
* Added vehicle doors to the recorder * Added vehicle doors to the recorder
* Adjusted vehicle BoundingBox when the vehicle opens the doors.
* Added functions to get actor' components transform * Added functions to get actor' components transform
* Added posibility to Digital Twins to work with local files (osm and xodr) * Added posibility to Digital Twins to work with local files (osm and xodr)
* Enable proper material merging for Building in Digital Twins * Enable proper material merging for Building in Digital Twins
@ -18,6 +20,7 @@
* PythonAPI `Sensor.is_listening` was defined twice (property and method), cleaned and clarified it as a method. * PythonAPI `Sensor.is_listening` was defined twice (property and method), cleaned and clarified it as a method.
* Added V2X sensors for cooperative awareness message and custom user-defined messages to support vehicle-to-vehicle communication * Added V2X sensors for cooperative awareness message and custom user-defined messages to support vehicle-to-vehicle communication
* Added named tuples for BasicAgent.py's detection result to allow for type-hints and better semantics. * Added named tuples for BasicAgent.py's detection result to allow for type-hints and better semantics.
* Added type-hint support for the PythonAPI
## CARLA 0.9.15 ## CARLA 0.9.15

View File

@ -15,6 +15,8 @@
The __Digital Twin Tool__ enables procedural generation of unique 3D environments based on road networks derived from the [OpenStreetMap](https://www.openstreetmap.org) (OSM) service. Through the Digital Twin Tool interface in CARLA's Unreal Engine editor a user can select a region of map from OSM and download the road network as the basis for a new CARLA map. The tool then fills the spaces between the roads with procedurally generated 3D buildings that adjust to the layout of the road, creating a realistic 3D road environment with high variability. The __Digital Twin Tool__ enables procedural generation of unique 3D environments based on road networks derived from the [OpenStreetMap](https://www.openstreetmap.org) (OSM) service. Through the Digital Twin Tool interface in CARLA's Unreal Engine editor a user can select a region of map from OSM and download the road network as the basis for a new CARLA map. The tool then fills the spaces between the roads with procedurally generated 3D buildings that adjust to the layout of the road, creating a realistic 3D road environment with high variability.
<iframe width="100%" height="400px" src="https://www.youtube.com/embed/gTutXdS2UkQ?si=hssM3YRCAjSIzdXM" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
## Building the OSM renderer ## Building the OSM renderer
If you are using Linux, you have the option of using the OSM renderer in the CARLA interface to navigate a large OSM map region that you have downloaded. You first need to build the OSM renderer before proceeding to build CARLA. Run `make osmrenderer` inside the CARLA root directory. You may need to upgrade your version of CMake to v3.2 or above in order for this to work. This will create two folders in your build directory called `libosmcout-source` and `libosmcout-build`. Before proceeding to build CARLA, you need to then edit the `Build.sh` file in the directory `$CARLA_ROOT/Build/libosmcout-source/maps` like so, to ensure the executable is found: If you are using Linux, you have the option of using the OSM renderer in the CARLA interface to navigate a large OSM map region that you have downloaded. You first need to build the OSM renderer before proceeding to build CARLA. Run `make osmrenderer` inside the CARLA root directory. You may need to upgrade your version of CMake to v3.2 or above in order for this to work. This will create two folders in your build directory called `libosmcout-source` and `libosmcout-build`. Before proceeding to build CARLA, you need to then edit the `Build.sh` file in the directory `$CARLA_ROOT/Build/libosmcout-source/maps` like so, to ensure the executable is found:

View File

@ -1,7 +1,7 @@
!!! warning !!! warning
This is a work in progress!! This version of CARLA is not considered a stable release. Over the following months many significant changes may be made to this branch which could break any modifications you make. We advise you to treat this branch as experimental. This is a work in progress!! This version of CARLA is not considered a stable release. Over the following months many significant changes may be made to this branch which could break any modifications you make. We advise you to treat this branch as experimental.
# Building CARLA in Windowswith Unreal Engine 5.3 # Building CARLA in Windows with Unreal Engine 5.3
## Set up the environment ## Set up the environment

BIN
Docs/img/unreal_lhcs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -1999,7 +1999,7 @@ Iterate over the [carla.RadarDetection](#carla.RadarDetection) retrieved as data
## carla.Rotation<a name="carla.Rotation"></a> ## carla.Rotation<a name="carla.Rotation"></a>
Class that represents a 3D rotation and therefore, an orientation in space. CARLA uses the Unreal Engine coordinates system. This is a Z-up left-handed system. <br> Class that represents a 3D rotation and therefore, an orientation in space. CARLA uses the Unreal Engine coordinates system. This is a Z-up left-handed system. <br>
<br>The constructor method follows a specific order of declaration: `(pitch, yaw, roll)`, which corresponds to `(Y-rotation,Z-rotation,X-rotation)`. <br> <br>![UE4_Rotation](https://d26ilriwvtzlb.cloudfront.net/8/83/BRMC_9.jpg) *Unreal Engine's coordinates system*. <br>The constructor method follows a specific order of declaration: `(pitch, yaw, roll)`, which corresponds to `(Y-rotation,Z-rotation,X-rotation)`. <br> <br>![UE4_Rotation](/img/unreal_lhcs.png) *Unreal Engine's coordinates system*.
### Instance Variables ### Instance Variables
- <a name="carla.Rotation.pitch"></a>**<font color="#f8805a">pitch</font>** (_float<small> - degrees</small>_) - <a name="carla.Rotation.pitch"></a>**<font color="#f8805a">pitch</font>** (_float<small> - degrees</small>_)

View File

@ -736,7 +736,7 @@ The following tags are currently available (Note, tags changed from version 0.9.
| `14` | Car | `(0, 0, 142)` | Cars, vans | | `14` | Car | `(0, 0, 142)` | Cars, vans |
| `15` | Truck | `(0, 0, 70)` | Trucks | | `15` | Truck | `(0, 0, 70)` | Trucks |
| `16` | Bus | `(0, 60, 100)` | Busses | | `16` | Bus | `(0, 60, 100)` | Busses |
| `17` | Train | `(0, 60, 100)` | Trains | | `17` | Train | `(0, 80, 100)` | Trains |
| `18` | Motorcycle | `(0, 0, 230)` | Motorcycle, Motorbike | | `18` | Motorcycle | `(0, 0, 230)` | Motorcycle, Motorbike |
| `19` | Bicycle | `(119, 11, 32)` | Bicylces | | `19` | Bicycle | `(119, 11, 32)` | Bicylces |
| `20` | Static | `(110, 190, 160)` | Elements in the scene and props that are immovable. <br> E.g. fire hydrants, fixed benches, fountains, bus stops, etc. | | `20` | Static | `(110, 190, 160)` | Elements in the scene and props that are immovable. <br> E.g. fire hydrants, fixed benches, fountains, bus stops, etc. |
@ -940,21 +940,19 @@ While the visibility is simulated within CARLA, the scenario can be configured b
* __Output:__ [carla.CAMData](python_api.md#carla.CAMData), triggered according to the ETSI CAM standard, unless configured otherwise * __Output:__ [carla.CAMData](python_api.md#carla.CAMData), triggered according to the ETSI CAM standard, unless configured otherwise
Triggering conditions according to ETSI standard: Triggering conditions according to ETSI standard:
- Heading angle change > $4$° - Heading angle change > 4°
- Position difference > $4$ m - Position difference > 4 m
- Speed change > $5$ m/s - Speed change > 5 m/s
- Time elapsed > CAM Generation time (configurable) - Time elapsed > CAM Generation time (configurable)
- Low Frequency Container Time Elapsed $> 500$ ms - Low Frequency Container Time Elapsed > 500 ms
For the CAM V2X sensor, additional blueprint attributes apply: For the CAM V2X sensor, additional blueprint attributes apply:
| Blueprint attribute | Type | Default | Description | | Blueprint attribute | Type | Default | Description |
|-------------------------|--------|-------------------------|------------------------------------| |-------------------------|--------|-------------------------|------------------------------------|
| <td colspan=4> Message generation | | gen\_cam\_min | float | 0.1 | Minimum elapsed time between two successive CAMs in seconds (s) |
| gen\_cam\_min | float | $0.1$ | Minimum elapsed time between two successive CAMs in seconds (s) | | gen\_cam\_max | float | 1.0 | Maximum elapsed time between two successive CAMs in seconds (s) |
| gen\_cam\_max | float | $1.0$ | Maximum elapsed time between two successive CAMs in seconds (s) |
| fixed\_rate | bool | false [true] | Generate a CAM in every CARLA tick (only for debug purposes, will result in slowdown) | | fixed\_rate | bool | false [true] | Generate a CAM in every CARLA tick (only for debug purposes, will result in slowdown) |
| <td colspan=4> Data generation |
| `noise_vel_stddev_x` | float | 0\.0 | Standard deviation parameter in the noise model for velocity (X axis). | | `noise_vel_stddev_x` | float | 0\.0 | Standard deviation parameter in the noise model for velocity (X axis). |
| `noise_accel_stddev_x` | float | 0\.0 | Standard deviation parameter in the noise model for acceleration (X axis). | | `noise_accel_stddev_x` | float | 0\.0 | Standard deviation parameter in the noise model for acceleration (X axis). |
| `noise_accel_stddev_y` | float | 0\.0 | Standard deviation parameter in the noise model for acceleration (Y axis). | | `noise_accel_stddev_y` | float | 0\.0 | Standard deviation parameter in the noise model for acceleration (Y axis). |
@ -993,14 +991,14 @@ Example:
| Blueprint attribute | Type | Default | Description | | Blueprint attribute | Type | Default | Description |
|-------------------------|--------|-------------------------|------------------------------------| |-------------------------|--------|-------------------------|------------------------------------|
| transmit\_power | float | $21.5$ | Sender transmission power in dBm | | transmit\_power | float | 21.5 | Sender transmission power in dBm |
| receiver\_sensitivity | float | $-99$ | Receiver sensitivity in dBm | | receiver\_sensitivity | float | -99 | Receiver sensitivity in dBm |
| frequency\_ghz | float | $5.9$ | Transmission frequency in GHz. 5.9 GHz is standard for several physical channels. | | frequency\_ghz | float | 5.9 | Transmission frequency in GHz. 5.9 GHz is standard for several physical channels. |
| noise\_seed | int | $0$ | Random parameter for initialization of noise | | noise\_seed | int | 0 | Random parameter for initialization of noise |
| filter\_distance | float | $500$ | Maximum transmission distance in meter, path loss calculations above are skipped for simulation speed | | filter\_distance | float | 500 | Maximum transmission distance in meter, path loss calculations above are skipped for simulation speed |
| <td colspan=4> __Path loss model parameters__ | | __Path loss model parameters__ | | | |
| combined\_antenna\_gain | float | $10.0$ | Combined gain of sender and receiver antennas in dBi, parameter for radiation efficiency and directivity | | combined\_antenna\_gain | float | 10.0 | Combined gain of sender and receiver antennas in dBi, parameter for radiation efficiency and directivity |
| d\_ref | float | $ 1.0 $ | reference distance for Log-distance path loss model in meter | | d\_ref | float | 1.0 | reference distance for Log-distance path loss model in meter |
| path\_loss\_exponent | float | 2.7 | Loss parameter for non-line of sight due to building obstruction | | path\_loss\_exponent | float | 2.7 | Loss parameter for non-line of sight due to building obstruction |
| scenario | string | urban | Options: [urban, rural, highway], defines the fading noise parameters | | scenario | string | urban | Options: [urban, rural, highway], defines the fading noise parameters |
| path\_loss\_model | string | geometric | general path loss model to be used. Options: [geometric, winner] | | path\_loss\_model | string | geometric | general path loss model to be used. Options: [geometric, winner] |

View File

@ -88,6 +88,12 @@ namespace detail {
const auto id = GetCurrentEpisode().GetId(); const auto id = GetCurrentEpisode().GetId();
_client.LoadEpisode(std::move(map_name), reset_settings, map_layers); _client.LoadEpisode(std::move(map_name), reset_settings, map_layers);
// delete the pointer to _episode so that the Navigation information
// will be loaded for the correct map
assert(_episode.use_count() == 1);
_episode.reset();
GetReadyCurrentEpisode();
// We are waiting 50ms for the server to reload the episode. // We are waiting 50ms for the server to reload the episode.
// If in this time we have not detected a change of episode, we try again // If in this time we have not detected a change of episode, we try again
// 'number_of_attempts' times. // 'number_of_attempts' times.

View File

@ -15,7 +15,6 @@
#include <boost/asio/connect.hpp> #include <boost/asio/connect.hpp>
#include <boost/asio/read.hpp> #include <boost/asio/read.hpp>
#include <boost/asio/write.hpp> #include <boost/asio/write.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/bind_executor.hpp> #include <boost/asio/bind_executor.hpp>
#include <exception> #include <exception>
@ -86,7 +85,6 @@ namespace tcp {
void Client::Connect() { void Client::Connect() {
auto self = shared_from_this(); auto self = shared_from_this();
boost::asio::post(_strand, [this, self]() {
if (_done) { if (_done) {
return; return;
} }
@ -139,18 +137,15 @@ namespace tcp {
log_debug("streaming client: connecting to", ep); log_debug("streaming client: connecting to", ep);
_socket.async_connect(ep, boost::asio::bind_executor(_strand, handle_connect)); _socket.async_connect(ep, boost::asio::bind_executor(_strand, handle_connect));
});
} }
void Client::Stop() { void Client::Stop() {
_connection_timer.cancel(); _connection_timer.cancel();
auto self = shared_from_this(); auto self = shared_from_this();
boost::asio::post(_strand, [this, self]() {
_done = true; _done = true;
if (_socket.is_open()) { if (_socket.is_open()) {
_socket.close(); _socket.close();
} }
});
} }
void Client::Reconnect() { void Client::Reconnect() {
@ -165,7 +160,6 @@ namespace tcp {
void Client::ReadData() { void Client::ReadData() {
auto self = shared_from_this(); auto self = shared_from_this();
boost::asio::post(_strand, [this, self]() {
if (_done) { if (_done) {
return; return;
} }
@ -182,7 +176,7 @@ namespace tcp {
// Move the buffer to the callback function and start reading the next // Move the buffer to the callback function and start reading the next
// piece of data. // piece of data.
// log_debug("streaming client: success reading data, calling the callback"); // log_debug("streaming client: success reading data, calling the callback");
boost::asio::post(_strand, [self, message]() { self->_callback(message->pop()); }); self->_callback(message->pop());
ReadData(); ReadData();
} else { } else {
// As usual, if anything fails start over from the very top. // As usual, if anything fails start over from the very top.
@ -219,7 +213,6 @@ namespace tcp {
_socket, _socket,
message->size_as_buffer(), message->size_as_buffer(),
boost::asio::bind_executor(_strand, handle_read_header)); boost::asio::bind_executor(_strand, handle_read_header));
});
} }
} // namespace tcp } // namespace tcp

View File

@ -79,7 +79,6 @@ namespace tcp {
DEBUG_ASSERT(message != nullptr); DEBUG_ASSERT(message != nullptr);
DEBUG_ASSERT(!message->empty()); DEBUG_ASSERT(!message->empty());
auto self = shared_from_this(); auto self = shared_from_this();
boost::asio::post(_strand, [=]() {
if (!_socket.is_open()) { if (!_socket.is_open()) {
return; return;
} }
@ -111,11 +110,8 @@ namespace tcp {
log_debug("session", _session_id, ": sending message of", message->size(), "bytes"); log_debug("session", _session_id, ": sending message of", message->size(), "bytes");
_deadline.expires_from_now(_timeout); _deadline.expires_from_now(_timeout);
boost::asio::async_write( boost::asio::async_write(_socket, message->GetBufferSequence(),
_socket, boost::asio::bind_executor(_strand, handle_sent));
message->GetBufferSequence(),
handle_sent);
});
} }
void ServerSession::Close() { void ServerSession::Close() {

File diff suppressed because it is too large Load Diff

View File

@ -328,7 +328,7 @@
Class that represents a 3D rotation and therefore, an orientation in space. CARLA uses the Unreal Engine coordinates system. This is a Z-up left-handed system. <br> Class that represents a 3D rotation and therefore, an orientation in space. CARLA uses the Unreal Engine coordinates system. This is a Z-up left-handed system. <br>
<br>The constructor method follows a specific order of declaration: `(pitch, yaw, roll)`, which corresponds to `(Y-rotation,Z-rotation,X-rotation)`. <br> <br>The constructor method follows a specific order of declaration: `(pitch, yaw, roll)`, which corresponds to `(Y-rotation,Z-rotation,X-rotation)`. <br>
<br>![UE4_Rotation](https://d26ilriwvtzlb.cloudfront.net/8/83/BRMC_9.jpg) <br>![UE4_Rotation](/img/unreal_lhcs.png)
*Unreal Engine's coordinates system* *Unreal Engine's coordinates system*
# - PROPERTIES ------------------------- # - PROPERTIES -------------------------
instance_variables: instance_variables:

View File

@ -23,6 +23,7 @@
#include "Rendering/SkeletalMeshRenderData.h" #include "Rendering/SkeletalMeshRenderData.h"
#include "Engine/SkeletalMeshSocket.h" #include "Engine/SkeletalMeshSocket.h"
#include "Kismet/KismetMathLibrary.h"
namespace crp = carla::rpc; namespace crp = carla::rpc;
@ -30,10 +31,11 @@ static FBoundingBox ApplyTransformToBB(
FBoundingBox InBB, FBoundingBox InBB,
const FTransform& Transform) const FTransform& Transform)
{ {
auto Scale = Transform.GetScale3D(); const auto Scale = Transform.GetScale3D();
const auto TransformRotation = Transform.GetRotation().Rotator();
InBB.Origin *= Scale; InBB.Origin *= Scale;
InBB.Rotation = Transform.GetRotation().Rotator(); InBB.Rotation = UKismetMathLibrary::ComposeRotators(TransformRotation, InBB.Rotation);
InBB.Origin = InBB.Rotation.RotateVector(InBB.Origin) + Transform.GetLocation(); InBB.Origin = TransformRotation.RotateVector(InBB.Origin) + Transform.GetLocation();
InBB.Extent *= Scale; InBB.Extent *= Scale;
return InBB; return InBB;
} }
@ -183,6 +185,14 @@ FBoundingBox UBoundingBoxCalculator::GetVehicleBoundingBox(
} }
} }
// Calculate bounding boxes of the doors.
FBoundingBox DoorsBB = GetVehicleDoorsBoundingBox(Vehicle);
if(DoorsBB.Extent != FVector::ZeroVector)
{
// Combine doors Bounding Box with the vehicle BB.
BB = CombineBBs({DoorsBB, BB});
}
// Component-to-world transform for this component // Component-to-world transform for this component
auto& CompToWorldTransform = ParentComp->GetComponentTransform(); auto& CompToWorldTransform = ParentComp->GetComponentTransform();
BB = ApplyTransformToBB(BB, CompToWorldTransform); BB = ApplyTransformToBB(BB, CompToWorldTransform);
@ -445,7 +455,7 @@ TArray<FBoundingBox> UBoundingBoxCalculator::GetBBsOfActor(
{ {
Result.Add(BoundingBox); Result.Add(BoundingBox);
} }
return Result;; return Result;
} }
// Pedestrians, we just use the capsule component at the moment. // Pedestrians, we just use the capsule component at the moment.
@ -645,3 +655,34 @@ void UBoundingBoxCalculator::GetMeshCompsFromActorBoundingBox(
} }
} }
} }
FBoundingBox UBoundingBoxCalculator::GetVehicleDoorsBoundingBox(const ACarlaWheeledVehicle* Vehicle)
{
FBoundingBox DoorsBB;
if(Vehicle && Vehicle->GetConstraintsComponents().Num() > 0)
{
FBox DoorsBox(ForceInit);
const FTransform& ActorToWorld = Vehicle->GetActorTransform();
const FTransform WorldToActor = ActorToWorld.Inverse();
// Iterates over all doors of the vehicle
for(const UPhysicsConstraintComponent* ConstraintComp : Vehicle->GetConstraintsComponents())
{
const UPrimitiveComponent* DoorComponent = Vehicle->GetConstraintDoor()[ConstraintComp];
if(const UStaticMeshComponent* StaticMeshComp = Cast<UStaticMeshComponent>(DoorComponent))
{
const FTransform ComponentToActor = StaticMeshComp->GetComponentTransform() * WorldToActor;
DoorsBox += StaticMeshComp->CalcBounds(ComponentToActor).GetBox();
}
}
if(DoorsBox.IsValid)
{
// DoorBB is aligned with the Vehicle orientation, for this reason it is not necessary to assign rotation.
DoorsBB.Origin = DoorsBox.GetCenter();
DoorsBB.Extent = DoorsBox.GetExtent();
}
}
return DoorsBB;
}

View File

@ -110,4 +110,7 @@ public:
const FBoundingBox& InBB, const FBoundingBox& InBB,
TArray<UStaticMeshComponent*>& OutStaticMeshComps); TArray<UStaticMeshComponent*>& OutStaticMeshComps);
// Return the combined BB of all doors of the vehicle, with the same orientation.
UFUNCTION(Category = "Carla Actor", BlueprintCallable)
static FBoundingBox GetVehicleDoorsBoundingBox(const ACarlaWheeledVehicle* Vehicle);
}; };

View File

@ -1085,6 +1085,15 @@ void ACarlaWheeledVehicle::OpenDoorPhys(const EVehicleDoor DoorIdx)
} }
RecordDoorChange(DoorIdx, true); RecordDoorChange(DoorIdx, true);
// Wait until door is max opened to recalculate its bounds.
float TimeNeededToHaveItOpened = (AngleLimit + Constraint->ConstraintInstance.AngularRotationOffset.Yaw) / (DoorOpenStrength > 0.f ? DoorOpenStrength : 1.f);
TimeNeededToHaveItOpened = TimeNeededToHaveItOpened < 0.f ? TimeNeededToHaveItOpened * -1.f : TimeNeededToHaveItOpened;
FTimerHandle DoorMaxOpenRangeTimerHandle;
GetWorldTimerManager().SetTimer(DoorMaxOpenRangeTimerHandle, [this]()
{
AdjustVehicleBounds();
}, TimeNeededToHaveItOpened, false);
} }
void ACarlaWheeledVehicle::CloseDoorPhys(const EVehicleDoor DoorIdx) void ACarlaWheeledVehicle::CloseDoorPhys(const EVehicleDoor DoorIdx)
@ -1099,6 +1108,8 @@ void ACarlaWheeledVehicle::CloseDoorPhys(const EVehicleDoor DoorIdx)
DoorComponent->AttachToComponent( DoorComponent->AttachToComponent(
GetMesh(), FAttachmentTransformRules(EAttachmentRule::KeepWorld, true)); GetMesh(), FAttachmentTransformRules(EAttachmentRule::KeepWorld, true));
RecordDoorChange(DoorIdx, false); RecordDoorChange(DoorIdx, false);
AdjustVehicleBounds();
} }
void ACarlaWheeledVehicle::RecordDoorChange(const EVehicleDoor DoorIdx, bool bIsOpen) void ACarlaWheeledVehicle::RecordDoorChange(const EVehicleDoor DoorIdx, bool bIsOpen)

View File

@ -432,6 +432,10 @@ public:
UFUNCTION(Category = "CARLA Wheeled Vehicle", BlueprintCallable) UFUNCTION(Category = "CARLA Wheeled Vehicle", BlueprintCallable)
static void SetPhysicsConstraintAngle( static void SetPhysicsConstraintAngle(
UPhysicsConstraintComponent*Component, const FRotator &NewAngle); UPhysicsConstraintComponent*Component, const FRotator &NewAngle);
const TArray<UPhysicsConstraintComponent*>& GetConstraintsComponents() const { return ConstraintsComponents; }
const TMap<UPhysicsConstraintComponent*, UPrimitiveComponent*>& GetConstraintDoor() const {return ConstraintDoor; }
private: private:

View File

@ -138,7 +138,7 @@ LibCarla.client.rss.release: setup ad-rss
plugins: plugins:
@${CARLA_BUILD_TOOLS_FOLDER}/Plugins.sh $(ARGS) @${CARLA_BUILD_TOOLS_FOLDER}/Plugins.sh $(ARGS)
setup downloadplugins: setup: downloadplugins
@${CARLA_BUILD_TOOLS_FOLDER}/Setup.sh $(ARGS) @${CARLA_BUILD_TOOLS_FOLDER}/Setup.sh $(ARGS)
ad-rss: ad-rss: