pub struct FeetechBridge { /* private fields */ }Expand description
Bidirectional bridge for Feetech STS/SCS serial bus servos.
Created by the Copper runtime from configuration. Each cycle it:
- Receives (
receive): reads present positions from all servos and publishes them on thepositionsRx channel. - Sends (
send): if agoal_positionsTx message is available, writes goal positions to all servos via a single sync-write packet.
Positions are converted to the unit specified by the "units" config key
("raw", "deg", "rad", or "normalize"). When using "deg", "rad", or
"normalize", a calibration file ("calibration_file" key) must be provided.
Implementations§
Trait Implementations§
Source§impl CuBridge for FeetechBridge
impl CuBridge for FeetechBridge
Source§fn new(
config: Option<&ComponentConfig>,
tx_channels: &[BridgeChannelConfig<<Self::Tx as BridgeChannelSet>::Id>],
_rx_channels: &[BridgeChannelConfig<<Self::Rx as BridgeChannelSet>::Id>],
resources: Self::Resources<'_>,
) -> CuResult<Self>where
Self: Sized,
fn new(
config: Option<&ComponentConfig>,
tx_channels: &[BridgeChannelConfig<<Self::Tx as BridgeChannelSet>::Id>],
_rx_channels: &[BridgeChannelConfig<<Self::Rx as BridgeChannelSet>::Id>],
resources: Self::Resources<'_>,
) -> CuResult<Self>where
Self: Sized,
Construct the bridge from configuration.
Expected copperconfig.ron keys under the bridge’s config block:
| Key | Type | Description |
|---|---|---|
servo0 | u8 | Bus ID of the first servo |
servo1 | u8 | Bus ID of the second servo |
| … | … | Up to servo7 |
units | string | "raw" (default), "deg", "rad", or "normalize" |
calibration_file | string | Path to calibration JSON (required for deg/rad/normalize) |
ticks_per_rev | integer | Raw units per 360° (model-dependent; default 4096) |
At least servo0 must be present.
Source§fn start(&mut self, _ctx: &CuContext) -> CuResult<()>
fn start(&mut self, _ctx: &CuContext) -> CuResult<()>
Called once before the first processing cycle.
Enables torque only when writers are connected (commander mode). In follower mode torque stays off so the arm moves freely.
Source§fn send<'a, Payload>(
&mut self,
_ctx: &CuContext,
channel: &'static BridgeChannel<<Self::Tx as BridgeChannelSet>::Id, Payload>,
msg: &CuMsg<Payload>,
) -> CuResult<()>where
Payload: CuMsgPayload + 'a,
fn send<'a, Payload>(
&mut self,
_ctx: &CuContext,
channel: &'static BridgeChannel<<Self::Tx as BridgeChannelSet>::Id, Payload>,
msg: &CuMsg<Payload>,
) -> CuResult<()>where
Payload: CuMsgPayload + 'a,
Handle an outgoing message on a Tx channel.
For goal_positions: sync-writes the raw positions to the servo bus.
Source§fn receive<'a, Payload>(
&mut self,
ctx: &CuContext,
channel: &'static BridgeChannel<<Self::Rx as BridgeChannelSet>::Id, Payload>,
msg: &mut CuMsg<Payload>,
) -> CuResult<()>where
Payload: CuMsgPayload + 'a,
fn receive<'a, Payload>(
&mut self,
ctx: &CuContext,
channel: &'static BridgeChannel<<Self::Rx as BridgeChannelSet>::Id, Payload>,
msg: &mut CuMsg<Payload>,
) -> CuResult<()>where
Payload: CuMsgPayload + 'a,
Produce an incoming message on an Rx channel.
For positions: reads every servo’s present position and publishes
them as a JointPositions.
Source§fn stop(&mut self, _ctx: &CuContext) -> CuResult<()>
fn stop(&mut self, _ctx: &CuContext) -> CuResult<()>
Called once after the last processing cycle.
Disables torque on every servo for safety (prevents the arm from holding position with power applied after the application exits).
Source§type Tx = TxChannels
type Tx = TxChannels
Source§type Rx = RxChannels
type Rx = RxChannels
Source§impl Freezable for FeetechBridge
impl Freezable for FeetechBridge
Source§fn freeze<E>(&self, encoder: &mut E) -> Result<(), EncodeError>where
E: Encoder,
fn freeze<E>(&self, encoder: &mut E) -> Result<(), EncodeError>where
E: Encoder,
Source§fn thaw<D>(&mut self, _decoder: &mut D) -> Result<(), DecodeError>where
D: Decoder,
fn thaw<D>(&mut self, _decoder: &mut D) -> Result<(), DecodeError>where
D: Decoder,
Auto Trait Implementations§
impl Freeze for FeetechBridge
impl !RefUnwindSafe for FeetechBridge
impl Send for FeetechBridge
impl Sync for FeetechBridge
impl Unpin for FeetechBridge
impl UnsafeUnpin for FeetechBridge
impl !UnwindSafe for FeetechBridge
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more