Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
ebcdccf
feat(fr3): record 1 kHz control loop states in a lock-free ring buffer
juelg Nov 15, 2026
9b1cb7c
feat(fr3): forward control loop states through the env info
juelg Nov 15, 2026
757ec87
fix(fr3): end the episode visibly on robot errors
juelg Nov 15, 2026
fbd5e16
fix(operator): reset the teleop episode when the env ends it
juelg Nov 15, 2026
7cb331a
feat(envs): record multi-dimensional info arrays and episode end flags
juelg Nov 15, 2026
fd8ca81
feat(sim): mirror the control state recording at physics rate
juelg Nov 15, 2026
cba1bcf
feat(fr3): enable control state recording from the wrapper config
juelg Nov 15, 2026
5a5600b
feat(webui): add extension with reproducible env config snapshots
juelg Nov 15, 2026
8e3bc3d
feat(webui): session runner for Quest labelled recording
juelg Nov 15, 2026
261661b
feat(webui): http server, session page and rcs-webui CLI
juelg Nov 15, 2026
2236d30
test(webui): end to end recording in simulation
juelg Nov 15, 2026
fdfa9a4
docs(webui): setup from scratch and docs page
juelg Nov 15, 2026
ca31f58
fix(webui): portable snapshots of python gripper configs and asset paths
juelg Nov 15, 2026
12a1a1f
feat(webui): data viewer with plots, camera playback, relabel and delete
juelg Nov 15, 2026
08592b2
feat(operator): report whether the human is engaged
juelg Nov 15, 2026
46e74bd
fix(envs): raise instead of hanging when the storage writer died
juelg Nov 15, 2026
8dc125b
feat(envs): per step annotations in the StorageWrapper
juelg Nov 15, 2026
104c3f5
feat(webui): policy client interface, chunk executor with real-time c…
juelg Nov 15, 2026
2b421fa
feat(webui): select, edit and validate env configs in the interface
juelg Nov 15, 2026
e81324f
feat(webui): eval mode with runtime policy server switch and interven…
juelg Nov 15, 2026
9a1adc0
feat(webui): name the source chunk of the RTC prefix
juelg Nov 15, 2026
33c536d
docs(webui): eval mode, policy clients and real-time chunking
juelg Nov 15, 2026
af0fcb3
style(webui): satisfy mypy
juelg Nov 15, 2026
5d88584
fix(webui): count executed chunk actions from the switch-over index
juelg Nov 15, 2026
bec4756
test(webui): bare and wrapped config files load
juelg Nov 15, 2026
78dc84b
feat(webui): let policy clients convert actions at execution time
juelg Nov 15, 2026
29940c9
fix(webui): Ctrl+C no longer hangs on hardware shutdown
juelg Nov 15, 2026
d5c5101
fix(operator): keep the pyzlc node alive when closing the Quest operator
juelg Nov 16, 2026
e88a33b
feat(webui): discover env packages, infer creators and describe configs
juelg Nov 16, 2026
0369b25
feat(webui): configure and start everything from the web page
juelg Nov 16, 2026
6c37680
feat(webui): config editor with a VS Code like diff gutter
juelg Nov 16, 2026
71c5750
feat(webui): dark mode by default with a light toggle
juelg Nov 16, 2026
55ece5b
docs(webui): serve command, settings and config editor
juelg Nov 16, 2026
aacdd09
test(webui): start the bare sim config headless
juelg Nov 16, 2026
1cd6880
fix(webui): label an episode successful when the env's task check suc…
juelg Nov 16, 2026
d8206e7
feat(webui): setting to turn off the auto reset at the env's end of e…
juelg Nov 16, 2026
07e1814
feat(webui): record who controlled the robot in every step
juelg Nov 16, 2026
c18e491
feat(webui): X hands the robot back to the policy after an intervention
juelg Nov 16, 2026
4b8d398
feat(webui): controller timeline and intervention filter in the data …
juelg Nov 16, 2026
6a191e0
feat(webui): log the git state of the packages of the creator and the…
juelg Nov 16, 2026
2c502e7
fix(operator): remove a stopped publisher's scene from the Quest
juelg Nov 16, 2026
956dd5c
fix(webui): close the env and the MuJoCo viewer when the env is stopped
juelg Nov 16, 2026
cb39e62
feat(webui): collapsible config editor, collapsed by default
juelg Nov 16, 2026
db6d7c5
fix(robotiq2f85): stop the status thread before closing the serial port
juelg Nov 16, 2026
4d25473
fix(webui): a browser that drops a request is not an error
juelg Nov 16, 2026
cb3e78b
fix(fr3): add Coriolis feed-forward to the joint and OSC torque contr…
juelg Nov 16, 2026
f9929b8
fix(webui): do not start a stale config when the file changed on disk
juelg Nov 16, 2026
9c7222e
fix(fr3): joint-limit guard of the controllers uses the configured li…
juelg Nov 16, 2026
be5c35c
fix(robotiq2f85): send gripper commands from a writer thread in async…
juelg Nov 16, 2026
b2851d8
feat(webui): record trigger engagement and robot motion per step
juelg Nov 16, 2026
e5bed1a
feat(webui): show trigger and motion lanes in the viewer timeline
juelg Nov 16, 2026
e8dd0bc
fix(camera): stop the polling thread before closing the cameras
juelg Nov 16, 2026
b6547c9
fix(interpolator): continue a new segment from the current reference
juelg Nov 16, 2026
5b85eb1
fix(storage): consolidate into sized files, keep order, never lose data
juelg Nov 16, 2026
2f6f765
feat(webui): consolidate a session's files in the background on env stop
juelg Nov 16, 2026
ed58079
feat(webui): option to recover from robot errors and keep recording
juelg Nov 16, 2026
a373921
fix(fr3): recover() only calls the bound automatic_error_recovery
juelg Nov 16, 2026
625510b
fix(webui): playback of consolidated sessions
juelg Nov 16, 2026
3b51a44
fix(operator): rebase the Quest offset after a reset while the trigge…
juelg Nov 16, 2026
fb2f40f
feat(webui): after a recovery or reset follow the operator only after…
juelg Nov 16, 2026
5805f44
feat(fr3): configurable joint-limit guard with velocity braking
juelg Nov 16, 2026
52eb424
fix(envs): a new origin restarts the per-step limit of RelativeAction…
juelg Nov 16, 2026
1d5e86f
feat(envs): max_step_movement limits the target against the measured …
juelg Nov 16, 2026
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
1 change: 1 addition & 0 deletions docs/extensions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ rcs_usb_cam
rcs_tacto
rcs_robotiq2f85
rcs_zed
rcs_webui
```
5 changes: 5 additions & 0 deletions docs/extensions/rcs_webui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# RCS Web Interface

```{include} ../../extensions/rcs_webui/README.md
:start-line: 1
```
207 changes: 207 additions & 0 deletions extensions/rcs_fr3/src/hw/ControlStateBuffer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
#ifndef RCS_FRANKA_CONTROL_STATE_BUFFER_H
#define RCS_FRANKA_CONTROL_STATE_BUFFER_H

#include <franka/errors.h>
#include <franka/robot_state.h>

#include <array>
#include <atomic>
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <string>
#include <vector>

namespace rcs {
namespace hw {

/**
* @brief One sample of the robot state as seen by the 1 kHz control loop.
*
* Plain old data so that it can be copied into a preallocated ring buffer
* without any allocation inside the real-time loop.
*/
struct ControlStateSample {
// host wall clock in seconds since epoch (same clock as Python's
// time.time()), taken when the sample was recorded
double timestamp = 0.0;
// robot clock in seconds (franka::RobotState::time)
double robot_time = 0.0;
std::array<double, 7> q{};
std::array<double, 7> dq{};
std::array<double, 7> tau_J{};
std::array<double, 7> tau_J_d{};
std::array<double, 7> dtau_J{};
std::array<double, 7> tau_ext_hat_filtered{};
std::array<double, 6> O_F_ext_hat_K{};
std::array<double, 6> K_F_ext_hat_K{};
// column major 4x4 end effector pose in base frame
std::array<double, 16> O_T_EE{};
double control_command_success_rate = 0.0;
// franka::RobotMode as integer
int32_t robot_mode = 0;
// bit i is set if error i of franka::Errors is active
uint64_t current_errors = 0;
uint64_t last_motion_errors = 0;
};

// number of error flags in franka::Errors
constexpr size_t kNumFrankaErrors = 41;
static_assert(kNumFrankaErrors <= 64, "errors must fit into a uint64 mask");

/**
* @brief Packs the error flags of franka::Errors into a bit mask.
*
* franka::Errors only exposes its flags as references into a private
* std::array<bool, 41>, bound in declaration order. The first reference
* therefore points to the start of that array.
*/
inline uint64_t ErrorsToMask(const franka::Errors& errors) noexcept {
const bool* flags = &errors.joint_position_limits_violation;
uint64_t mask = 0;
for (size_t i = 0; i < kNumFrankaErrors; ++i) {
if (flags[i]) {
mask |= (uint64_t{1} << i);
}
}
return mask;
}

/**
* @brief Names of the error flags, index i corresponds to bit i of the masks.
*/
inline std::vector<std::string> ErrorNames() {
std::vector<std::string> names;
names.reserve(kNumFrankaErrors);
for (size_t i = 0; i < kNumFrankaErrors; ++i) {
std::array<bool, kNumFrankaErrors> flags{};
flags[i] = true;
// format is ["name"]
std::string name;
for (char c : static_cast<std::string>(franka::Errors(flags))) {
if (c != '[' && c != ']' && c != '"') {
name.push_back(c);
}
}
names.push_back(name);
}
return names;
}

inline void FillSample(const franka::RobotState& state,
ControlStateSample& sample) noexcept {
sample.timestamp = std::chrono::duration<double>(
std::chrono::system_clock::now().time_since_epoch())
.count();
sample.robot_time = state.time.toSec();
sample.q = state.q;
sample.dq = state.dq;
sample.tau_J = state.tau_J;
sample.tau_J_d = state.tau_J_d;
sample.dtau_J = state.dtau_J;
sample.tau_ext_hat_filtered = state.tau_ext_hat_filtered;
sample.O_F_ext_hat_K = state.O_F_ext_hat_K;
sample.K_F_ext_hat_K = state.K_F_ext_hat_K;
sample.O_T_EE = state.O_T_EE;
sample.control_command_success_rate = state.control_command_success_rate;
sample.robot_mode = static_cast<int32_t>(state.robot_mode);
sample.current_errors = ErrorsToMask(state.current_errors);
sample.last_motion_errors = ErrorsToMask(state.last_motion_errors);
}

/**
* @brief Single producer single consumer lock-free ring buffer of
* ControlStateSample.
*
* The producer is the 1 kHz control thread (push), the consumer is the
* Python env step (drain). All memory is allocated in the constructor, push
* neither allocates nor locks. If the consumer does not drain in time the
* newest samples are dropped and counted.
*/
class ControlStateBuffer {
public:
// 8192 samples are > 8 s at 1 kHz, much longer than one env step
static constexpr size_t kDefaultCapacity = 8192;

explicit ControlStateBuffer(size_t capacity = kDefaultCapacity)
: m_capacity(RoundUpPow2(capacity)),
m_mask(m_capacity - 1),
m_samples(std::make_unique<ControlStateSample[]>(m_capacity)) {}

ControlStateBuffer(const ControlStateBuffer&) = delete;
ControlStateBuffer& operator=(const ControlStateBuffer&) = delete;

size_t capacity() const noexcept { return m_capacity; }

/// producer side, real-time safe
bool push(const franka::RobotState& state) noexcept {
const size_t head = m_head.load(std::memory_order_relaxed);
const size_t tail = m_tail.load(std::memory_order_acquire);
if (head - tail >= m_capacity) {
m_dropped.fetch_add(1, std::memory_order_relaxed);
return false;
}
FillSample(state, m_samples[head & m_mask]);
m_head.store(head + 1, std::memory_order_release);
return true;
}

/// consumer side: number of samples ready to be drained
size_t size() const noexcept {
return m_head.load(std::memory_order_acquire) -
m_tail.load(std::memory_order_relaxed);
}

/**
* @brief consumer side: calls fn(index, sample) for every available sample
* in order and frees them. Returns the number of drained samples.
*/
template <typename Fn>
size_t drain(Fn&& fn, size_t max_samples) {
const size_t tail = m_tail.load(std::memory_order_relaxed);
const size_t head = m_head.load(std::memory_order_acquire);
size_t n = head - tail;
if (n > max_samples) {
n = max_samples;
}
for (size_t i = 0; i < n; ++i) {
fn(i, m_samples[(tail + i) & m_mask]);
}
m_tail.store(tail + n, std::memory_order_release);
return n;
}

/// consumer side: discard all available samples
void clear() noexcept {
m_tail.store(m_head.load(std::memory_order_acquire),
std::memory_order_release);
}

/// number of samples dropped since the last call, resets the counter
uint64_t take_dropped() noexcept {
return m_dropped.exchange(0, std::memory_order_relaxed);
}

private:
static size_t RoundUpPow2(size_t v) {
size_t p = 1;
while (p < v) {
p <<= 1;
}
return p;
}

const size_t m_capacity;
const size_t m_mask;
std::unique_ptr<ControlStateSample[]> m_samples;
// separate cache lines for producer and consumer indices
alignas(64) std::atomic<size_t> m_head{0};
alignas(64) std::atomic<size_t> m_tail{0};
alignas(64) std::atomic<uint64_t> m_dropped{0};
};

} // namespace hw
} // namespace rcs

#endif // RCS_FRANKA_CONTROL_STATE_BUFFER_H
Loading
Loading