Skip to content

Commit

Permalink
feat: save pose
Browse files Browse the repository at this point in the history
  • Loading branch information
rise0chen committed Jan 24, 2024
1 parent 8d7c8d1 commit 3932afe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ pub mod lebai_sdk {
self.0.pose_inverse(p).await
}
#[classmethod]
#[cmod::tags(args(pose))]
pub async fn save_pose(&self, name: String, pose: Pose, dir: Option<String>) -> Result<()> {
self.0.save_pose(name, pose, dir).await
}
#[classmethod]
#[cmod::tags(ret)]
pub async fn load_pose(&self, name: String, dir: Option<String>) -> Result<Pose> {
self.0.load_pose(name, dir).await
Expand Down
9 changes: 9 additions & 0 deletions src/rpc/posture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ impl Robot {
Ok(pose.into())
}

pub async fn save_pose(&self, name: String, pose: Pose, dir: Option<String>) -> Result<()> {
let req = SavePoseRequest {
name,
dir: dir.unwrap_or_default(),
data: Some(pose.into()),
};
self.c.save_pose(Some(req)).await.map_err(|e| e.to_string())?;
Ok(())
}
pub async fn load_pose(&self, name: String, dir: Option<String>) -> Result<Pose> {
let req = LoadRequest {
name,
Expand Down

0 comments on commit 3932afe

Please sign in to comment.