Skip to content

hw: make SlateBaseComponent a base-velocity teleop follower#258

Open
abhichothani42 wants to merge 2 commits into
vr-01-base-space-teleopfrom
vr-02-slate-base-follower
Open

hw: make SlateBaseComponent a base-velocity teleop follower#258
abhichothani42 wants to merge 2 commits into
vr-01-base-space-teleopfrom
vr-02-slate-base-follower

Conversation

@abhichothani42

@abhichothani42 abhichothani42 commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements teleop::BaseSpaceTeleop on SlateBaseComponent so the SLATE mobile base can be driven as a teleop follower by any base-space leader. Without this, a base teleop pair silently runs leader-only and the base never moves.

Changes

  • write([linear_mps, angular_rps]) forwards the command to TrossenSlate::set_cmd_vel(); the driver applies its own velocity limits.
  • read() returns the base's current body-frame velocity, used once by the teleop controller to seed leader alignment.
  • end_teleop() commands zero velocity so the base halts on shutdown (idempotent).
  • Commands with fewer than two elements are ignored.

Test Plan

  • Builds cleanly (make build)
  • Tests pass (make test)
  • Lint passes (pre-commit run --all-files)
  • Tested on hardware

Breaking Changes

None. Purely additive — the base only acts as a follower when a teleop pair targets it with "space": "base"; flows that record the base as a producer are unaffected.

Related Issues

N/A — part of the VR teleoperation feature stack.

abhichothani42 commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates SlateBaseComponent to participate in the teleoperation system as a base-velocity-space component by implementing teleop::BaseSpaceTeleop, allowing it to read current base velocity and accept [linear_mps, angular_rps] velocity commands.

Changes:

  • Make SlateBaseComponent inherit from teleop::BaseSpaceTeleop.
  • Add read(), write(), and end_teleop() implementations that bridge teleop IO to the SLATE driver velocity APIs.
  • Update header documentation to describe the base-space teleop contract.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/hw/base/slate_base_component.cpp Implements BaseSpaceTeleop IO (read/write) and teleop shutdown behavior (end_teleop).
include/trossen_sdk/hw/base/slate_base_component.hpp Adds teleop interface inheritance, includes, and public API declarations/docs for the teleop IO contract.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/hw/base/slate_base_component.cpp
Comment thread src/hw/base/slate_base_component.cpp
Comment thread include/trossen_sdk/hw/base/slate_base_component.hpp Outdated
Comment thread include/trossen_sdk/hw/base/slate_base_component.hpp
Comment thread src/hw/base/slate_base_component.cpp Outdated
}

std::vector<float> SlateBaseComponent::read() {
if (!driver_) return {0.0f, 0.0f};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should trigger some error. The user might not be able to debug this in case the driver is missing. Or just return {}. Fail early so it's easy to debug.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — read() logs and returns {} now, so a missing driver fails loudly instead of silently.
d072bda

Comment thread src/hw/base/slate_base_component.cpp Outdated
}

void SlateBaseComponent::write(const std::vector<float>& cmd) {
if (!driver_ || cmd.size() < 2) return;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should warn here. Else, it would be difficult to debug

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, write() logs on this path now. d072bda

return info;
}

std::vector<float> SlateBaseComponent::read() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/Interbotix/trossen_slate/blob/dd16cc8c327ce0269f839893520a302b47905d43/demo/basic_demo.cpp#L61-L62.

If we don't call update state we won't be able to get the latest state. Are we calling it anywhere else?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, added driver_->update_state() before reading so we return the current state, not a stale one.

Comment thread src/hw/base/slate_base_component.cpp Outdated

void SlateBaseComponent::write(const std::vector<float>& cmd) {
if (!driver_ || cmd.size() < 2) return;
driver_->set_cmd_vel(cmd[0], cmd[1]);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are ignoring the bool return, might be a good idea to use it for erro logging.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed we check the return and log on failure. d072bda

Comment thread src/hw/base/slate_base_component.cpp Outdated

void SlateBaseComponent::end_teleop() {
if (driver_) {
driver_->set_cmd_vel(0.0f, 0.0f);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use return value for error logging

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, logs if stopping the base fails. d072bda

@shantanuparab-tr shantanuparab-tr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no base-space leader yet at this point in the stack, so I don't see how this ran end to end as a follower. What does "tested on hardware" cover here?

@abhichothani42

Copy link
Copy Markdown
Collaborator Author

unchecked tested on hardware

Implement teleop::BaseSpaceTeleop on SlateBaseComponent so the SLATE mobile base can be driven as a teleop follower.

- write([linear_mps, angular_rps]) forwards the command to TrossenSlate::set_cmd_vel(); the driver clamps to its velocity limits.
- read() returns the base's current body-frame velocity, used once by the teleop controller to seed leader alignment.
- end_teleop() commands zero velocity so the base halts on shutdown; idempotent.

Purely additive: the base only acts as a follower when a teleop pair targets it with space "base". Existing flows that record the base as a producer are unaffected.

Depends on the Base teleop space added in the previous PR.
@abhichothani42
abhichothani42 force-pushed the vr-02-slate-base-follower branch from d072bda to efc7944 Compare July 17, 2026 14:48
@abhichothani42
abhichothani42 force-pushed the vr-01-base-space-teleop branch from 2629656 to 6791e23 Compare July 17, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants