-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/game over pub #7
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: develop
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |||||
| time_rate: 100 # Timer rate in microseconds (100 = 10kHz) | ||||||
| game_time: 100 # Total game time in seconds | ||||||
| sima_tick_threshold: 85 # Seconds before sima starts | ||||||
| sima_game_over_trigger_sec: 99 # Seconds tell sima to stop | ||||||
|
||||||
| sima_game_over_trigger_sec: 99 # Seconds tell sima to stop | |
| sima_game_over_trigger_sec: 99 # Seconds after game start to tell Sima to stop |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |||||||||
| time_rate: 100 # Timer rate in microseconds (100 = 10kHz) | ||||||||||
| game_time: 100 # Total game time in seconds | ||||||||||
| sima_tick_threshold: 85 # Seconds before sima starts | ||||||||||
| sima_game_over_trigger_sec: 99 # Seconds tell sima to stop | ||||||||||
|
Comment on lines
8
to
+9
|
||||||||||
| sima_tick_threshold: 85 # Seconds before sima starts | |
| sima_game_over_trigger_sec: 99 # Seconds tell sima to stop | |
| sima_tick_threshold: 85 # Seconds before Sima starts | |
| sima_game_over_trigger_sec: 99 # Seconds after start to tell Sima to stop |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |||||
| time_rate: 100 # Timer rate in microseconds (100 = 10kHz) | ||||||
| game_time: 100 # Total game time in seconds | ||||||
| sima_tick_threshold: 85 # Seconds before sima starts | ||||||
| sima_game_over_trigger_sec: 99 # Seconds tell sima to stop | ||||||
|
||||||
| sima_game_over_trigger_sec: 99 # Seconds tell sima to stop | |
| sima_game_over_trigger_sec: 99 # Seconds after start to tell Sima to stop |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -13,6 +13,7 @@ StartUp::StartUp() : Node("startup_node"){ | |||||
|
|
||||||
| game_time_pub = this->create_publisher<std_msgs::msg::Float32>("/robot/startup/game_time", 2); | ||||||
| rate = std::make_shared<rclcpp::Rate>(time_rate); | ||||||
| sima_game_over_pub = this->create_publisher<std_msgs::msg::Bool>("/robot/startup/sima_game_over", 1); | ||||||
|
Comment on lines
14
to
+16
|
||||||
|
|
||||||
| // State checker for other groups | ||||||
| are_you_ready_pub = this->create_publisher<std_msgs::msg::Bool>("/robot/startup/are_you_ready", 2); | ||||||
|
|
@@ -50,13 +51,15 @@ StartUp::StartUp() : Node("startup_node"){ | |||||
| is_plugged = false; | ||||||
| end_logged = false; | ||||||
| game_time = 0; | ||||||
| sima_game_over_sent = false; | ||||||
| } | ||||||
|
|
||||||
| void StartUp::initParam() { | ||||||
| // Timing parameters | ||||||
| this->declare_parameter<int>("time_rate", 100); | ||||||
| this->declare_parameter<int>("game_time", 100); | ||||||
| this->declare_parameter<int>("sima_tick_threshold", 85); | ||||||
| this->declare_parameter<int>("sima_game_over_trigger_sec", 99); | ||||||
| this->declare_parameter<int>("group_num", 5); | ||||||
|
|
||||||
| // Robot parameters | ||||||
|
|
@@ -69,6 +72,7 @@ void StartUp::initParam() { | |||||
| this->get_parameter("time_rate", time_rate); | ||||||
| this->get_parameter("game_time", game_time_limit); | ||||||
| this->get_parameter("sima_tick_threshold", sima_tick_threshold); | ||||||
| this->get_parameter("sima_game_over_trigger_sec", sima_game_over_trigger_sec); | ||||||
| this->get_parameter("group_num", group_num); | ||||||
|
|
||||||
| // Get robot parameters | ||||||
|
|
@@ -288,6 +292,15 @@ void StartUp::publishTime() { | |||||
| cur_time_msg.data = cur_time - start_time; | ||||||
| game_time = cur_time_msg.data; | ||||||
|
||||||
| game_time = cur_time_msg.data; | |
| game_time = static_cast<int>(cur_time_msg.data); |
Copilot
AI
Mar 24, 2026
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.
RCLCPP_INFO uses printf-style formatting; %f expects a double, but game_time is currently an int. This mismatch is undefined behavior. Fix by changing game_time’s type to double/float or casting to double in the log call (and adjusting the member type in the header accordingly).
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.
game_timeis declared asinthere, but the implementation treats it as elapsed seconds (Float32/double). This can cause truncation and printf-format mismatches. Consider changing this member todouble/float.