Skip to content

Commit c8a1b5a

Browse files
Add bookmark system & Integrate toast message into thunderscope (UBC-Thunderbots#3418)
* add stubs and new proto * investigate missing logs * add listener to bookmark * work? * refactor proto_player.py * finish refactoring for proto_player.py * refactor bookmark visual * display bookmark visual * fix time stamp calculation * fix bookmark visual * update documentations * use kwargs as argument list * optimize bookmark button * [pre-commit.ci lite] apply automatic fixes * add documentation * add shortcut doc * add toast msg dependency * [pre-commit.ci lite] apply automatic fixes * build toast helper and apply * [pre-commit.ci lite] apply automatic fixes * upgrade pyqt6-qt * fix index test * add _ms suffix * adjust offset * add None as return type * remove magic number * [pre-commit.ci lite] apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
1 parent f794df7 commit c8a1b5a

26 files changed

Lines changed: 399 additions & 60 deletions

environment_setup/ubuntu20_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ python-Levenshtein==0.25.1
88
psutil==5.9.0
99
PyOpenGL==3.1.6
1010
ruff==0.5.5
11+
pyqt-toast-notification==1.3.2

environment_setup/ubuntu22_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ psutil==5.9.0
99
PyOpenGL==3.1.6
1010
numpy==1.26.4
1111
ruff==0.5.5
12+
pyqt-toast-notification==1.3.2

environment_setup/ubuntu24_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ python-Levenshtein==0.25.1
66
psutil==5.9.0
77
PyOpenGL==3.1.6
88
ruff==0.5.5
9+
pyqt-toast-notification==1.3.2

src/proto/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ proto_library(
1616
"play.proto",
1717
"power_frame_msg.proto",
1818
"primitive.proto",
19+
"replay_bookmark.proto",
1920
"robot_crash_msg.proto",
2021
"robot_log_msg.proto",
2122
"robot_statistic.proto",
@@ -55,6 +56,7 @@ py_proto_library(
5556
"parameters.proto",
5657
"play.proto",
5758
"primitive.proto",
59+
"replay_bookmark.proto",
5860
"robot_statistic.proto",
5961
"robot_status_msg.proto",
6062
"tactic.proto",

src/proto/replay_bookmark.proto

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
syntax = "proto3";
2+
3+
package TbotsProto;
4+
5+
import "proto/tbots_timestamp_msg.proto";
6+
7+
message ReplayBookmark
8+
{
9+
Timestamp timestamp = 1;
10+
}

src/software/backend/unix_simulator_backend.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ UnixSimulatorBackend::UnixSimulatorBackend(
5151
robot_crash_listener.reset(new ThreadedProtoUnixListener<TbotsProto::RobotCrash>(
5252
runtime_dir + ROBOT_CRASH_PATH, [](TbotsProto::RobotCrash& v) {}, proto_logger));
5353

54+
replay_bookmark_listener.reset(
55+
new ThreadedProtoUnixListener<TbotsProto::ReplayBookmark>(
56+
runtime_dir + REPLAY_BOOKMARK_PATH, [](TbotsProto::ReplayBookmark& v) {},
57+
proto_logger));
58+
5459
// Protobuf Outputs
5560
world_output.reset(new ThreadedProtoUnixSender<TbotsProto::World>(
5661
runtime_dir + WORLD_PATH, proto_logger));

src/software/backend/unix_simulator_backend.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
#include <mutex>
44

55
#include "proto/parameters.pb.h"
6+
#include "proto/replay_bookmark.pb.h"
67
#include "proto/robot_crash_msg.pb.h"
78
#include "proto/robot_log_msg.pb.h"
89
#include "proto/robot_status_msg.pb.h"
910
#include "proto/sensor_msg.pb.h"
1011
#include "proto/tbots_software_msgs.pb.h"
1112
#include "proto/validation.pb.h"
13+
#include "proto/world.pb.h"
1214
#include "software/backend/backend.h"
1315
#include "software/logger/proto_logger.h"
1416
#include "software/networking/unix/threaded_proto_unix_listener.hpp"
@@ -50,6 +52,8 @@ class UnixSimulatorBackend : public Backend, public Subject<TbotsProto::Thunderb
5052
std::unique_ptr<ThreadedProtoUnixListener<TbotsProto::RobotLog>> robot_log_listener;
5153
std::unique_ptr<ThreadedProtoUnixListener<TbotsProto::RobotCrash>>
5254
robot_crash_listener;
55+
std::unique_ptr<ThreadedProtoUnixListener<TbotsProto::ReplayBookmark>>
56+
replay_bookmark_listener;
5357

5458
// Outputs
5559
std::unique_ptr<ThreadedProtoUnixSender<TbotsProto::World>> world_output;

src/software/constants.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const std::string SIMULATOR_STATE_PATH = "/simulator_state";
3232
const std::string VALIDATION_PROTO_SET_PATH = "/validation_proto_set";
3333
const std::string ROBOT_LOG_PATH = "/robot_log";
3434
const std::string ROBOT_CRASH_PATH = "/robot_crash";
35+
const std::string REPLAY_BOOKMARK_PATH = "/replay_bookmark";
3536
const std::string DYNAMIC_PARAMETER_UPDATE_REQUEST_PATH = "/dynamic_parameter_request";
3637
const std::string DYNAMIC_PARAMETER_UPDATE_RESPONSE_PATH = "/dynamic_parameter_response";
3738
const std::string WORLD_STATE_RECEIVED_TRIGGER_PATH = "/world_state_received_trigger";

src/software/py_constants.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ PYBIND11_MODULE(py_constants, m)
6363
m.attr("VALIDATION_PROTO_SET_PATH") = VALIDATION_PROTO_SET_PATH;
6464
m.attr("ROBOT_LOG_PATH") = ROBOT_LOG_PATH;
6565
m.attr("ROBOT_CRASH_PATH") = ROBOT_CRASH_PATH;
66+
m.attr("REPLAY_BOOKMARK_PATH") = REPLAY_BOOKMARK_PATH;
6667
m.attr("UNIX_BUFFER_SIZE") = UNIX_BUFFER_SIZE;
6768
m.attr("DYNAMIC_PARAMETER_UPDATE_REQUEST_PATH") =
6869
DYNAMIC_PARAMETER_UPDATE_REQUEST_PATH;

src/software/thunderscope/binary_context_managers/full_system.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,5 +216,6 @@ def setup_proto_unix_io(self, proto_unix_io: ProtoUnixIO) -> None:
216216
(VALIDATION_PROTO_SET_PATH, ValidationProtoSet),
217217
(ROBOT_LOG_PATH, RobotLog),
218218
(ROBOT_CRASH_PATH, RobotCrash),
219+
(REPLAY_BOOKMARK_PATH, ReplayBookmark),
219220
]:
220221
proto_unix_io.attach_unix_sender(self.full_system_runtime_dir, *arg)

0 commit comments

Comments
 (0)