Skip to content

Commit

Permalink
added support to callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
samuel-cavalcanti committed Oct 14, 2023
1 parent ccb53ac commit 0733285
Show file tree
Hide file tree
Showing 20 changed files with 372 additions and 132 deletions.
3 changes: 3 additions & 0 deletions c_transpiler/assets/sim_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ def subtractObjectFromOctree(self,octreeHandle:int, objectHandle:int, options:in
def subtractObjectFromPointCloud(self,pointCloudHandle:int, objectHandle:int, options:int, tolerance:float)->int:
...

def testCB(self,a:int, cb:str, b:int)->int:
...

def textEditorClose(self,handle:int)->tuple[str, list[int], list[int]]:
...

Expand Down
1 change: 1 addition & 0 deletions c_transpiler/assets/sim_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ pub trait Sim : RemoteApiClientInterface {
(sim_stop_simulation,"stopSimulation"->i64),
(sim_subtract_object_from_octree,"subtractObjectFromOctree",(octree_handle:i64,object_handle:i64,options:i64)->i64),
(sim_subtract_object_from_point_cloud,"subtractObjectFromPointCloud",(point_cloud_handle:i64,object_handle:i64,options:i64,tolerance:f64)->i64),
(sim_test_cb,"testCB",(a:i64,cb:String,b:i64)->i64),
(sim_text_editor_close,"textEditorClose",(handle:i64)->(String,Vec<i64>,Vec<i64>)),
(sim_text_editor_get_info,"textEditorGetInfo",(handle:i64)->(String,Vec<i64>,Vec<i64>,bool)),
(sim_text_editor_open,"textEditorOpen",(init_text:String,properties:String)->i64),
Expand Down
1 change: 1 addition & 0 deletions c_transpiler/assets/sim_api_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ int64_t subtractObjectFromOctree(int64_t octreeHandle, int64_t objectHandle,
int64_t subtractObjectFromPointCloud(int64_t pointCloudHandle,
int64_t objectHandle, int64_t options,
double tolerance);
int64_t testCB(int64_t a, std::string cb, int64_t b);
std::tuple<std::string, std::vector<int64_t>, std::vector<int64_t>>
textEditorClose(int64_t handle);
std::tuple<std::string, std::vector<int64_t>, std::vector<int64_t>, bool>
Expand Down
12 changes: 6 additions & 6 deletions c_transpiler/assets/sim_ik_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,16 @@ def getJointWeight(self,environmentHandle:int, jointHandle:int)->float:
def getObjectHandle(self,environmentHandle:int, objectName:str)->int:
...

def getObjectMatrix(self,environmentHandle:int, objectHandle:int, relativeToObjectHandle:int)->list[float]:
def getObjectMatrix(self,environmentHandle:int, objectHandle:int, relativeToObjectHandle:Optional[int] = None)->list[float]:
...

def getObjectParent(self,environmentHandle:int, objectHandle:int)->int:
...

def getObjectPose(self,environmentHandle:int, objectHandle:int, relativeToObjectHandle:int)->list[float]:
def getObjectPose(self,environmentHandle:int, objectHandle:int, relativeToObjectHandle:Optional[int] = None)->list[float]:
...

def getObjectTransformation(self,environmentHandle:int, objectHandle:int, relativeToObjectHandle:int)->tuple[list[float], list[float], list[float]]:
def getObjectTransformation(self,environmentHandle:int, objectHandle:int, relativeToObjectHandle:Optional[int] = None)->tuple[list[float], list[float], list[float]]:
...

def getObjectType(self,environmentHandle:int, objectHandle:int)->int:
Expand Down Expand Up @@ -204,16 +204,16 @@ def setJointScrewLead(self,environmentHandle:int, jointHandle:int, lead:float)->
def setJointWeight(self,environmentHandle:int, jointHandle:int, weight:float)->None:
...

def setObjectMatrix(self,environmentHandle:int, objectHandle:int, relativeToObjectHandle:int, matrix:list[float])->None:
def setObjectMatrix(self,environmentHandle:int, objectHandle:int, matrix:list[float], relativeToObjectHandle:Optional[int] = None)->None:
...

def setObjectParent(self,environmentHandle:int, objectHandle:int, parentObjectHandle:int, keepInPlace:Optional[bool] = None)->None:
...

def setObjectPose(self,environmentHandle:int, objectHandle:int, relativeToObjectHandle:int, pose:list[float])->None:
def setObjectPose(self,environmentHandle:int, objectHandle:int, pose:list[float], relativeToObjectHandle:Optional[int] = None)->None:
...

def setObjectTransformation(self,environmentHandle:int, objectHandle:int, relativeToObjectHandle:int, position:list[float], eulerOrQuaternion:list[float])->None:
def setObjectTransformation(self,environmentHandle:int, objectHandle:int, position:list[float], eulerOrQuaternion:list[float], relativeToObjectHandle:Optional[int] = None)->None:
...

def setSphericalJointMatrix(self,environmentHandle:int, jointHandle:int, matrix:list[float])->None:
Expand Down
12 changes: 6 additions & 6 deletions c_transpiler/assets/sim_ik_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ pub trait SimIK : RemoteApiClientInterface {
(sim_ik_get_joint_type,"getJointType",(environment_handle:i64,joint_handle:i64)->i64),
(sim_ik_get_joint_weight,"getJointWeight",(environment_handle:i64,joint_handle:i64)->f64),
(sim_ik_get_object_handle,"getObjectHandle",(environment_handle:i64,object_name:String)->i64),
(sim_ik_get_object_matrix,"getObjectMatrix",(environment_handle:i64,object_handle:i64,relative_to_object_handle:i64)->Vec<f64>),
(sim_ik_get_object_matrix,"getObjectMatrix",(environment_handle:i64,object_handle:i64),opt(relative_to_object_handle:i64)->Vec<f64>),
(sim_ik_get_object_parent,"getObjectParent",(environment_handle:i64,object_handle:i64)->i64),
(sim_ik_get_object_pose,"getObjectPose",(environment_handle:i64,object_handle:i64,relative_to_object_handle:i64)->Vec<f64>),
(sim_ik_get_object_transformation,"getObjectTransformation",(environment_handle:i64,object_handle:i64,relative_to_object_handle:i64)->(Vec<f64>,Vec<f64>,Vec<f64>)),
(sim_ik_get_object_pose,"getObjectPose",(environment_handle:i64,object_handle:i64),opt(relative_to_object_handle:i64)->Vec<f64>),
(sim_ik_get_object_transformation,"getObjectTransformation",(environment_handle:i64,object_handle:i64),opt(relative_to_object_handle:i64)->(Vec<f64>,Vec<f64>,Vec<f64>)),
(sim_ik_get_object_type,"getObjectType",(environment_handle:i64,object_handle:i64)->i64),
(sim_ik_get_objects,"getObjects",(environment_handle:i64,index:i64)->(i64,String,bool,i64)),
(sim_ik_get_target_dummy,"getTargetDummy",(environment_handle:i64,dummy_handle:i64)->i64),
Expand All @@ -69,10 +69,10 @@ pub trait SimIK : RemoteApiClientInterface {
(sim_ik_set_joint_position,"setJointPosition",(environment_handle:i64,joint_handle:i64,position:f64)->()),
(sim_ik_set_joint_screw_lead,"setJointScrewLead",(environment_handle:i64,joint_handle:i64,lead:f64)->()),
(sim_ik_set_joint_weight,"setJointWeight",(environment_handle:i64,joint_handle:i64,weight:f64)->()),
(sim_ik_set_object_matrix,"setObjectMatrix",(environment_handle:i64,object_handle:i64,relative_to_object_handle:i64,matrix:Vec<f64>)->()),
(sim_ik_set_object_matrix,"setObjectMatrix",(environment_handle:i64,object_handle:i64,matrix:Vec<f64>),opt(relative_to_object_handle:i64)->()),
(sim_ik_set_object_parent,"setObjectParent",(environment_handle:i64,object_handle:i64,parent_object_handle:i64),opt(keep_in_place:bool)->()),
(sim_ik_set_object_pose,"setObjectPose",(environment_handle:i64,object_handle:i64,relative_to_object_handle:i64,pose:Vec<f64>)->()),
(sim_ik_set_object_transformation,"setObjectTransformation",(environment_handle:i64,object_handle:i64,relative_to_object_handle:i64,position:Vec<f64>,euler_or_quaternion:Vec<f64>)->()),
(sim_ik_set_object_pose,"setObjectPose",(environment_handle:i64,object_handle:i64,pose:Vec<f64>),opt(relative_to_object_handle:i64)->()),
(sim_ik_set_object_transformation,"setObjectTransformation",(environment_handle:i64,object_handle:i64,position:Vec<f64>,euler_or_quaternion:Vec<f64>),opt(relative_to_object_handle:i64)->()),
(sim_ik_set_spherical_joint_matrix,"setSphericalJointMatrix",(environment_handle:i64,joint_handle:i64,matrix:Vec<f64>)->()),
(sim_ik_set_spherical_joint_rotation,"setSphericalJointRotation",(environment_handle:i64,joint_handle:i64,euler_or_quaternion:Vec<f64>)->()),
(sim_ik_set_target_dummy,"setTargetDummy",(environment_handle:i64,dummy_handle:i64,target_dummy_handle:i64)->()),
Expand Down
Loading

0 comments on commit 0733285

Please sign in to comment.