Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spherical joint support + update dependencies #1

Merged
merged 5 commits into from
May 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ repository = "https://github.com/OTL/urdf-rs"
documentation = "http://docs.rs/urdf-rs"

[dependencies]
serde-xml-rs = "0.1.2"
serde = "0.9.7"
serde_derive = "0.9.7"
serde-xml-rs = "0.3.1"
serde = "1.0.89"
serde_derive = "1.0.89"
RustyXML = "0.1.1"
regex = "0.1"
regex = "1.1.2"
10 changes: 6 additions & 4 deletions src/deserialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub enum Geometry {
size: [f64; 3],
},
Cylinder { radius: f64, length: f64 },
Capsule { radius: f64, length: f64 },
Sphere { radius: f64 },
Mesh {
filename: String,
Expand Down Expand Up @@ -124,9 +125,9 @@ pub struct Vec3 {

mod urdf_vec3 {
use serde::{self, Deserialize, Deserializer};
pub fn deserialize<D>(deserializer: D) -> Result<[f64; 3], D::Error>
pub fn deserialize<'a,D>(deserializer: D) -> Result<[f64; 3], D::Error>
where
D: Deserializer,
D: Deserializer<'a>,
{
let s = String::deserialize(deserializer)?;
let vec = s.split(' ')
Expand All @@ -147,9 +148,9 @@ mod urdf_vec3 {

mod urdf_vec4 {
use serde::{self, Deserialize, Deserializer};
pub fn deserialize<D>(deserializer: D) -> Result<[f64; 4], D::Error>
pub fn deserialize<'a,D>(deserializer: D) -> Result<[f64; 4], D::Error>
where
D: Deserializer,
D: Deserializer<'a>,
{
let s = String::deserialize(deserializer)?;
let vec = s.split(' ')
Expand Down Expand Up @@ -222,6 +223,7 @@ pub enum JointType {
Fixed,
Floating,
Planar,
Spherical,
}

#[derive(Debug, Deserialize, Default, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion src/funcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub fn read_file<P: AsRef<Path>>(path: P) -> Result<Robot> {

pub fn read_from_string(string: &str) -> Result<Robot> {
let sorted_string = sort_link_joint(string)?;
serde_xml_rs::deserialize(sorted_string.as_bytes()).map_err(From::from)
serde_xml_rs::from_str(&sorted_string).map_err(From::from)
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub fn expand_package_path(filename: &str, base_dir: Option<&Path>) -> String {
Some(found_path) => found_path + "/",
None => panic!("failed to find ros package {}", &ma[1]),
},
)
).to_string()
} else {
let mut relative_path_from_urdf = base_dir.unwrap_or(Path::new("")).to_owned();
relative_path_from_urdf.push(filename);
Expand Down