ex_4_talos_conf.py
Go to the documentation of this file.
1 """Created on Thu Apr 18 09:47:07 2019
2 
3 @author: student
4 """
5 
6 from pathlib import Path
7 
8 import numpy as np
9 import pinocchio as pin
10 from example_robot_data.robots_loader import getModelPath
11 
12 np.set_printoptions(precision=3, linewidth=200, suppress=True)
13 LINE_WIDTH = 60
14 
15 DATA_FILE_LIPM = "talos_walking_traj_lipm.npz"
16 DATA_FILE_TSID = "talos_walking_traj_tsid.npz"
17 
18 # robot parameters
19 # ----------------------------------------------
20 filename = str(Path(__file__).resolve().parent)
21 urdf = "talos_data/robots/talos_reduced.urdf"
22 modelPath = Path(getModelPath(urdf))
23 urdf = modelPath / urdf
24 srdf = modelPath / "talos_data/srdf/talos.srdf"
25 path = modelPath / "../.."
26 
27 nv = 38
28 foot_scaling = 1.0
29 lxp = foot_scaling * 0.10 # foot length in positive x direction
30 lxn = foot_scaling * 0.05 # foot length in negative x direction
31 lyp = foot_scaling * 0.05 # foot length in positive y direction
32 lyn = foot_scaling * 0.05 # foot length in negative y direction
33 lz = 0.0 # foot sole height with respect to ankle joint
34 mu = 0.3 # friction coefficient
35 fMin = 0.0 # minimum normal force
36 fMax = 1e6 # maximum normal force
37 rf_frame_name = "leg_right_sole_fix_joint" # right foot frame name
38 lf_frame_name = "leg_left_sole_fix_joint" # left foot frame name
39 contactNormal = np.matrix(
40  [0.0, 0.0, 1.0]
41 ).T # direction of the normal to the contact surface
42 
43 # configuration for LIPM trajectory optimization
44 # ----------------------------------------------
45 alpha = 10 ** (2) # CoP error squared cost weight
46 beta = 0 # CoM position error squared cost weight
47 gamma = 10 ** (-1) # CoM velocity error squared cost weight
48 h = 0.88 # fixed CoM height
49 g = 9.81 # norm of the gravity vector
50 foot_step_0 = np.array([0.0, -0.085]) # initial foot step position in x-y
51 dt_mpc = 0.1 # sampling time interval
52 T_step = 1.2 # time needed for every step
53 step_length = 0.2 # fixed step length
54 step_height = 0.05 # fixed step height
55 nb_steps = 4 # number of desired walking steps
56 
57 # configuration for TSID
58 # ----------------------------------------------
59 dt = 0.002 # controller time step
60 T_pre = 1.5 # simulation time before starting to walk
61 T_post = 1.5 # simulation time after walking
62 
63 w_com = 1.0 # weight of center of mass task
64 w_foot = 1e0 # weight of the foot motion task
65 w_contact = 1e2 # weight of the foot in contact
66 w_posture = 1e-4 # weight of joint posture task
67 w_forceRef = 1e-5 # weight of force regularization task
68 w_torque_bounds = 0.0 # weight of the torque bounds
69 w_joint_bounds = 0.0
70 
71 tau_max_scaling = 1.45 # scaling factor of torque bounds
72 v_max_scaling = 0.8
73 
74 kp_contact = 10.0 # proportional gain of contact constraint
75 kp_foot = 10.0 # proportional gain of contact constraint
76 kp_com = 10.0 # proportional gain of center of mass task
77 kp_posture = 1.0 # proportional gain of joint posture task
78 # gain_vector = kp_posture*np.ones(nv-6)
79 gain_vector = np.array( # gain vector for postural task
80  [
81  10.0,
82  5.0,
83  5.0,
84  1.0,
85  1.0,
86  10.0, # lleg #low gain on axis along y and knee
87  10.0,
88  5.0,
89  5.0,
90  1.0,
91  1.0,
92  10.0, # rleg
93  5000.0,
94  5000.0, # chest
95  500.0,
96  1000.0,
97  10.0,
98  10.0,
99  10.0,
100  10.0,
101  100.0,
102  50.0, # larm
103  50.0,
104  100.0,
105  10.0,
106  10.0,
107  10.0,
108  10.0,
109  100.0,
110  50.0, # rarm
111  100.0,
112  100.0,
113  ] # head
114 )
115 masks_posture = np.ones(nv - 6)
116 
117 # configuration for viewer
118 # ----------------------------------------------
119 viewer = pin.visualize.GepettoVisualizer
120 PRINT_N = 500 # print every PRINT_N time steps
121 DISPLAY_N = 20 # update robot configuration in viwewer every DISPLAY_N time steps
122 CAMERA_TRANSFORM = [
123  3.578777551651001,
124  1.2937744855880737,
125  0.8885031342506409,
126  0.4116811454296112,
127  0.5468055009841919,
128  0.6109083890914917,
129  0.3978860676288605,
130 ]
example_robot_data::robots_loader


tsid
Author(s): Andrea Del Prete, Justin Carpentier
autogenerated on Sat May 3 2025 02:48:16