Skip to content

Commit

Permalink
upload code for plots and animations
Browse files Browse the repository at this point in the history
  • Loading branch information
fxxie2 committed Dec 4, 2024
1 parent f9ac502 commit c571050
Show file tree
Hide file tree
Showing 53 changed files with 7,053 additions and 0 deletions.
Binary file added paper/images/a1/a1-C2-symmetries_anim_static.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paper/images/a1/animation-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paper/images/a1/animation-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paper/images/a1/animation-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paper/images/a1/back_view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paper/images/a1/single_view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paper/images/solo/animation-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paper/images/solo/animation-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paper/images/solo/animation-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paper/images/solo/back_view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paper/images/solo/single_view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 86 additions & 0 deletions utils/cfg/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@

defaults:
- _self_
- dataset: com_momentum
- model: emlp
- robot: solo
- override hydra/launcher: joblib


# TODO: Make distinctions between. Trainer Args, Model Psecific Args, Program Args
#robot: 'solo12'
seed: -1
exp_name: 'tests'

device: 0
num_workers: 0 # Dataloader workers

debug: False
debug_loops: False
use_volatile: False

# Hydra configuration _________

hydra:
run:
dir: ./morpho_symm/experiments/${hydra.job.name}/${hydra.job.override_dirname}

job:
# TODO: Reorganize output dir
chdir: True # Create a new directory for each run
name: ${dataset.job_name}
num: ${seed}
env_set:
XLA_PYTHON_CLIENT_PREALLOCATE: 'false'
HYDRA_FULL_ERROR: '1'
config:
override_dirname:
kv_sep: "="
item_sep: " "
exclude_keys:
- batch_size
- model
- model.model_type
- model.num_channels
- model.num_layers
- model.fine_tune_num_layers
- model.fine_tune_num_layers
- device
- exp_name
- max_epochs
- dataset.train_ratio
- dataset.val_ratio
- dataset.test_ratio
- run_type
- kfolds
- dataset
- debug
- debug_loops
- seed
- use_volatile

sweep:
dir: ./morpho_symm/experiments/${hydra.job.name}/
subdir: ${hydra.job.override_dirname}

job_logging:
version: 1
colorlog: True
formatters:
simple:
format: '[%(levelname)s][%(name)s] %(message)s'
handlers:
console:
class: logging.StreamHandler
formatter: simple
stream: ext://sys.stdout
file:
class: logging.handlers.RotatingFileHandler
formatter: simple
filename: log.log
maxBytes: 2048
backupCount: 1
root:
handlers: [console]

disable_existing_loggers: false
23 changes: 23 additions & 0 deletions utils/cfg/config_visualization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

defaults:
- _self_
- robot: 'solo'
- override hydra/hydra_logging: disabled

# TODO: Make distinctions between. Trainer Args, Model Psecific Args, Program Args
debug: False
debug_joints: False
make_gif: False
make_imgs: True
gui: False

recording_name: 'concrete_galloping'
hydra:
output_subdir: null # disable hydra output directory
verbose: ${debug}
run:
dir: . # disable hydra run directory
job:
chdir: False
env_set:
HYDRA_FULL_ERROR: '1'
21 changes: 21 additions & 0 deletions utils/cfg/dataset/com_momentum.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
job_name: ${exp_name}_${robot.name}/model=${model.model_type}_train_ratio=${dataset.train_ratio}_ly=${model.num_layers}_hc=${model.num_channels}

name: 'com_momentum'

data_folder: "dataset/com_momentum"

augment: False
angular_momentum: True

standarize: True

batch_size: 256
max_epochs: 300
log_every_n_epochs: 0.5

#samples: 100000 # Dataset size.
samples: 100000 # Dataset size.
train_ratio: 0.7
test_ratio: 0.15
val_ratio: 0.15
26 changes: 26 additions & 0 deletions utils/cfg/dataset/contact.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

job_name: ${exp_name}_${robot.name}/model=${model.model_type}_train_ratio=${dataset.train_ratio}
name: "contact"

data_folder: "training_splitted"

contact_type: "contact"

log_every_n_epochs: 0.15 # 4 times per epoch

augment: false
balanced_classes: false # Use class frequencies to weight cross entropy loss
max_epochs: 60
batch_size: 30
window_size: 150

# Dataset is already partitioned in training-val data and test data separatedly
# this is why we use 15 % of the train-val data for validation the rest for training
# and why the ratio for testing is set to 1, to use all of the test data
train_ratio: 0.85
test_ratio: 1
val_ratio: 0.15

shuffle: True


7 changes: 7 additions & 0 deletions utils/cfg/model/base_model.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

model_type: ???
bias: true
lr: 1e-3
init_mode: 'fan_in'
fine_tune_lr_scale: 0.1
fine_tune_num_layers: 2
6 changes: 6 additions & 0 deletions utils/cfg/model/contact_cnn.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

defaults:
- base_model

model_type: 'CNN'
lr: 0.0001
9 changes: 9 additions & 0 deletions utils/cfg/model/contact_ecnn.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

defaults:
- contact_cnn

model_type: 'ECNN'
lr: 1e-5
dropout: 0.5
unconstraint_finetune: false
inv_dims_scale: 1.0
10 changes: 10 additions & 0 deletions utils/cfg/model/emlp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

defaults:
- mlp

model_type: 'EMLP'
lr: 2.4e-3
num_layers: 4
batch_norm: False
activation: 'elu'
num_channels: 128
10 changes: 10 additions & 0 deletions utils/cfg/model/mlp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

defaults:
- base_model

model_type: 'MLP'
lr: 2.4e-3
num_layers: 4
batch_norm: False
activation: 'elu'
num_channels: 128
23 changes: 23 additions & 0 deletions utils/cfg/robot/a1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
defaults:
- base_robot
- _self_

name: a1

hip_height: 0.35
# ______|___Base Pos___|___Base Ori__|______________________________QJ________________________________|
init_q: [0.0, 0.0, 0.35, 0, 0, 0 , 1 , 0.0, 0.4, -1.2, 0.0, 0.4, -1.2, 0.0, 0.4, -1.2, 0.0, 0.4, -1.2,]

group_label: C2
# QJ: Joint Space symmetries____________________________________
permutation_Q_js: [[3, 4, 5, 0, 1, 2, 9, 10, 11, 6, 7, 8]]
# Reflections are determined by joint frame predefined orientation.
reflection_Q_js: [[-1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1]]

# 4D-Representation permuting the set of elements, associated with the legs kinematic chains
permutation_kin_chain: [[1, 0, 3, 2]]
reflection_kin_chain: [[1, 1, 1, 1]]

# Transformation for Euler angles in 'xyz' convention
permutation_euler_xyz: [[0, 1, 2]]
reflection_euler_xyz: [[-1, 1, -1]]
39 changes: 39 additions & 0 deletions utils/cfg/robot/aliengo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
defaults:
- base_robot

name: aliengo

hip_height: 0.4

group_label: C2

# QJ: Joint Space symmetries____________________________________
# Each leg is parameterized by a:
# Hip joint (1,): 1DoF revolute joint with position constraints
# Thigh joint (2,): 1DoF revolute joint with NO position constraints, thus modeled as a point in the unit circle
# Calf joint (1,): 1DoF revolute joint with position constraints
# The action of the reflection is defined by the permutation of the configurations of the legs, such that:
# FL <---g---> FR and HL <---g---> HR.
# ____FL_______|_____FR______|_________HL______|____HR____________|
# q = [ 0, (1,2), 3, 4, (5,6), 7, 8, (9,10), 11, 12, (13, 14), 15]
# g·q = [ 4, (5,6), 7, 0, (1,2), 3, 12, (13,14), 15, 8, (9,10), 11]
# QJ: Joint Space symmetries____________________________________
permutation_Q_js: [[4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 8, 9, 10, 11]]
# Reflections are determined by joint frame predefined orientation.
reflection_Q_js: [[-1, 1, 1, 1, -1, 1,1, 1, -1, 1, 1, 1, -1, 1, 1, 1,]]

# The tangent space of a unit circle is a 1D line:
# ____FL______|_______FR_____|__________HL_________|_______HR__________|
# v = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
# g·v = [ 3, 4, 5, 0, 1, 2, 9, 10, 11, 6, 7, 8]
permutation_TqQ_js: [[3, 4, 5, 0, 1, 2, 9, 10, 11, 6, 7, 8]]
# Reflections are determined by joint frame predefined orientation.
reflection_TqQ_js: [[-1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1]]

# 4D-Representation permuting the set of elements, associated with the legs kinematic chains
permutation_kin_chain: [[1, 0, 3, 2],]
reflection_kin_chain: [[1, 1, 1, 1],]

# Transformation for Euler angles in 'xyz' convention
permutation_euler_xyz: [[0, 1, 2]]
reflection_euler_xyz: [[-1, 1, -1]]
7 changes: 7 additions & 0 deletions utils/cfg/robot/anymal_b-c2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
defaults:
- anymal_b
- _self_

name: anymal_b

group_label: C2
9 changes: 9 additions & 0 deletions utils/cfg/robot/anymal_b.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defaults:
- anymal_c

name: anymal_b

draw_floor: True
endeff_names : ['RH_ADAPTER_TO_FOOT', 'LH_ADAPTER_TO_FOOT', 'RF_ADAPTER_TO_FOOT', 'LF_ADAPTER_TO_FOOT']

group_label: K4
5 changes: 5 additions & 0 deletions utils/cfg/robot/anymal_c-c2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
defaults:
- anymal_c
- _self_

group_label: C2
25 changes: 25 additions & 0 deletions utils/cfg/robot/anymal_c.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
defaults:
- base_robot

name: anymal_c
angle_sweep: 0.45
hip_height: 0.6
draw_floor: False
seed: 10

endeff_names : ['RH_shank_fixed_RH_FOOT', 'LH_shank_fixed_LH_FOOT', 'RF_shank_fixed_RF_FOOT', 'LF_shank_fixed_LF_FOOT']
# ____LF_______|________LH____|___RF______|____RH____|
# ________|__Base Pos____|_Base Ori____|______________________________QJ__________________________________|
init_q: [0.0, 0.0, 0.24, 0, 0, 0, 1, 0.0, 0.5, -1, 0.0, -0.5, 1, 0.0, 0.5, -1, 0.0, -0.5, 1]

group_label: K4


# QJ: Joint Space symmetries____________________________________
# ____LF___|___LH____|___RF______|____RH____|
# q = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
# Configure qj (joint-space) group actions
# Sagittal Symmetry Transversal symmetry
permutation_Q_js: [[6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5], [3, 4, 5, 0, 1, 2, 9, 10, 11, 6, 7, 8]]
# Reflections are determined by joint frame predefined orientation.
reflection_Q_js: [[-1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1], [1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1]]
28 changes: 28 additions & 0 deletions utils/cfg/robot/atlas.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
defaults:
- base_robot

name: atlas_v4

hip_height: 0.85
# ______|___Base Pos___|___Base Ori__|______________________________QJ____________________________|
init_q: null
endeff_names: ['l_leg_akx', 'r_leg_akx']

group_label: C2

# QJ: Joint Space symmetries____________________________________
permutation_Q_js: [[0, 1, 2, # ['back_bkz', 'back_bky', 'back_bkx',
11, 12, 13, 14, 15, 16, 17, # 'r_arm_shz', 'r_arm_shx', 'r_arm_ely', 'r_arm_elx', 'r_arm_wry', 'r_arm_wrx', 'r_arm_wry2',
10, # 'neck_ry',
3, 4, 5, 6, 7, 8, 9, # 'l_arm_shz', 'l_arm_shx', 'l_arm_ely', 'l_arm_elx', 'l_arm_wry', 'l_arm_wrx', 'l_arm_wry2',
24, 25, 26, 27, 28, 29, # 'r_leg_hpz', 'r_leg_hpx', 'r_leg_hpy', 'r_leg_kny', 'r_leg_aky', 'r_leg_akx',
18, 19, 20, 21, 22, 23]] # 'l_leg_hpz', 'l_leg_hpx', 'l_leg_hpy', 'l_leg_kny', 'l_leg_aky', 'l_leg_akx',
# Reflections are determined by joint frame predefined orientation.
reflection_Q_js: [[-1, 1, -1, # ['back_bkz', 'back_bky', 'back_bkx',
-1, -1, 1, -1, 1, -1, -1,
# 'r_arm_shz', 'r_arm_shx', 'r_arm_ely', 'r_arm_elx', 'r_arm_wry', 'r_arm_wrx', 'r_arm_wry2',
1, # 'neck_ry',
-1, -1, 1, -1, 1, -1, -1,
# 'l_arm_shz', 'l_arm_shx', 'l_arm_ely', 'l_arm_elx', 'l_arm_wry', 'l_arm_wrx', 'l_arm_wry2',
-1, -1, 1, 1, 1, -1, # 'r_leg_hpz', 'r_leg_hpx', 'r_leg_hpy', 'r_leg_kny', 'r_leg_aky', 'r_leg_akx',
-1, -1, 1, 1, 1, -1]] # 'l_leg_hpz', 'l_leg_hpx', 'l_leg_hpy', 'l_leg_kny', 'l_leg_aky', 'l_leg_akx',]]
5 changes: 5 additions & 0 deletions utils/cfg/robot/b1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
defaults:
- a1

name: b1

26 changes: 26 additions & 0 deletions utils/cfg/robot/base_robot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Robot (description) name for loading robot_descriptions.py
name: ???
seed: -1

# Symmetry related parameters
group_label: null
rep_fields: 'real'
permutation_Q_js: null # Symmetry permutation of joint-space position coordinates Q_js
permutation_TqQ_js: ${.permutation_Q_js} # Symmetry permutations of joint-space tangent space (velocity coordinates) TqQ_js
reflection_Q_js: null # Symmetry reflections of joint-space position coordinates Q_js
reflection_TqQ_js: ${.reflection_Q_js} # Symmetry reflections of joint-space tangent space (velocity coordinates) TqQ_js

fix_base: False

# Visualization aux variables
tint_bodies: True
draw_floor: True
hip_height: 1.0
endeff_names: null
init_q: null
q_zero: null # Zero vector of the generalized positions. Can be different from the Zero defined in URDF.
angle_sweep: 0.43

# Transformation for Euler angles in 'xyz' convention
permutation_euler_xyz: [[0, 1, 2], [0, 1, 2], [0, 1, 2]]
reflection_euler_xyz: [[-1, 1, -1], [1, -1, -1], [-1, -1, 1]]
Loading

0 comments on commit c571050

Please sign in to comment.