-
Notifications
You must be signed in to change notification settings - Fork 5
Add Fleet Manager build integration #683
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
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replaced |
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added explicit |
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a direct |
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added missing return statements, corrected debug |
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Made |
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a null/failed-service guard before reading the object-control-state response. |
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Increased the waits for trajectory, IP, and origin service responses, and extended the overall scenario-loading timeout. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # This Source Code Form is subject to the terms of the Mozilla Public | ||
| # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| # file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
|
||
| cmake_minimum_required(VERSION 3.8) | ||
| set(CMAKE_CXX_STANDARD 17) | ||
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
| set(CMAKE_C_STANDARD 11) | ||
| set(CMAKE_C_STANDARD_REQUIRED ON) | ||
|
|
||
| project(truck_object_control) | ||
|
|
||
| find_package(rclcpp REQUIRED) | ||
| find_package(std_msgs REQUIRED) | ||
| find_package(ament_index_cpp REQUIRED) | ||
| find_package(OpenSSL REQUIRED) | ||
|
|
||
| include(GNUInstallDirs) | ||
|
|
||
| set(COREUTILS_LIBRARY ATOSCoreUtil) | ||
|
|
||
| add_executable(${PROJECT_NAME} | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/truckobjectcontrol.cpp | ||
| ) | ||
|
|
||
| target_include_directories(${PROJECT_NAME} PUBLIC | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/inc | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/../../common | ||
| ) | ||
| target_link_libraries(${PROJECT_NAME} | ||
| ${COREUTILS_LIBRARY} | ||
| OpenSSL::SSL | ||
| OpenSSL::Crypto | ||
| ) | ||
|
|
||
| ament_target_dependencies(${PROJECT_NAME} | ||
| rclcpp | ||
| std_msgs | ||
| ament_index_cpp | ||
| ) | ||
|
|
||
| add_executable(atos_truck_simulator | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/main_simulator.cpp | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/atostrucksimulator.cpp | ||
| ) | ||
| target_include_directories(atos_truck_simulator PUBLIC | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/inc | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/../../common | ||
| ) | ||
| target_link_libraries(atos_truck_simulator | ||
| ${COREUTILS_LIBRARY} | ||
| ) | ||
| ament_target_dependencies(atos_truck_simulator | ||
| rclcpp | ||
| std_msgs | ||
| ament_index_cpp | ||
| ) | ||
|
|
||
| install(CODE "MESSAGE(STATUS \"Installing target ${PROJECT_NAME}\")") | ||
| install(TARGETS ${PROJECT_NAME} | ||
| RUNTIME DESTINATION "${CMAKE_INSTALL_LIBDIR}/atos" | ||
| LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
| ) | ||
| install(CODE "MESSAGE(STATUS \"Installing target atos_truck_simulator\")") | ||
| install(TARGETS atos_truck_simulator | ||
| RUNTIME DESTINATION "${CMAKE_INSTALL_LIBDIR}/atos" | ||
| LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
| */ | ||
| #pragma once | ||
|
|
||
| #include <rclcpp/rclcpp.hpp> | ||
| #include <std_msgs/msg/string.hpp> | ||
|
|
||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| class AtosTruckSimulator : public rclcpp::Node { | ||
| public: | ||
| AtosTruckSimulator(); | ||
|
|
||
| private: | ||
| struct GeoPoint { | ||
| double lat = 0.0; | ||
| double lon = 0.0; | ||
| double distance_m = 0.0; | ||
| }; | ||
|
|
||
| std::string uid_ = "L5S-TRUCK-SIM"; | ||
| std::string tcp_host_ = "127.0.0.1"; | ||
| int tcp_port_ = 8114; | ||
| std::string trajectory_geojson_path_ = ""; | ||
| std::string trajectory_path_name_ = ""; | ||
| int start_index_ = 0; | ||
| double initial_speed_kmh_ = 0.0; | ||
| double target_speed_kmh_ = 40.0; | ||
| double acceleration_mps2_ = 2.0; | ||
| double publish_hz_ = 5.0; | ||
| bool loop_path_ = true; | ||
| bool ignore_warning_speed_commands_ = false; | ||
|
|
||
| double current_distance_m_ = 0.0; | ||
| double current_speed_mps_ = 0.0; | ||
|
|
||
| int tcp_fd_ = -1; | ||
| std::string tcp_rx_buffer_; | ||
| std::vector<GeoPoint> trajectory_path_; | ||
|
|
||
| rclcpp::TimerBase::SharedPtr simulation_timer_; | ||
| rclcpp::Subscription<std_msgs::msg::String>::SharedPtr speed_command_sub_; | ||
|
|
||
| rclcpp::Time last_step_time_; | ||
|
|
||
| bool loadTrajectoryPath(); | ||
| bool ensureTcpConnected(); | ||
| void closeTcp(); | ||
| void pollTcpCommands(); | ||
| void simulationStep(); | ||
| bool pointAtDistance(double distance_m, double& lat, double& lon, double& course_deg, int& path_index) const; | ||
| static std::string utcIso8601FromRosTime(const rclcpp::Time& time); | ||
| void applySpeedCommandPayload(const std::string& payload); | ||
| void onSpeedCommand(const std_msgs::msg::String::SharedPtr msg); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a
WITH_TRUCK_OBJECT_CONTROLCMake option and appended the module toENABLED_MODULESwhen the flag is enabled.This was needed so the new TruckObjectControl module can be built selectively without changing the default build path for existing environments.