diff --git a/src/lib.rs b/src/lib.rs index 19ebb9e..04fe5e8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -122,7 +122,7 @@ pub fn objective( let tfm_error = tfm_target.inverse() * tfm_actual; if let Some(g) = grad { - let grad = robot.ee_error_grad(&tfm_target, &tfm_actual, x, GradientMode::Analytical); + let grad = robot.ee_error_grad(tfm_target, &tfm_actual, x, GradientMode::Analytical); g.copy_from_slice(grad.as_slice()); } diff --git a/src/py.rs b/src/py.rs index b3977ac..bc81e0c 100644 --- a/src/py.rs +++ b/src/py.rs @@ -3,7 +3,7 @@ use nalgebra::{Isometry3, Matrix4, Translation3, UnitQuaternion}; use pyo3::prelude::*; use rayon::ThreadPoolBuilder; -use crate::{config::SolverConfig, solve, GradientMode, Robot, SolutionMode, SolverResult}; +use crate::{config::SolverConfig, solve, GradientMode, Robot, SolutionMode}; #[pymethods] impl SolverConfig { @@ -50,10 +50,10 @@ fn load_model(path: &str, base_link: &str, ee_link: &str) -> PyRobot { let base_link = chain .find_link(base_link) - .expect(&format!("'{}' does not exist!", base_link)); + .unwrap_or_else(|| panic!("link '{}' does not exist!", base_link)); let ee_link = chain .find_link(ee_link) - .expect(&format!("'{}' does not exist!", ee_link)); + .unwrap_or_else(|| panic!("link '{}' does not exist!", ee_link)); let serial = k::SerialChain::from_end_to_root(ee_link, base_link); PyRobot(Robot::new(serial)) @@ -103,7 +103,6 @@ fn optik(_py: Python<'_>, m: &PyModule) -> PyResult<()> { m.add_class::()?; m.add_class::()?; m.add_class::()?; - m.add_class::()?; m.add_function(wrap_pyfunction!(set_parallelism, m)?)?; m.add_function(wrap_pyfunction!(load_model, m)?)?; m.add_function(wrap_pyfunction!(random_pose, m)?)?;