pub struct RobotImpl { /* private fields */ }Expand description
The FCI session plus everything franka::Robot::Impl keeps.
Implementations§
Source§impl RobotImpl
impl RobotImpl
Sourcepub fn get_robot_model(&self) -> FrankaResult<String>
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.
Sourcepub 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<()>
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.
Sourcepub fn virtual_wall(&self, id: i32) -> FrankaResult<VirtualWallCuboid>
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.
Sourcepub 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<()>
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.
Sourcepub fn set_joint_impedance(&self, K_theta: &[f64; 7]) -> FrankaResult<()>
pub fn set_joint_impedance(&self, K_theta: &[f64; 7]) -> FrankaResult<()>
Robot::setJointImpedance.
Sourcepub fn set_cartesian_impedance(&self, K_x: &[f64; 6]) -> FrankaResult<()>
pub fn set_cartesian_impedance(&self, K_x: &[f64; 6]) -> FrankaResult<()>
Robot::setCartesianImpedance.
Sourcepub fn set_guiding_mode(
&self,
guiding_mode: &[bool; 6],
elbow: bool,
) -> FrankaResult<()>
pub fn set_guiding_mode( &self, guiding_mode: &[bool; 6], elbow: bool, ) -> FrankaResult<()>
Robot::setGuidingMode.
Sourcepub fn set_load(
&self,
load_mass: f64,
F_x_Cload: &[f64; 3],
load_inertia: &[f64; 9],
) -> FrankaResult<()>
pub fn set_load( &self, load_mass: f64, F_x_Cload: &[f64; 3], load_inertia: &[f64; 9], ) -> FrankaResult<()>
Robot::setLoad.
Sourcepub fn automatic_error_recovery(&self) -> FrankaResult<()>
pub fn automatic_error_recovery(&self) -> FrankaResult<()>
Robot::automaticErrorRecovery.
Sourcepub fn stop(&self) -> FrankaResult<()>
pub fn stop(&self) -> FrankaResult<()>
Robot::stop: a bare StopMove, callable while a control loop is running.
Source§impl RobotImpl
impl RobotImpl
Sourcepub fn update_motion(
&self,
motion_command: Option<&MotionGeneratorCommand>,
control_command: Option<&ControllerCommand>,
) -> FrankaResult<RobotState>
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).
Sourcepub fn read_once(&self) -> FrankaResult<RobotState>
pub fn read_once(&self) -> FrankaResult<RobotState>
Waits for the next state without sending a command (Robot::Impl::readOnce).
Sourcepub fn throw_on_motion_error(
&self,
robot_state: &RobotState,
motion_id: u32,
) -> FrankaResult<()>
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).
Sourcepub fn start_motion(
&self,
controller_mode: MoveControllerMode,
motion_generator_mode: MoveMotionGeneratorMode,
maximum_path_deviation: Deviation,
maximum_goal_pose_deviation: Deviation,
) -> FrankaResult<u32>
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.
Sourcepub fn finish_motion(
&self,
motion_id: u32,
motion_command: Option<&MotionGeneratorCommand>,
control_command: Option<&ControllerCommand>,
) -> FrankaResult<()>
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.
Sourcepub fn cancel_motion(&self, motion_id: u32) -> FrankaResult<()>
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.
Sourcepub fn motion_generator_running(&self) -> bool
pub fn motion_generator_running(&self) -> bool
Whether a motion generator is active according to the last state
(Robot::Impl::motionGeneratorRunning).
Sourcepub fn controller_running(&self) -> bool
pub fn controller_running(&self) -> bool
Whether an external controller is active according to the last state
(Robot::Impl::controllerRunning).
Source§impl RobotImpl
impl RobotImpl
Sourcepub fn new(
franka_address: &str,
realtime_config: RealtimeConfig,
log_size: usize,
) -> FrankaResult<RobotImpl>
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.
Sourcepub fn new_with_policy(
franka_address: &str,
realtime_config: RealtimeConfig,
log_size: usize,
policy: VersionPolicy,
) -> FrankaResult<RobotImpl>
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.
Sourcepub fn version(&self) -> FciVersion
pub fn version(&self) -> FciVersion
The FCI protocol version this session speaks (Robot::fci_version).
Sourcepub fn server_version(&self) -> u16
pub fn server_version(&self) -> u16
The FCI version reported by the server (Robot::Impl::serverVersion).
Sourcepub fn realtime_config(&self) -> RealtimeConfig
pub fn realtime_config(&self) -> RealtimeConfig
The realtime configuration this instance was created with
(Robot::Impl::realtimeConfig).
Sourcepub fn robot_model_urdf(&self) -> &str
pub fn robot_model_urdf(&self) -> &str
The URDF fetched at connection time (Robot::Impl::robotModelUrdf).
Sourcepub fn upper_joint_velocity_limits(&self, q: &[f64; 7]) -> [f64; 7]
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.
Sourcepub fn lower_joint_velocity_limits(&self, q: &[f64; 7]) -> [f64; 7]
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.
Sourcepub fn load_model_v5(&self) -> FrankaResult<Model>
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§
Auto Trait Implementations§
impl !Freeze for RobotImpl
impl RefUnwindSafe for RobotImpl
impl Send for RobotImpl
impl Sync for RobotImpl
impl Unpin for RobotImpl
impl UnsafeUnpin for RobotImpl
impl UnwindSafe for RobotImpl
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.