Skip to main content

RobotImpl

Struct RobotImpl 

Source
pub struct RobotImpl { /* private fields */ }
Expand description

The FCI session plus everything franka::Robot::Impl keeps.

Implementations§

Source§

impl RobotImpl

Source

pub fn get_robot_model(&self) -> FrankaResult<String>

GetRobotModel: returns the robot’s URDF.

§Errors

FrankaError::InvalidOperation on FCI v5, which has no such command — an FER serves its model as a shared object through LoadModelLibrary instead.

Source

pub fn set_filters( &self, joint_position_filter_frequency: f64, joint_velocity_filter_frequency: f64, cartesian_position_filter_frequency: f64, cartesian_velocity_filter_frequency: f64, controller_filter_frequency: f64, ) -> FrankaResult<()>

Robot::setFilters (libfranka 0.9.2 src/robot.cpp:216-225), FCI v5 only.

§Errors

FrankaError::InvalidOperation on FCI v10, which dropped the command.

Source

pub fn virtual_wall(&self, id: i32) -> FrankaResult<VirtualWallCuboid>

Robot::getVirtualWall (libfranka 0.9.2 src/robot.cpp:227-231), FCI v5 only.

The 154-byte GetCartesianLimit::Response is mapped exactly as the C++ executeCommand<GetCartesianLimit> specialisation does (src/robot_impl.h:284-300): p_frame is the response’s object_frame, active its object_activation, and id is echoed from the request rather than read off the wire.

§Errors

FrankaError::InvalidOperation on FCI v10, which dropped the command.

Source

pub fn set_collision_behavior( &self, lower_torque_thresholds_acceleration: &[f64; 7], upper_torque_thresholds_acceleration: &[f64; 7], lower_torque_thresholds_nominal: &[f64; 7], upper_torque_thresholds_nominal: &[f64; 7], lower_force_thresholds_acceleration: &[f64; 6], upper_force_thresholds_acceleration: &[f64; 6], lower_force_thresholds_nominal: &[f64; 6], upper_force_thresholds_nominal: &[f64; 6], ) -> FrankaResult<()>

Robot::setCollisionBehavior with all eight threshold arrays.

Source

pub fn set_joint_impedance(&self, K_theta: &[f64; 7]) -> FrankaResult<()>

Robot::setJointImpedance.

Source

pub fn set_cartesian_impedance(&self, K_x: &[f64; 6]) -> FrankaResult<()>

Robot::setCartesianImpedance.

Source

pub fn set_guiding_mode( &self, guiding_mode: &[bool; 6], elbow: bool, ) -> FrankaResult<()>

Robot::setGuidingMode.

Source

pub fn set_k(&self, EE_T_K: &[f64; 16]) -> FrankaResult<()>

Robot::setK.

Source

pub fn set_ee(&self, NE_T_EE: &[f64; 16]) -> FrankaResult<()>

Robot::setEE.

Source

pub fn set_load( &self, load_mass: f64, F_x_Cload: &[f64; 3], load_inertia: &[f64; 9], ) -> FrankaResult<()>

Robot::setLoad.

Source

pub fn automatic_error_recovery(&self) -> FrankaResult<()>

Robot::automaticErrorRecovery.

Source

pub fn stop(&self) -> FrankaResult<()>

Robot::stop: a bare StopMove, callable while a control loop is running.

Source§

impl RobotImpl

Source

pub fn update_motion( &self, motion_command: Option<&MotionGeneratorCommand>, control_command: Option<&ControllerCommand>, ) -> FrankaResult<RobotState>

One control cycle: send the command, wait for the next state, log both (Robot::Impl::updateMotion).

Source

pub fn read_once(&self) -> FrankaResult<RobotState>

Waits for the next state without sending a command (Robot::Impl::readOnce).

Source

pub fn throw_on_motion_error( &self, robot_state: &RobotState, motion_id: u32, ) -> FrankaResult<()>

Detects a motion error and turns the Move reply into a ControlException (Robot::Impl::throwOnMotionError).

Source

pub fn start_motion( &self, controller_mode: MoveControllerMode, motion_generator_mode: MoveMotionGeneratorMode, maximum_path_deviation: Deviation, maximum_goal_pose_deviation: Deviation, ) -> FrankaResult<u32>

Starts a motion (Robot::Impl::startMotion).

Sends Move — 113 bytes on FCI v10 (with use_async_motion_generator = false and zero maximum velocities), 56 on FCI v5, which has neither field — waits for MotionStarted, then spins the control cycle until the state reports the requested modes, polling for an early terminal Move reply on the way.

§Errors

FrankaError::InvalidArgument when motion_generator_mode is MoveMotionGeneratorMode::None on FCI v5, which has no torque-only mode. Torque control on an FER runs a joint-velocity generator commanding zero velocities instead; RobotImpl::torque_only_motion_mode picks the right mode for the caller.

Source

pub fn finish_motion( &self, motion_id: u32, motion_command: Option<&MotionGeneratorCommand>, control_command: Option<&ControllerCommand>, ) -> FrankaResult<()>

Ends a motion regularly (Robot::Impl::finishMotion).

The last command is repeated with the “finished” flag set until the robot leaves the motion, then the terminal Move reply is claimed.

Source

pub fn cancel_motion(&self, motion_id: u32) -> FrankaResult<()>

Aborts a motion (Robot::Impl::cancelMotion).

Sends exactly one StopMove, drains the state stream until the robot is idle again and discards the Move reply if it has already arrived.

Source

pub fn motion_generator_running(&self) -> bool

Whether a motion generator is active according to the last state (Robot::Impl::motionGeneratorRunning).

Source

pub fn controller_running(&self) -> bool

Whether an external controller is active according to the last state (Robot::Impl::controllerRunning).

Source§

impl RobotImpl

Source

pub fn new( franka_address: &str, realtime_config: RealtimeConfig, log_size: usize, ) -> FrankaResult<RobotImpl>

Connects to franka_address and performs libfranka’s full startup sequence with the default VersionPolicy::Auto.

Source

pub fn new_with_policy( franka_address: &str, realtime_config: RealtimeConfig, log_size: usize, policy: VersionPolicy, ) -> FrankaResult<RobotImpl>

RobotImpl::new with an explicit VersionPolicy.

Port of Robot::Impl::Impl for both supported protocol versions: raise the calling thread to the highest realtime priority (fatal only with RealtimeConfig::Enforce), check the kernel, run the Connect handshake and wait for the first robot state.

On FCI v10 the URDF is then fetched with GetRobotModel and the position-dependent joint velocity limits are derived from it, exactly as libfranka 0.21.2 does. FCI v5 has neither command nor envelope — libfranka 0.9.2’s constructor stops after the first state (src/robot_impl.cpp:19-27) — so the FER path skips both.

VersionPolicy::Auto tries FCI v10 first and, if the server answers kIncompatibleLibraryVersion reporting version 5, closes both sockets and reconnects once as FCI v5. Any other server version is returned as the FrankaError::IncompatibleVersion it is.

Source

pub fn version(&self) -> FciVersion

The FCI protocol version this session speaks (Robot::fci_version).

Source

pub fn server_version(&self) -> u16

The FCI version reported by the server (Robot::Impl::serverVersion).

Source

pub fn realtime_config(&self) -> RealtimeConfig

The realtime configuration this instance was created with (Robot::Impl::realtimeConfig).

Source

pub fn robot_model_urdf(&self) -> &str

The URDF fetched at connection time (Robot::Impl::robotModelUrdf).

Source

pub fn upper_joint_velocity_limits(&self, q: &[f64; 7]) -> [f64; 7]

Upper joint velocity limits at q (Robot::Impl::getUpperJointVelocityLimits).

FCI v5 has no position-dependent envelope: libfranka 0.9.2 rate limits against the flat kMaxJointVelocity of include/franka/rate_limiting.h, so q is ignored there.

Source

pub fn lower_joint_velocity_limits(&self, q: &[f64; 7]) -> [f64; 7]

Lower joint velocity limits at q (Robot::Impl::getLowerJointVelocityLimits).

See RobotImpl::upper_joint_velocity_limits for the FCI v5 case.

Source

pub fn load_model_v5(&self) -> FrankaResult<Model>

Loads the FER’s model library over LoadModelLibrary (FCI v5’s Robot::loadModel).

Downloads libfcimodels.so from the robot and binds its thirty symbols (crate::model::load_from_robot).

Trait Implementations§

Source§

impl Debug for RobotImpl

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.