pub struct Model { /* private fields */ }Expand description
Poses of the joints and dynamic properties of the robot.
Port of franka::Model. Obtain one from Robot::load_model, or build one
directly from a URDF with Model::from_urdf.
Implementations§
Source§impl Model
impl Model
Sourcepub unsafe fn from_model_library_bytes(bytes: &[u8]) -> FrankaResult<Model>
pub unsafe fn from_model_library_bytes(bytes: &[u8]) -> FrankaResult<Model>
Builds a model from the bytes of a libfcimodels shared object.
The offline twin of load_from_robot: same temp-file lifecycle (a
0600 file under std::env::temp_dir, removed when the model is
dropped), no network. Useful for a captured library and for tests.
§Safety
The bytes are written to a temporary file and dlopened, which executes
the shared object’s initialisers and, afterwards, its exported entry
points in this process. The caller asserts that bytes are a trusted
libfcimodels build for the current platform — served by a Franka
control unit, or captured from one and kept where only trusted
principals can write. See SoModelBackend::from_bytes.
§Errors
FrankaError::Model when the file cannot be written, dlopened, or
when any of the thirty libfcimodels symbols is missing.
Sourcepub unsafe fn from_model_library_path(path: &Path) -> FrankaResult<Model>
pub unsafe fn from_model_library_path(path: &Path) -> FrankaResult<Model>
Builds a model from a libfcimodels shared object already on disk.
Unlike Model::from_model_library_bytes the file is left alone when
the model is dropped.
§Safety
The file is dlopened, which executes its code in this process. The
caller asserts that path names a trusted libfcimodels build for
the current platform and that it cannot be swapped before the load. See
SoModelBackend::open.
§Errors
FrankaError::Model when the file cannot be dlopened or when any of
the thirty libfcimodels symbols is missing.
Source§impl Model
impl Model
Sourcepub fn from_urdf(urdf: &str) -> FrankaResult<Model>
pub fn from_urdf(urdf: &str) -> FrankaResult<Model>
Builds a model from a URDF string using the native backend.
Port of franka::Model::Model(const std::string&).
§Errors
crate::FrankaError::Model if the URDF cannot be parsed or does not
describe a seven-axis arm ending in a link8 flange frame.
Sourcepub fn native_fer() -> Model
pub fn native_fer() -> Model
Builds the Franka Emika Robot (FER)’s model, without asking a robot for it.
This is the FCI v5 counterpart of what Model::from_urdf does with an
FR3’s GetRobotModel answer: it is the native backend over
FER_URDF, whose parameters were identified from an FER’s own
libfcimodels_x64.so. It needs no download, no dlopen, no
model-library feature and no x86-64 Linux host, and it is what
crate::Robot::load_model returns on an FER.
Agreement with the shared object, over 208 joint configurations
(see docs/book/src/reference/model.md): poses and both Jacobians to 9e-16 at
all ten frames, gravity to 5e-14 with any payload, and the mass matrix
and Coriolis vector to 4e-14 with no payload. With a payload the mass
matrix and Coriolis vector differ by up to 3e-3 and 5e-2, because the
robot’s own M_NE is not affine in m_load and therefore is not a
rigid-body model of the payload; see docs/book/src/reference/model.md. Use
crate::Robot::load_model_from_robot when you need the library’s own
answer to the last bit.
§Panics
Never: FER_URDF is compiled in and a unit test parses it.
Sourcepub fn from_backend(backend: Box<dyn RobotModelBackend + Send + Sync>) -> Model
pub fn from_backend(backend: Box<dyn RobotModelBackend + Send + Sync>) -> Model
Builds a model around an explicit backend.
Port of franka::Model::Model(std::unique_ptr<RobotModelBase>), which
libfranka provides for its own tests; the conformance suite uses it to
run the evaluation backends through the same API.
Sourcepub fn backend(&self) -> &(dyn RobotModelBackend + Send + Sync)
pub fn backend(&self) -> &(dyn RobotModelBackend + Send + Sync)
Borrows the underlying backend.
Sourcepub fn pose(&self, frame: Frame, state: &RobotState) -> [f64; 16]
pub fn pose(&self, frame: Frame, state: &RobotState) -> [f64; 16]
4x4 pose matrix of frame in the base frame, column-major.
Port of franka::Model::pose(Frame, const RobotState&).
Sourcepub fn pose_q(
&self,
frame: Frame,
q: &[f64; 7],
F_T_EE: &[f64; 16],
EE_T_K: &[f64; 16],
) -> [f64; 16]
pub fn pose_q( &self, frame: Frame, q: &[f64; 7], F_T_EE: &[f64; 16], EE_T_K: &[f64; 16], ) -> [f64; 16]
4x4 pose matrix of frame in the base frame, column-major.
Port of franka::Model::pose(Frame, q, F_T_EE, EE_T_K).
Sourcepub fn body_jacobian(&self, frame: Frame, state: &RobotState) -> [f64; 42]
pub fn body_jacobian(&self, frame: Frame, state: &RobotState) -> [f64; 42]
6x7 body Jacobian of frame, column-major, relative to frame itself.
Port of franka::Model::bodyJacobian(Frame, const RobotState&).
Sourcepub fn body_jacobian_q(
&self,
frame: Frame,
q: &[f64; 7],
F_T_EE: &[f64; 16],
EE_T_K: &[f64; 16],
) -> [f64; 42]
pub fn body_jacobian_q( &self, frame: Frame, q: &[f64; 7], F_T_EE: &[f64; 16], EE_T_K: &[f64; 16], ) -> [f64; 42]
6x7 body Jacobian of frame, column-major, relative to frame itself.
Port of franka::Model::bodyJacobian(Frame, q, F_T_EE, EE_T_K).
Sourcepub fn zero_jacobian(&self, frame: Frame, state: &RobotState) -> [f64; 42]
pub fn zero_jacobian(&self, frame: Frame, state: &RobotState) -> [f64; 42]
6x7 zero Jacobian of frame, column-major, relative to the base frame.
Port of franka::Model::zeroJacobian(Frame, const RobotState&).
Sourcepub fn zero_jacobian_q(
&self,
frame: Frame,
q: &[f64; 7],
F_T_EE: &[f64; 16],
EE_T_K: &[f64; 16],
) -> [f64; 42]
pub fn zero_jacobian_q( &self, frame: Frame, q: &[f64; 7], F_T_EE: &[f64; 16], EE_T_K: &[f64; 16], ) -> [f64; 42]
6x7 zero Jacobian of frame, column-major, relative to the base frame.
Port of franka::Model::zeroJacobian(Frame, q, F_T_EE, EE_T_K).
Sourcepub fn mass(&self, state: &RobotState) -> [f64; 49]
pub fn mass(&self, state: &RobotState) -> [f64; 49]
7x7 mass matrix, column-major, in kg * m^2.
Port of franka::Model::mass(const RobotState&).
Sourcepub fn mass_q(
&self,
q: &[f64; 7],
I_total: &[f64; 9],
m_total: f64,
F_x_Ctotal: &[f64; 3],
) -> [f64; 49]
pub fn mass_q( &self, q: &[f64; 7], I_total: &[f64; 9], m_total: f64, F_x_Ctotal: &[f64; 3], ) -> [f64; 49]
7x7 mass matrix, column-major, in kg * m^2.
Port of franka::Model::mass(q, I_total, m_total, F_x_Ctotal).
Sourcepub fn coriolis(&self, state: &RobotState) -> [f64; 7]
pub fn coriolis(&self, state: &RobotState) -> [f64; 7]
Coriolis force vector, in Nm, with Earth’s gravity {0, 0, -9.81}.
Port of franka::Model::coriolis(const RobotState&), which forwards to
the deprecated RobotModel::coriolis overload that hard-codes that
gravity vector.
Sourcepub fn coriolis_q(
&self,
q: &[f64; 7],
dq: &[f64; 7],
I_total: &[f64; 9],
m_total: f64,
F_x_Ctotal: &[f64; 3],
gravity_earth: &[f64; 3],
) -> [f64; 7]
pub fn coriolis_q( &self, q: &[f64; 7], dq: &[f64; 7], I_total: &[f64; 9], m_total: f64, F_x_Ctotal: &[f64; 3], gravity_earth: &[f64; 3], ) -> [f64; 7]
Coriolis force vector, in Nm.
Port of franka::Model::coriolis(q, dq, I_total, m_total, F_x_Ctotal, gravity_earth).
Sourcepub fn gravity(&self, state: &RobotState) -> [f64; 7]
pub fn gravity(&self, state: &RobotState) -> [f64; 7]
Gravity torque vector, in Nm, using the state’s O_ddP_O as Earth’s gravity.
Port of franka::Model::gravity(const RobotState&).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Model
impl !UnwindSafe for Model
impl Freeze for Model
impl Send for Model
impl Sync for Model
impl Unpin for Model
impl UnsafeUnpin for Model
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.