Skip to content

Commit

Permalink
feat: pose_add
Browse files Browse the repository at this point in the history
  • Loading branch information
rise0chen committed Jun 7, 2023
1 parent f80641f commit 1987b38
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ pub mod lebai_sdk {
}
#[classmethod]
#[cmod::tags(args(pose, frame, delta), ret)]
pub async fn pose_add(&self, pose: Pose, frame: CartesianPose, delta: CartesianPose) -> Result<CartesianPose> {
self.0.pose_add(pose, frame, delta).await
pub async fn pose_add(&self, pose: Pose, delta: CartesianPose, frame: Option<CartesianPose>) -> Result<CartesianPose> {
self.0.pose_add(pose, delta, frame).await
}
#[classmethod]
#[cmod::tags(args(p), ret)]
Expand Down
14 changes: 7 additions & 7 deletions src/rpc/posture.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::Robot;
use cmod::Result;
use proto::lebai::db::*;
use proto::lebai::posture::*;
use proto::lebai::posture::{self, *};
use proto::posture::{CartesianPose, JointPose, Pose};

impl Robot {
Expand All @@ -26,15 +26,15 @@ impl Robot {
let pose = self.c.get_pose_trans(Some(req)).await.map_err(|e| e.to_string())?;
Ok(pose.into())
}
pub async fn pose_add(&self, pose: Pose, frame: CartesianPose, delta: CartesianPose) -> Result<CartesianPose> {
let delta = Pose::Cart(delta).into();
let mut req = GetPoseAddRequest {
pub async fn pose_add(&self, pose: Pose, delta: CartesianPose, frame: Option<CartesianPose>) -> Result<CartesianPose> {
let mut delta: posture::Pose = Pose::Cart(delta).into();
if let Some(frame) = frame {
delta.cart_frame = Some(frame.into());
}
let req = GetPoseAddRequest {
pose: Some(pose.into()),
delta: Some(delta),
};
if let Some(delta) = &mut req.delta {
delta.cart_frame = Some(frame.into());
}
let pose = self.c.get_pose_add(Some(req)).await.map_err(|e| e.to_string())?;
Ok(pose.into())
}
Expand Down

0 comments on commit 1987b38

Please sign in to comment.