Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmake/BipedalLocomotionFrameworkDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ blf_optional_find_package(tomlplusplus 3.0.1 QUIET)
checkandset_dependency(tomlplusplus MINIMUM_VERSION 3.0.1)
dependency_classifier(tomlplusplus MINIMUM_VERSION 3.0.1 IS_USED ${FRAMEWORK_USE_tomlplusplus} PUBLIC)

blf_optional_find_package(robometry 1.1.0 QUIET)
checkandset_dependency(robometry MINIMUM_VERSION 1.1.0)
dependency_classifier(robometry MINIMUM_VERSION 1.1.0 IS_USED ${FRAMEWORK_USE_robometry})
blf_optional_find_package(robometry 1.4.1 QUIET)
checkandset_dependency(robometry MINIMUM_VERSION 1.4.1)
dependency_classifier(robometry MINIMUM_VERSION 1.4.1 IS_USED ${FRAMEWORK_USE_robometry})

blf_optional_find_package(BayesFilters QUIET)
checkandset_dependency(BayesFilters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ BSD-3-Clause license. -->
<param name="log_cameras">true</param>
<param name="log_frames">false</param>
<param name="log_robot_data">true</param>
<param name="auto_start_logging">true</param>

<param name="enable_real_time_logging" extern-name="enable_real_time_logging">false</param>
<group name="REAL_TIME_STREAMING">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ BSD-3-Clause license. -->
<param name="log_cameras">true</param>
<param name="log_frames">false</param>
<param name="log_robot_data">true</param>
<param name="auto_start_logging">true</param>

<param name="enable_real_time_logging" extern-name="enable_real_time_logging">false</param>
<group name="REAL_TIME_STREAMING">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ BSD-3-Clause license. -->
<param name="log_cameras">true</param>
<param name="log_frames">false</param>
<param name="log_robot_data">true</param>
<param name="auto_start_logging">true</param>

<param name="enable_real_time_logging" extern-name="enable_real_time_logging">false</param>
<group name="REAL_TIME_STREAMING">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ BSD-3-Clause license. -->
<param name="log_cameras">true</param>
<param name="log_frames">false</param>
<param name="log_robot_data">true</param>
<param name="auto_start_logging">true</param>

<param name="enable_real_time_logging" extern-name="enable_real_time_logging">false</param>
<group name="REAL_TIME_STREAMING">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ BSD-3-Clause license. -->
<param name="log_cameras">true</param>
<param name="log_frames">false</param>
<param name="log_robot_data">true</param>
<param name="auto_start_logging">true</param>

<param name="enable_real_time_logging" extern-name="enable_real_time_logging">false</param>
<group name="REAL_TIME_STREAMING">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ BSD-3-Clause license. -->
<param name="log_text">true</param>
<param name="text_logging_subnames">("ergocub-torso/yarprobotinterface")</param>
<param name="code_status_cmds">("ssh [email protected] 'bash ${ROBOTOLOGY_SUPERBUILD_SOURCE_DIR}/scripts/robotologyGitStatus.sh' > {filename}_robotology_10_0_0_2.txt" "ssh [email protected] 'apt list --installed' > {filename}_apt_10_0_0_2.txt" "ssh [email protected] 'bash ${ROBOTOLOGY_SUPERBUILD_SOURCE_DIR}/scripts/robotologyGitStatus.sh' > {filename}_robotology_10_0_0_3.txt" "ssh [email protected] 'apt list --installed' > {filename}_apt_10_0_0_3.txt")</param>
<param name="auto_start_logging">true</param>

<param name="enable_real_time_logging" extern-name="enable_real_time_logging">false</param>
<group name="REAL_TIME_STREAMING">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ BSD-3-Clause license. -->
<param name="log_cameras">true</param>
<param name="log_frames">false</param>
<param name="log_robot_data">true</param>
<param name="auto_start_logging">true</param>

<param name="enable_real_time_logging" extern-name="enable_real_time_logging">false</param>
<group name="REAL_TIME_STREAMING">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ BSD-3-Clause license. -->
<param name="log_cameras">true</param>
<param name="log_frames">false</param>
<param name="log_robot_data">true</param>
<param name="auto_start_logging">true</param>

<param name="enable_real_time_logging" extern-name="enable_real_time_logging">false</param>
<group name="REAL_TIME_STREAMING">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ class YarpRobotLoggerDevice : public yarp::dev::DeviceDriver,
public YarpRobotLoggerDeviceCommands
{
public:
enum class DeviceState
{
Idle,
Recording,
Saving
};

YarpRobotLoggerDevice(double period,
yarp::os::ShouldUseSystemClock useSystemClock
= yarp::os::ShouldUseSystemClock::No);
Expand All @@ -64,6 +71,9 @@ class YarpRobotLoggerDevice : public yarp::dev::DeviceDriver,
virtual void run() final;

private:
std::atomic<DeviceState> m_state{DeviceState::Idle};
bool m_autoStartLogging{true};

std::chrono::nanoseconds m_previousTimestamp;
std::chrono::nanoseconds m_acceptableStep{std::chrono::nanoseconds::max()};
bool m_firstRun{true};
Expand Down Expand Up @@ -277,6 +287,29 @@ class YarpRobotLoggerDevice : public yarp::dev::DeviceDriver,
bool prepareExogenousImageLogging();
bool prepareRTStreaming();

// State machine transitions
bool transitionToRecording();
bool transitionToIdle(bool save, const std::string& tag = "");

// Helpers for state transitions
void disconnectAllExogenousSignals();
void stopAllThreads();
void resetBufferManager();
void discardVideoFiles();

// Tag validation/sanitization - returns empty string on invalid input
bool sanitizeTag(const std::string& tag, std::string& outputFileName) const;

// Unified data logging helper (pushes to buffer manager + RT server)
template <typename T>
void logData(const std::string& name, const T& data, double time);

// Refactored run() sub-methods
void logRobotData(double time);
void logExogenousSignals(double time);
void logTextMessages(double time);
void logFrameTransforms(double time);

const std::string defaultFilePrefix = "robot_logger_device";

const std::string robotRtRootName = "robot_realtime";
Expand Down Expand Up @@ -332,7 +365,12 @@ class YarpRobotLoggerDevice : public yarp::dev::DeviceDriver,

void resumeAcquisitionThreads();

virtual bool saveData(const std::string& tag = "") override;
// RPC command implementations
virtual bool startRecording() override;
virtual bool saveRecording(const std::string& tag = "") override;
virtual bool saveAndStopRecording(const std::string& tag = "") override;
virtual bool discardRecording() override;
virtual std::string getState() override;
};

} // namespace BipedalLocomotion
Expand Down
Loading
Loading