-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RJD-1057 (4/5): Remove non-API member functions: EntityManager’s member functions forwarded to EntityBase (2/2) #1334
base: master
Are you sure you want to change the base?
Conversation
…cessary from EntityManager
…o RJD-1057-remove-functions-forwarded-to-entity-base Signed-off-by: Mateusz Palczuk <[email protected]>
…ed-to-entity-base' into RJD-1057-remove-functions-forwarded-to-entity-base Signed-off-by: Mateusz Palczuk <[email protected]>
…o RJD-1057-remove-functions-forwarded-to-entity-base Signed-off-by: Mateusz Palczuk <[email protected]>
Signed-off-by: Mateusz Palczuk <[email protected]>
Signed-off-by: Mateusz Palczuk <[email protected]>
…le' into RJD-1057-remove-functions-forwarded-to-entity-base-with-middle Signed-off-by: Mateusz Palczuk <[email protected]>
…le' into RJD-1057-remove-functions-forwarded-to-entity-base-with-middle Signed-off-by: Mateusz Palczuk <[email protected]>
c9057f9
to
ff759fe
Compare
…le' into RJD-1057-remove-functions-forwarded-to-entity-base-refactor Signed-off-by: Mateusz Palczuk <[email protected]>
…ded-to-entity-base-middle' into RJD-1057-remove-functions-forwarded-to-entity-base-refactor
…le' into RJD-1057-remove-functions-forwarded-to-entity-base-refactor
…le' into RJD-1057-remove-functions-forwarded-to-entity-base-refactor
…le' into RJD-1057-remove-functions-forwarded-to-entity-base-refactor
…le' into RJD-1057-remove-functions-forwarded-to-entity-base-refactor
This pull-request was closed automatically, because the target branch was deleted due to merging its pull-request. |
…ity-base-refactor
@TauTheLepton Could you fix typos pointed out by spell-check CI? |
Signed-off-by: Mateusz Palczuk <[email protected]>
Done Please note, that there is an error in "Documentation" check in CI. I believe it is not caused by my changes. |
…ity-base-refactor
…ity-base-refactor
…ity-base-refactor
…ity-base-refactor
…tions-forwarded-to-entity-base-refactor Signed-off-by: Mateusz Palczuk <[email protected]>
…return type is reference Signed-off-by: Mateusz Palczuk <[email protected]>
Signed-off-by: Mateusz Palczuk <[email protected]>
…ity-base-refactor
Signed-off-by: Mateusz Palczuk <[email protected]>
Signed-off-by: Mateusz Palczuk <[email protected]>
…ed-to-entity-base-refactor' into RJD-1057-remove-functions-forwarded-to-entity-base-refactor Signed-off-by: Mateusz Palczuk <[email protected]>
…ity-base-refactor
Signed-off-by: Mateusz Palczuk <[email protected]>
…ity-base-refactor
…ity-base-refactor
|
Description
Abstract
This pull request mainly consists of refactoring and introduces changes in the
API
andEntityManager
.Background
This pull request is an extension of the #1473.
Due to the fact that these pull requests combined would have been too large for a review, they have been split into two.
As a result of the previous PR, changes have been made to the
API
andEntityManager
classes.These changes created a great opportunity to declutter / tidy up the code of these classes.
This pull request consists of the code cleanup and refactoring. Many of the changes introduced are just changes to the order of functions inside the implementation file to keep them grouped by functionality and consistent with the header file.
Tip
When reviewing the changes, it may be easier to see the actual modifications by opening both versions of each file side by side rather than looking at the diff generated by GitHub.
This is due to the fact that GitHub shows lots of changes where mostly copying and pasting the code has been done (for reordering purposes).
Some other minor changes have been introduced as well, like the addition of the
ostream_helpers.cpp
.What is more, the functions
EntityManager::spawnEntity
and (most importantly)API::spawn
have been modified to return theEntityBase
reference:Before:
scenario_simulator_v2/simulation/traffic_simulator/include/traffic_simulator/api/api.hpp
Lines 135 to 140 in 3592d90
After:
scenario_simulator_v2/simulation/traffic_simulator/include/traffic_simulator/api/api.hpp
Lines 109 to 117 in ce817e2
Cpp mock scenarios
The change mentioned above has been applied in the whole codebase, which includes most of the cpp mock scenarios.
Cpp mock scenarios have been all changed like the following:
Before:
scenario_simulator_v2/mock/cpp_mock_scenarios/src/follow_front_entity/accelerate_and_follow.cpp
Lines 65 to 70 in 3592d90
After:
scenario_simulator_v2/mock/cpp_mock_scenarios/src/follow_front_entity/accelerate_and_follow.cpp
Lines 65 to 69 in b3f7235
Details
Below are all changes made in this PR
API
Renamed member
configuration
toconfiguration_
Most of the constructor logic has been moved to
API::init()
member functionscenario_simulator_v2/simulation/traffic_simulator/src/api/api.cpp
Lines 21 to 35 in b3f7235
Added member function
setSiulationStepTime
scenario_simulator_v2/simulation/traffic_simulator/src/api/api.cpp
Lines 39 to 53 in b3f7235
Removed member function
getZMQSocketPort
in favor of usinggetROS2Parameter
3
spawn
functionsscenario_simulator_v2/simulation/traffic_simulator/include/traffic_simulator/api/api.hpp
Lines 135 to 140 in eb845c9
scenario_simulator_v2/simulation/traffic_simulator/include/traffic_simulator/api/api.hpp
Lines 176 to 181 in eb845c9
scenario_simulator_v2/simulation/traffic_simulator/include/traffic_simulator/api/api.hpp
Lines 208 to 212 in eb845c9
have been combined into 1
spawn
function (additional template parameterParamsType
was introduced for this reason)scenario_simulator_v2/simulation/traffic_simulator/include/traffic_simulator/api/api.hpp
Lines 109 to 117 in ce817e2
The remaining member functions that were defined using the
FORWARD_TO_ENTITY_MANAGER
macro have been converted to standard member functions:getEgoEntity
getEntityNames
getEntityPointer
getFirstEgoName
getHdmapUtils
isEntityExist
isNpcLogicStarted
resetBehaviorPlugin
Important
All other changes are minor refactoring or just reordering functions in the file, which GitHub shows as big changes.
EntityManager
configuration
toconfiguration_
getOrigin
to free functionscenario_simulator_v2/simulation/traffic_simulator/include/traffic_simulator/utils/node_parameters.hpp
Lines 42 to 43 in f029407
getObstacle
getWaypoints
getGoalPoses
getPedestrianParameters
getVehicleParameters
spawnEntity
function now returns a reference to the created entityscenario_simulator_v2/simulation/traffic_simulator/include/traffic_simulator/entity/entity_manager.hpp
Lines 106 to 109 in 66575dd
createPublisher
createSubscription
Important
All other changes are minor refactoring or just reordering functions in the file, which GitHub shows as big changes.
EntityBase
as
scenario_simulator_v2/simulation/traffic_simulator/include/traffic_simulator/entity/entity_base.hpp
Lines 73 to 74 in 66575dd
scenario_simulator_v2/simulation/traffic_simulator/include/traffic_simulator/entity/entity_base.hpp
Lines 84 to 85 in 66575dd
getGoalPoses
return typeauto getGoalPoses() -> std::vector<CanonicalizedLaneletPose>
→
auto getGoalPoses() -> std::vector<geometry_msgs::msg::Pose>
MiscObjectEntity
getGoalPoses
return typeauto getGoalPoses() -> std::vector<CanonicalizedLaneletPose>
→
auto getGoalPoses() -> std::vector<geometry_msgs::msg::Pose>
PedestrianEntity
getGoalPoses
return typeauto getGoalPoses() -> std::vector<CanonicalizedLaneletPose>
→
auto getGoalPoses() -> std::vector<geometry_msgs::msg::Pose>
auto getParameters() const -> const traffic_simulator_msgs::msg::PedestrianParameters &;
VehicleEntity
getGoalPoses
return typeauto getGoalPoses() -> std::vector<CanonicalizedLaneletPose>
→
auto getGoalPoses() -> std::vector<geometry_msgs::msg::Pose>
auto getParameters() const -> const traffic_simulator_msgs::msg::VehicleParameters &;
Ostream helpers
All existing operators
std::ostream & operator<<
have been moved from filehelper.[ch]pp
to a dedicated fileostream_helper.[ch]pp
.In addition many more operators have been added for the types
traffic_simulator_msgs::msg::LaneletPose
traffic_simulator_msgs::msg::EntitySubtype
traffic_simulator_msgs::msg::Axle
traffic_simulator_msgs::msg::Axles
traffic_simulator_msgs::msg::BoundingBox
traffic_simulator_msgs::msg::Performance
traffic_simulator_msgs::msg::VehicleParameters
References
INTERNAL LINK 1
INTERNAL LINK 2
Destructive Changes
--
Known Limitations
--