Skip to content

Commit

Permalink
move_pt
Browse files Browse the repository at this point in the history
  • Loading branch information
rise0chen committed Jun 7, 2024
1 parent 7f80a13 commit 2df8aa2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
13 changes: 9 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub mod lebai_sdk {
#[classmethod]
#[cmod::tags(args(pose, refer))]
pub async fn save_pose(&self, name: String, pose: Option<Pose>, dir: Option<String>, refer: Option<JointPose>) -> Result<()> {
self.0.save_pose(name, pose, dir,refer).await
self.0.save_pose(name, pose, dir, refer).await
}
#[classmethod]
#[cmod::tags(ret)]
Expand Down Expand Up @@ -169,14 +169,19 @@ pub mod lebai_sdk {
self.0.movec(via, p, rad, a, v, t, r).await
}
#[classmethod]
#[cmod::tags(args(p, v, a))]
pub async fn move_pvat(&self, p: JointPose, v: Vec<f64>, a: Vec<f64>, t: f64) -> Result<()> {
self.0.move_pvat(p, v, a, t).await
}
#[classmethod]
#[cmod::tags(args(p, v))]
pub async fn move_pvt(&self, p: JointPose, v: Vec<f64>, t: f64) -> Result<()> {
self.0.move_pvt(p, v, t).await
}
#[classmethod]
#[cmod::tags(args(p, v, a))]
pub async fn move_pvat(&self, p: JointPose, v: Vec<f64>, a: Vec<f64>, t: f64) -> Result<()> {
self.0.move_pvat(p, v, a, t).await
#[cmod::tags(args(p))]
pub async fn move_pt(&self, p: JointPose, t: f64) -> Result<()> {
self.0.move_pt(p, t).await
}
#[classmethod]
pub async fn move_trajectory(&self, name: String, dir: Option<String>) -> Result<u32> {
Expand Down
20 changes: 17 additions & 3 deletions src/rpc/motion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,19 @@ impl Robot {
Ok(id.id)
}

pub async fn move_pvat(&self, p: JointPose, v: Vec<f64>, a: Vec<f64>, t: f64) -> Result<()> {
let mut joints = Vec::new();
for i in 0..p.0.len() {
joints.push(JointMove {
pose: p.0[i],
velocity: v.get(i).copied(),
acc: a.get(i).copied(),
})
}
let req = MovePvatRequest { duration: t, joints };
self.c.move_pvat(Some(req)).await.map_err(|e| e.to_string())?;
Ok(())
}
pub async fn move_pvt(&self, p: JointPose, v: Vec<f64>, t: f64) -> Result<()> {
let mut joints = Vec::new();
for i in 0..p.0.len() {
Expand All @@ -109,19 +122,20 @@ impl Robot {
self.c.move_pvat(Some(req)).await.map_err(|e| e.to_string())?;
Ok(())
}
pub async fn move_pvat(&self, p: JointPose, v: Vec<f64>, a: Vec<f64>, t: f64) -> Result<()> {
pub async fn move_pt(&self, p: JointPose, t: f64) -> Result<()> {
let mut joints = Vec::new();
for i in 0..p.0.len() {
joints.push(JointMove {
pose: p.0[i],
velocity: v.get(i).copied(),
acc: a.get(i).copied(),
velocity: None,
acc: None,
})
}
let req = MovePvatRequest { duration: t, joints };
self.c.move_pvat(Some(req)).await.map_err(|e| e.to_string())?;
Ok(())
}

pub async fn move_trajectory(&self, name: String, dir: Option<String>) -> Result<u32> {
let req = LoadRequest {
name,
Expand Down

0 comments on commit 2df8aa2

Please sign in to comment.