forked from weigao95/yaik
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpp_codegen.py
More file actions
21 lines (16 loc) · 736 Bytes
/
Copy pathcpp_codegen.py
File metadata and controls
21 lines (16 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from codegen.cpp_codegen.codegen_cpp import generate_code_cpp
from typing import Optional
def run_cpp_codegen(tree_yaml_path: Optional[str] = None, use_safe_operator: bool = True):
# Make the tree
import yaml
from codegen.skeleton.tree_serialize import TreeSerializer
if tree_yaml_path is None:
tree_yaml_path = './gallery/spherical_wrist_six_axis/spherical_wrist_six_axis_ik.yaml'
with open(tree_yaml_path, 'r') as read_stream:
data_map = yaml.load(read_stream, Loader=yaml.CLoader)
read_stream.close()
# Run codegen
tree = TreeSerializer.load_skeleton_tree(data_map)
generate_code_cpp(tree, use_safe_operator=use_safe_operator)
if __name__ == '__main__':
run_cpp_codegen()