Skip to content

Commit

Permalink
draft
Browse files Browse the repository at this point in the history
  • Loading branch information
brkay54 committed Jan 30, 2024
1 parent b5a6160 commit b751212
Show file tree
Hide file tree
Showing 3 changed files with 414 additions and 247 deletions.
28 changes: 28 additions & 0 deletions tools/reaction_analyzer/include/reaction_analyzer_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,36 @@ struct PublisherVariables
rclcpp::TimerBase::SharedPtr timer;
};

template <typename T>
struct PublisherVariablesMessageTypeExtractor;

template <typename MessageType>
struct PublisherVariablesMessageTypeExtractor<PublisherVariables<MessageType>> {
using Type = MessageType;
};

template<typename T, typename = std::void_t<>>
struct has_header : std::false_type {};

template<typename T>
struct has_header<T, std::void_t<decltype(T::header)>> : std::true_type {};


struct PublisherVarAccessor {

// Method to set header time if available
template <typename T>
void setHeaderTimeIfAvailable(T& publisherVar, const rclcpp::Time& time) {
if constexpr (has_header<typename T::MessageType>::value) {
if (publisherVar.empty_area_message) {
publisherVar.empty_area_message->header.stamp = time;
}
if (publisherVar.object_spawned_message) {
publisherVar.object_spawned_message->header.stamp = time;
}
}
}

// Set Period
template <typename T>
void setPeriod(T& publisherVar, double newPeriod) {
Expand Down
2 changes: 1 addition & 1 deletion tools/reaction_analyzer/param/reaction_analyzer.param.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**:
ros__parameters:
use_sim_time: true
use_sim_time: false
#running_mode: "perception_planning" # or planning_control
run_from_bag: true
path_bag_without_object: /home/berkay/projects/bags/awsim-bag/bag-without-car-full/rosbag2_2024_01_17-16_23_07_0.db3

Check warning on line 6 in tools/reaction_analyzer/param/reaction_analyzer.param.yaml

View workflow job for this annotation

GitHub Actions / spell-check-partial

Unknown word (berkay)

Check warning on line 6 in tools/reaction_analyzer/param/reaction_analyzer.param.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (berkay)
Expand Down
Loading

0 comments on commit b751212

Please sign in to comment.