Skip to content

Commit

Permalink
Going for 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bourumir-wyngs committed May 21, 2024
1 parent 3a683d8 commit aebc050
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rs-opw-kinematics"
version = "1.2.1"
version = "1.2.0"
edition = "2021"
authors = ["Bourumir Wyngs <bourumir.wyngs@gmail.com>"]
description = "Inverse and forward kinematics for 6 axis robots with a parallel base and spherical wrist."
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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{}", &parameters.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.

Expand Down
69 changes: 40 additions & 29 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -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<String>,
}
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<String> {
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<String>,
}

println!("rs-opw-kinematics URDF extractor {VERSION} by Bourumir Wyngs.\n");

let cli = Cli::parse();

if let Some(file_name) = cli.file {
Expand All @@ -35,21 +59,8 @@ fn main() {
}
}

fn read_file(file_name: &str) -> io::Result<String> {
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");
}

0 comments on commit aebc050

Please sign in to comment.