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


tsid
Author(s): Andrea Del Prete, Justin Carpentier
autogenerated on Sun Jul 2 2023 02:21:51