Skip to content

Comments

LibCarla prepration for extended ROS2 support#1

Open
berndgassmann wants to merge 4 commits intoberndgassmann/rework_ros2_step_1_harmonize_buildfrom
berndgassmann/rework_ros2_step_2_prepare_libcarla
Open

LibCarla prepration for extended ROS2 support#1
berndgassmann wants to merge 4 commits intoberndgassmann/rework_ros2_step_1_harmonize_buildfrom
berndgassmann/rework_ros2_step_2_prepare_libcarla

Conversation

@berndgassmann
Copy link
Owner

@berndgassmann berndgassmann commented Jul 8, 2024

Description

Actor:
Moved Blueprint handling sources to carla/actor from carla/client to
be able to make use of that functionalilty within server when ROS2
is activated.

DataTypes:
Introduced geom::AngularVelocity, geom::Velocity,geom::Acceleration,
geom::Quaternion to make the Unreal -> Carla -> ROS2 data conversion
straigth forward
Added some Math functions for Quaternions
Renamed MakeSafeUnitVector->MakeUnitVector (there is no 'unsafe'
variant allowed anymore)

Streaming:
Moved streaming/detail/tcp/Message.h -> streaming/detail/Message.h
to be deployed for non-tcp communication streams like ROS2.
Moved general (tcp-independent parts) from tcp/ServerSession to
streaming/detail/Session.h to be used for ROS2 streams. Had to
rename a Write() function to WriteMessage because of virtual
function overloaded with template function not possible.
Make Dispatcher a shared_pointer to be able to access from ROS2.

Serializer:
Provide GetHeaderOffset() functions where missing.
Add sensor_relative_transform (Location and Quaternion parts) to
SensorHeader to support relative TF. Keep it in the header also
when not compiled with ROS2 to keep ROS enabled server builds
compatible with non-ROS enabled client builds as it's not that
much of an overhead.
Allow to replace move semantic from Deserialize on ROS2-server builds
to allow multiple sinks (i.e. TCP-Server and ROS2 to deserialize the
data without destoying it).
Added VehicleAckermannControl to ActorDynamicState in form of a
union with VehicleControl to save space
Extract sensor/data/Array.h into a ArrayConst.h base class to be
used for const data acess on ROS2 Deserialization of
RawEpisodeState.

UE4:
Updated according to LibCarla changes.
BoundingBoxCalulator: added GetSkeletalMeshVerticies to allow upcoming
ROS2 access to detailed mesh as exact ground truth
Vehicle/Walker Control were extended by timestamp of the last control
input to have a notion on how old the last queried control value was
V2XSensor: Allow selection of virtual communication channels via
sensors 'role_name' attribute.

BUGFIX:
Fixed geom::Rotation::RotateVector() rotation directions of
pitch and roll!
Added RightHandedVector3D.h (internal class deployed
for correct rotation of CARLA left handed vectors)
Allow to comment TransformationMatrix access out by ifdef to prevent
from erroneous misuse (default access is still enabled!)

Minor:
Handled some compiler warnings

Fixes #
Fixes geom::Rotation::RotateVector() rotation directions of pitch and roll!

Where has this been tested?

  • Platform(s): ... Ubuntu 22.04, 20.04

  • Python version(s): ... 3.10

  • Unreal Engine version(s): ...4.26

  • tested build of:

    • make launch ARGS="--ros2"
    • make check
    • make PythonAPI
    • make package ARGS="--ros2"
  • launched carla from installed package and verified basic ros2 is working:

    • Added ROS2=True to DefaultGame.ini
    • Started carla-server and ensured /clock is published
    • Started manual_control.py and ensured that some sensor data is sent out

Possible Drawbacks

Since there is no unsafe MakeUnitVector anymore, possible undetected issues in some code using the unsafe variant of MakeUnitVector() might pop up

Actor:
  Moved Blueprint handling sources to carla/actor from carla/client to
   be able to make use of that functionalilty within server when ROS2
   is activated.

DataTypes:
 Introduced geom::AngularVelocity, geom::Velocity,geom::Acceleration,
  geom::Quaternion to make the Unreal -> Carla -> ROS2 data conversion
  straigth forward
 Added some Math functions for Quaternions
 Renamed MakeSafeUnitVector->MakeUnitVector (there is no 'unsafe'
  variant allowed anymore)

Streaming:
  Moved streaming/detail/tcp/Message.h -> streaming/detail/Message.h
   to be deployed for non-tcp communication streams like ROS2.
  Moved general (tcp-independent parts) from tcp/ServerSession to
   streaming/detail/Session.h to be used for ROS2 streams. Had to
   rename a Write() function to WriteMessage because of virtual
   function overloaded with template function not possible.
  Make Dispatcher a shared_pointer to be able to access from ROS2.

Serializer:
  Provide GetHeaderOffset() functions where missing.
  Add sensor_relative_transform (Location and Quaternion parts) to
   SensorHeader to support relative TF. Keep it in the header also
   when not compiled with ROS2 to keep ROS enabled server builds
   compatible with non-ROS enabled client builds as it's not that
   much of an overhead.
  Allow to replace move semantic from Deserialize on ROS2-server builds
   to allow multiple sinks (i.e. TCP-Server and ROS2 to deserialize the
   data without destoying it).
  Added VehicleAckermannControl to ActorDynamicState in form of a
   union with VehicleControl to save space
  Extract sensor/data/Array.h into a ArrayConst.h base class to be
   used for const data acess on ROS2 Deserialization of
   RawEpisodeState.

UE4:
  Updated according to LibCarla changes.
  BoundingBoxCalulator: added GetSkeletalMeshVerticies to allow upcoming
   ROS2 access to detailed mesh as exact ground truth
  Vehicle/Walker Control were extended by timestamp of the last control
   input to have a notion on how old the last queried control value was
  V2XSensor: Allow selection of virtual communication channels via
   sensors 'role_name' attribute.

BUGFIX:
   Fixed geom::Rotation::RotateVector() rotation directions of
    pitch and roll!
   Added RightHandedVector3D.h (internal class deployed
    for correct rotation of CARLA left handed vectors)
   Allow to comment TransformationMatrix access out by ifdef to prevent
    from erroneous misuse (default access is still enabled!)

Minor:
  Handled some compiler warnings
@berndgassmann berndgassmann force-pushed the berndgassmann/rework_ros2_step_2_prepare_libcarla branch from 651d4fb to 26e153d Compare July 8, 2024 16:13
Bernd Gassmann added 3 commits August 29, 2024 12:53
- A side effect of the previous Math rotation fixes was autopilot
steering angle calculation. Replaced by generic Math computations with
clear explanation how the angle is calculated
- added Math::GetVectorAngle(), Math::GetVectorAngleAbs() and supporting
functions
- use angle functions within MotionPlanStage to get correct angle delta
…berndgassmann/rework_ros2_step_2_prepare_libcarla
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant