Skip to content

Commit 71af0db

Browse files
committed
feat(bvp): support new rtc cooperate status
Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
1 parent 34444b5 commit 71af0db

File tree

8 files changed

+23
-14
lines changed

8 files changed

+23
-14
lines changed

planning/behavior_velocity_blind_spot_module/src/manager.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ void BlindSpotModuleManager::launchNewModules(
7373
clock_));
7474
generateUUID(module_id);
7575
updateRTCStatus(
76-
getUUID(module_id), true, std::numeric_limits<double>::lowest(), path.header.stamp);
76+
getUUID(module_id), true, State::WAITING_FOR_EXECUTION, std::numeric_limits<double>::lowest(),
77+
path.header.stamp);
7778
}
7879
}
7980

planning/behavior_velocity_crosswalk_module/src/manager.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ void CrosswalkModuleManager::launchNewModules(const PathWithLaneId & path)
190190
clock_));
191191
generateUUID(crosswalk_lanelet_id);
192192
updateRTCStatus(
193-
getUUID(crosswalk_lanelet_id), true, std::numeric_limits<double>::lowest(),
194-
path.header.stamp);
193+
getUUID(crosswalk_lanelet_id), true, State::WAITING_FOR_EXECUTION,
194+
std::numeric_limits<double>::lowest(), path.header.stamp);
195195
};
196196

197197
const auto crosswalk_reg_elem_map = planning_utils::getRegElemMapOnPath<Crosswalk>(

planning/behavior_velocity_detection_area_module/src/manager.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ void DetectionAreaModuleManager::launchNewModules(
6666
logger_.get_child("detection_area_module"), clock_));
6767
generateUUID(module_id);
6868
updateRTCStatus(
69-
getUUID(module_id), true, std::numeric_limits<double>::lowest(), path.header.stamp);
69+
getUUID(module_id), true, State::WAITING_FOR_EXECUTION,
70+
std::numeric_limits<double>::lowest(), path.header.stamp);
7071
}
7172
}
7273
}

planning/behavior_velocity_intersection_module/src/manager.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,10 @@ void IntersectionModuleManager::launchNewModules(
345345
const UUID uuid = getUUID(new_module->getModuleId());
346346
const auto occlusion_uuid = new_module->getOcclusionUUID();
347347
rtc_interface_.updateCooperateStatus(
348-
uuid, true, std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest(),
349-
clock_->now());
348+
uuid, true, State::RUNNING, std::numeric_limits<double>::lowest(),
349+
std::numeric_limits<double>::lowest(), clock_->now());
350350
occlusion_rtc_interface_.updateCooperateStatus(
351-
occlusion_uuid, true, std::numeric_limits<double>::lowest(),
351+
occlusion_uuid, true, State::RUNNING, std::numeric_limits<double>::lowest(),
352352
std::numeric_limits<double>::lowest(), clock_->now());
353353
registerModule(std::move(new_module));
354354
}
@@ -404,12 +404,13 @@ void IntersectionModuleManager::sendRTC(const Time & stamp)
404404
const UUID uuid = getUUID(scene_module->getModuleId());
405405
const bool safety =
406406
scene_module->isSafe() && (!intersection_module->isOcclusionFirstStopRequired());
407-
updateRTCStatus(uuid, safety, scene_module->getDistance(), stamp);
407+
updateRTCStatus(uuid, safety, State::RUNNING, scene_module->getDistance(), stamp);
408408
const auto occlusion_uuid = intersection_module->getOcclusionUUID();
409409
const auto occlusion_distance = intersection_module->getOcclusionDistance();
410410
const auto occlusion_safety = intersection_module->getOcclusionSafety();
411411
occlusion_rtc_interface_.updateCooperateStatus(
412-
occlusion_uuid, occlusion_safety, occlusion_distance, occlusion_distance, stamp);
412+
occlusion_uuid, occlusion_safety, State::RUNNING, occlusion_distance, occlusion_distance,
413+
stamp);
413414

414415
// ==========================================================================================
415416
// module debug data

planning/behavior_velocity_no_stopping_area_module/src/manager.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ void NoStoppingAreaModuleManager::launchNewModules(
6868
clock_));
6969
generateUUID(module_id);
7070
updateRTCStatus(
71-
getUUID(module_id), true, std::numeric_limits<double>::lowest(), path.header.stamp);
71+
getUUID(module_id), true, State::WAITING_FOR_EXECUTION,
72+
std::numeric_limits<double>::lowest(), path.header.stamp);
7273
}
7374
}
7475
}

planning/behavior_velocity_planner_common/include/behavior_velocity_planner_common/scene_module_interface.hpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <tier4_debug_msgs/msg/float64_stamped.hpp>
3232
#include <tier4_planning_msgs/msg/stop_reason.hpp>
3333
#include <tier4_planning_msgs/msg/stop_reason_array.hpp>
34+
#include <tier4_rtc_msgs/msg/state.hpp>
3435
#include <tier4_v2x_msgs/msg/infrastructure_command_array.hpp>
3536
#include <unique_identifier_msgs/msg/uuid.hpp>
3637

@@ -58,6 +59,7 @@ using tier4_debug_msgs::msg::Float64Stamped;
5859
using tier4_planning_msgs::msg::StopFactor;
5960
using tier4_planning_msgs::msg::StopReason;
6061
using tier4_rtc_msgs::msg::Module;
62+
using tier4_rtc_msgs::msg::State;
6163
using unique_identifier_msgs::msg::UUID;
6264

6365
struct ObjectOfInterest
@@ -235,9 +237,10 @@ class SceneModuleManagerInterfaceWithRTC : public SceneModuleManagerInterface
235237
virtual void setActivation();
236238

237239
void updateRTCStatus(
238-
const UUID & uuid, const bool safe, const double distance, const Time & stamp)
240+
const UUID & uuid, const bool safe, const uint8_t state, const double distance,
241+
const Time & stamp)
239242
{
240-
rtc_interface_.updateCooperateStatus(uuid, safe, distance, distance, stamp);
243+
rtc_interface_.updateCooperateStatus(uuid, safe, state, distance, distance, stamp);
241244
}
242245

243246
void removeRTCStatus(const UUID & uuid) { rtc_interface_.removeCooperateStatus(uuid); }

planning/behavior_velocity_planner_common/src/scene_module_interface.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ void SceneModuleManagerInterfaceWithRTC::sendRTC(const Time & stamp)
211211
{
212212
for (const auto & scene_module : scene_modules_) {
213213
const UUID uuid = getUUID(scene_module->getModuleId());
214-
updateRTCStatus(uuid, scene_module->isSafe(), scene_module->getDistance(), stamp);
214+
const auto state = scene_module->isActivated() ? State::RUNNING : State::WAITING_FOR_EXECUTION;
215+
updateRTCStatus(uuid, scene_module->isSafe(), state, scene_module->getDistance(), stamp);
215216
}
216217
publishRTCStatus(stamp);
217218
}

planning/behavior_velocity_traffic_light_module/src/manager.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ void TrafficLightModuleManager::launchNewModules(
133133
planner_param_, logger_.get_child("traffic_light_module"), clock_));
134134
generateUUID(module_id);
135135
updateRTCStatus(
136-
getUUID(module_id), true, std::numeric_limits<double>::lowest(), path.header.stamp);
136+
getUUID(module_id), true, State::WAITING_FOR_EXECUTION,
137+
std::numeric_limits<double>::lowest(), path.header.stamp);
137138
}
138139
}
139140
}

0 commit comments

Comments
 (0)