From aebc050ec08d22f664f2daaf833cc97f32f84046 Mon Sep 17 00:00:00 2001 From: Bourumir Wyngs Date: Tue, 21 May 2024 19:57:53 +0200 Subject: [PATCH] Going for 1.2.0 --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 4 ++-- src/main.rs | 69 +++++++++++++++++++++++++++++++---------------------- 4 files changed, 44 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 643f6dd..fa4b4bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -404,7 +404,7 @@ checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "rs-opw-kinematics" -version = "1.1.2-alpha.1" +version = "1.2.1" dependencies = [ "clap", "nalgebra", diff --git a/Cargo.toml b/Cargo.toml index a821741..ffd56c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-opw-kinematics" -version = "1.2.1" +version = "1.2.0" edition = "2021" authors = ["Bourumir Wyngs "] description = "Inverse and forward kinematics for 6 axis robots with a parallel base and spherical wrist." diff --git a/README.md b/README.md index 012827f..67f4524 100644 --- a/README.md +++ b/README.md @@ -172,13 +172,13 @@ function that sometimes occurs there: let robot = OPWKinematics::new(parameters); ``` -Since version 1.2.1, parameters and constraints can also be directly extracted from URDF file: +Since version 1.2.0, parameters and constraints can also be directly extracted from URDF file: ```Rust let robot = rs_opw_kinematics::urdf::from_urdf_file("/path/to/robot.urdf"); println!("Reading:\n{}", ¶meters.to_yaml()); ``` -There is also more advanced function [rs_opw_kinematics::urdf::from_urdf](https://docs.rs/rs-opw-kinematics/1.2.1/rs_opw_kinematics/urdf/fn.from_urdf.html) +There is also more advanced function [rs_opw_kinematics::urdf::from_urdf](https://docs.rs/rs-opw-kinematics/1.2.0/rs_opw_kinematics/urdf/fn.from_urdf.html) that takes URDF string rather than the file, provides error handling and much more control over how the solver is constructed from the extracted values. diff --git a/src/main.rs b/src/main.rs index af07fc0..1b88e2d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,18 +1,42 @@ -use clap::{Parser}; -use std::fs::File; -use std::io::{self, Read}; -use rs_opw_kinematics::constraints::BY_PREV; -use rs_opw_kinematics::kinematic_traits::JOINTS_AT_ZERO; -use rs_opw_kinematics::urdf; - -#[derive(Parser)] -#[command(author, version, about, long_about = None)] -struct Cli { - /// The file to read - file: Option, -} +const VERSION: &str = "1.2.0"; +#[cfg(feature = "allow_filesystem")] fn main() { + use clap::{Parser}; + use std::fs::File; + use std::io::{self, Read}; + use rs_opw_kinematics::constraints::BY_PREV; + use rs_opw_kinematics::kinematic_traits::JOINTS_AT_ZERO; + use rs_opw_kinematics::urdf; + + fn print_usage() { + println!("This command line utility extracts OPW parameters \ + \nfor OPW robots from URDF or XACRO files. \ + \n\nIf XACRO file is used, it must contain joint descriptions directly, file \ + \ninclusions are not followed. The function ${{radians(degrees)}} is supported. \ + \nWhile both parameters and constraints are printed out, constraints are not \ + \npart of the OPW parameters. \ + \n\nThis tool is Free software under BSD 3, hosted in repository \ + \nhttps://github.com/bourumir-wyngs/rs-opw-kinematics\n"); + println!("Usage: rs-opw-kinematics urdf_file.urdf"); + } + + fn read_file(file_name: &str) -> io::Result { + let mut file = File::open(file_name)?; + let mut content = String::new(); + file.read_to_string(&mut content)?; + Ok(content) + } + + #[derive(Parser)] + #[command(author, version, about, long_about = None)] + struct Cli { + /// The file to read + file: Option, + } + + println!("rs-opw-kinematics URDF extractor {VERSION} by Bourumir Wyngs.\n"); + let cli = Cli::parse(); if let Some(file_name) = cli.file { @@ -35,21 +59,8 @@ fn main() { } } -fn read_file(file_name: &str) -> io::Result { - let mut file = File::open(file_name)?; - let mut content = String::new(); - file.read_to_string(&mut content)?; - Ok(content) +#[cfg(not(feature = "allow_filesystem"))] +fn main() { + println!("rs-opw-kinematics {VERSION}, CLI not built."); } -fn print_usage() { - println!("This command line utility extracts OPW parameters \ - \nfor OPW robots from URDF or XACRO files. \ - \n\nIf XACRO file is used, it must contain joint descriptions directly, file \ - \ninclusions are not followed. The function ${{radians(degrees)}} is supported. \ - \nWhile both parameters and constraints are printed out, constraints are not \ - \npart of the OPW parameters. \ - \n\nThis tool is Free software under BSD 3, hosted in repository \ - \nhttps://github.com/bourumir-wyngs/rs-opw-kinematics\n"); - println!("Usage: rs-opw-kinematics urdf_file.urdf"); -}