├── Anymal_B_example.prj ├── README.md ├── resources └── project │ ├── Project.xml │ ├── ProjectData.type.Info.xml │ ├── Root.type.Categories │ ├── FileClassCategory.type.Category.xml │ └── FileClassCategory.type.Category │ │ ├── artifact.type.Label.xml │ │ ├── convenience.type.Label.xml │ │ ├── derived.type.Label.xml │ │ ├── design.type.Label.xml │ │ ├── none.type.Label.xml │ │ ├── other.type.Label.xml │ │ └── test.type.Label.xml │ ├── Root.type.EntryPointGroups │ └── 2798a3e5-e1d8-4936-912d-deb84144c48b.type.EntryPointGroup.xml │ ├── Root.type.EntryPoints │ ├── 5a59f333-fc6f-4c82-991c-0c19a2b7a39e.type.EntryPoint.xml │ ├── 79845cba-39ed-4fb6-bd72-6d51208fca08.type.EntryPoint.xml │ └── de49fc84-67ff-4b18-82f7-7f72b3375897.type.EntryPoint.xml │ ├── Root.type.Files │ ├── anymal_b_simple_description.type.File.xml │ ├── anymal_b_simple_description.type.File │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ ├── CMakeLists.txt.type.File.xml │ │ ├── LICENSE.type.File.xml │ │ ├── Readme.md.type.File.xml │ │ ├── config.type.File.xml │ │ ├── config.type.File │ │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ │ ├── rviz.type.File.xml │ │ │ └── rviz.type.File │ │ │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ │ │ └── standalone.rviz.type.File.xml │ │ ├── doc.type.File.xml │ │ ├── doc.type.File │ │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ │ └── anymal_b_rviz.png.type.File.xml │ │ ├── launch.type.File.xml │ │ ├── launch.type.File │ │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ │ ├── load.launch.type.File.xml │ │ │ └── standalone.launch.type.File.xml │ │ ├── meshes.type.File.xml │ │ ├── meshes.type.File │ │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ │ ├── anymal_base.dae.type.File.xml │ │ │ ├── anymal_base.stl.type.File.xml │ │ │ ├── anymal_foot.dae.type.File.xml │ │ │ ├── anymal_foot.stl.type.File.xml │ │ │ ├── anymal_hip_l.dae.type.File.xml │ │ │ ├── anymal_hip_l.stl.type.File.xml │ │ │ ├── anymal_hip_r.dae.type.File.xml │ │ │ ├── anymal_hip_r.stl.type.File.xml │ │ │ ├── anymal_shank_l.dae.type.File.xml │ │ │ ├── anymal_shank_l.stl.type.File.xml │ │ │ ├── anymal_shank_r.dae.type.File.xml │ │ │ ├── anymal_shank_r.stl.type.File.xml │ │ │ ├── anymal_thigh_l.dae.type.File.xml │ │ │ ├── anymal_thigh_l.stl.type.File.xml │ │ │ ├── anymal_thigh_r.dae.type.File.xml │ │ │ ├── anymal_thigh_r.stl.type.File.xml │ │ │ ├── base_uv_texture.jpg.type.File.xml │ │ │ └── carbon_uv_texture.jpg.type.File.xml │ │ ├── package.xml.type.File.xml │ │ ├── urdf.type.File.xml │ │ └── urdf.type.File │ │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ │ └── anymal.urdf.type.File.xml │ ├── anymalrobot.slx.type.File.xml │ ├── anymalrobot_ground.slx.type.File.xml │ ├── cache.type.File.xml │ ├── cache.type.File │ │ └── 1.type.DIR_SIGNIFIER.xml │ ├── rlQuadruped.slx.type.File.xml │ ├── utility.type.File.xml │ └── utility.type.File │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ ├── calculateRobotFB.m.type.File.xml │ │ ├── createNetworks.m.type.File.xml │ │ ├── gaitTable.m.type.File.xml │ │ ├── initAnymalParam.m.type.File.xml │ │ ├── initializeRobotParameters.m.type.File.xml │ │ ├── quadrupedResetFcn.m.type.File.xml │ │ └── startTraining.m.type.File.xml │ ├── Root.type.ProjectPath │ ├── 304abc01-e80d-4814-ab23-bab8d53eba82.type.Reference.xml │ ├── 4569225d-1935-4452-9c6b-8a78c65ea982.type.Reference.xml │ ├── 57f5647c-ec15-42da-b595-f48c701640c3.type.Reference.xml │ ├── 65d3135b-ec28-43aa-93bc-8ed7a57993bc.type.Reference.xml │ ├── 74582bfb-05ff-4b21-aa8f-e675af1096b6.type.Reference.xml │ ├── e5892f87-1eed-424f-8edb-541a00d50af8.type.Reference.xml │ ├── e800fd8a-a864-4998-acaf-8b223fa0d44b.type.Reference.xml │ ├── e88de6bc-efe5-4301-b17f-4532bb4cb4fd.type.Reference.xml │ ├── f235e3a6-8a22-422e-84bf-c0b3ddd1e93a.type.Reference.xml │ └── f8390fb1-0dc7-4913-929f-0a87b62e9a2e.type.Reference.xml │ └── uuid-7891ee29-e53e-4931-a827-e8d547c5150e.xml ├── rlQuadruped.slx ├── rlQuadruped_TD3.avi ├── testDDPGAgent.mlx ├── testTD3Agent.mlx └── utility ├── calculateRobotFB.m ├── createDDPGAgent.m ├── createNetworks.m ├── createTD3Agent.m ├── initAnymalParam.m ├── initializeRobotParameters.m └── quadrupedResetFcn.m /Anymal_B_example.prj: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deep Reinforcement Learning - Quadruped Robot Training Tutorial 2 | 3 | To run this project, you should first clone the repository: https://github.com/ANYbotics/anymal_b_simple_description.
4 | Put the files in the root path of this repository, start MATLAB, and open 'Anymal_B_example.prj' to check if you can load the project successfully. 5 | 6 | To train a DDPG or TD3 agent, you can use 'testDDPGAgent.mlx' and 'testTD3Agent.mlx' in MATLAB, set 'doTraining = false' to 'doTraining = true' (line 40), if necessary. 7 | These scripts utilizes the files 'utility\createDDPGAgent.m' and 'utility\createTD3Agent.m' to create the DDPG and TD3 agent respectively, and share the same file 'utility\createNetworks' to create actor/critic networks. 8 | 9 | To change the device for training and inference, you can alter the 'UseDevice' value, in criticOptions and actorOptions within 'utility\createDDPGAgent.m' and 'utility\createTD3Agent.m', 10 | 11 | Check the 'rlQuadruped_TD3.avi' to see how the TD3 agent performs, for more information, such as the trained TD3 agent and reinforcement learning workflow in MATLAB & Simulink, please contact MathWorks directly. 12 | -------------------------------------------------------------------------------- /resources/project/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/ProjectData.type.Info.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Categories/FileClassCategory.type.Category.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Categories/FileClassCategory.type.Category/artifact.type.Label.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Categories/FileClassCategory.type.Category/convenience.type.Label.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Categories/FileClassCategory.type.Category/derived.type.Label.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Categories/FileClassCategory.type.Category/design.type.Label.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Categories/FileClassCategory.type.Category/none.type.Label.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Categories/FileClassCategory.type.Category/other.type.Label.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Categories/FileClassCategory.type.Category/test.type.Label.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.EntryPointGroups/2798a3e5-e1d8-4936-912d-deb84144c48b.type.EntryPointGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.EntryPoints/5a59f333-fc6f-4c82-991c-0c19a2b7a39e.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.EntryPoints/79845cba-39ed-4fb6-bd72-6d51208fca08.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.EntryPoints/de49fc84-67ff-4b18-82f7-7f72b3375897.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/CMakeLists.txt.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/LICENSE.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/Readme.md.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/config.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/config.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/config.type.File/rviz.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/config.type.File/rviz.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/config.type.File/rviz.type.File/standalone.rviz.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/doc.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/doc.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/doc.type.File/anymal_b_rviz.png.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/launch.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/launch.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/launch.type.File/load.launch.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/launch.type.File/standalone.launch.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/anymal_base.dae.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/anymal_base.stl.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/anymal_foot.dae.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/anymal_foot.stl.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/anymal_hip_l.dae.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/anymal_hip_l.stl.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/anymal_hip_r.dae.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/anymal_hip_r.stl.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/anymal_shank_l.dae.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/anymal_shank_l.stl.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/anymal_shank_r.dae.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/anymal_shank_r.stl.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/anymal_thigh_l.dae.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/anymal_thigh_l.stl.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/anymal_thigh_r.dae.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/anymal_thigh_r.stl.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/base_uv_texture.jpg.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/meshes.type.File/carbon_uv_texture.jpg.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/package.xml.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/urdf.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/urdf.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymal_b_simple_description.type.File/urdf.type.File/anymal.urdf.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymalrobot.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/anymalrobot_ground.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/cache.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/cache.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/rlQuadruped.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/utility.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/utility.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/utility.type.File/calculateRobotFB.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/utility.type.File/createNetworks.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/utility.type.File/gaitTable.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/utility.type.File/initAnymalParam.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/utility.type.File/initializeRobotParameters.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/utility.type.File/quadrupedResetFcn.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /resources/project/Root.type.Files/utility.type.File/startTraining.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /resources/project/Root.type.ProjectPath/304abc01-e80d-4814-ab23-bab8d53eba82.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.ProjectPath/4569225d-1935-4452-9c6b-8a78c65ea982.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.ProjectPath/57f5647c-ec15-42da-b595-f48c701640c3.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.ProjectPath/65d3135b-ec28-43aa-93bc-8ed7a57993bc.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.ProjectPath/74582bfb-05ff-4b21-aa8f-e675af1096b6.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.ProjectPath/e5892f87-1eed-424f-8edb-541a00d50af8.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.ProjectPath/e800fd8a-a864-4998-acaf-8b223fa0d44b.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.ProjectPath/e88de6bc-efe5-4301-b17f-4532bb4cb4fd.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.ProjectPath/f235e3a6-8a22-422e-84bf-c0b3ddd1e93a.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/Root.type.ProjectPath/f8390fb1-0dc7-4913-929f-0a87b62e9a2e.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/project/uuid-7891ee29-e53e-4931-a827-e8d547c5150e.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /rlQuadruped.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlMWcn/DeepReinforcementLearning-QuadrupedRobotTrainingTutorial/0577b0f9ffc491f40726b057cf7e5ccf095d2caa/rlQuadruped.slx -------------------------------------------------------------------------------- /rlQuadruped_TD3.avi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlMWcn/DeepReinforcementLearning-QuadrupedRobotTrainingTutorial/0577b0f9ffc491f40726b057cf7e5ccf095d2caa/rlQuadruped_TD3.avi -------------------------------------------------------------------------------- /testDDPGAgent.mlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlMWcn/DeepReinforcementLearning-QuadrupedRobotTrainingTutorial/0577b0f9ffc491f40726b057cf7e5ccf095d2caa/testDDPGAgent.mlx -------------------------------------------------------------------------------- /testTD3Agent.mlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rlMWcn/DeepReinforcementLearning-QuadrupedRobotTrainingTutorial/0577b0f9ffc491f40726b057cf7e5ccf095d2caa/testTD3Agent.mlx -------------------------------------------------------------------------------- /utility/calculateRobotFB.m: -------------------------------------------------------------------------------- 1 | 2 | clear 3 | clc 4 | 5 | myanymal=importrobot('anymal.urdf'); 6 | show(myanymal) 7 | 8 | showdetails(myanymal) 9 | 10 | 11 | currentRobotJConfig= homeConfiguration(myanymal); 12 | 13 | LF_FOOT = 'LF_FOOT'; 14 | LH_FOOT = 'LH_FOOT'; 15 | RF_FOOT = 'RF_FOOT'; 16 | RH_FOOT = 'RH_FOOT'; 17 | % ik = inverseKinematics('RigidBodyTree', myanymal); 18 | % weights=[0,0,0,1,1,1]; 19 | % qSol = ik(LF_FOOT,trvec2tform([-0.4,0.25,-0.4]),weights,currentRobotJConfig); 20 | % show(myanymal,qSol) 21 | 22 | %get robot transform 23 | % transform = getTransform(robot,configuration,sourcebody,targetbody) 24 | tLFform = getTransform(myanymal,currentRobotJConfig,LF_FOOT,'base'); 25 | tLHform = getTransform(myanymal,currentRobotJConfig,LH_FOOT,'base'); 26 | tRFform = getTransform(myanymal,currentRobotJConfig,RF_FOOT,'base'); 27 | tRHform = getTransform(myanymal,currentRobotJConfig,RH_FOOT,'base'); 28 | 29 | 30 | 31 | 32 | %conver qici to Position 33 | LF_FOOT_pos = tform2trvec(tLFform); 34 | LH_FOOT_pos = tform2trvec(tLHform); 35 | RF_FOOT_pos = tform2trvec(tRFform); 36 | RH_FOOT_pos = tform2trvec(tRHform); 37 | 38 | 39 | tLFSHANKform = getTransform(myanymal,currentRobotJConfig,'LF_SHANK','base'); 40 | tLHSHANKform = getTransform(myanymal,currentRobotJConfig,'LH_SHANK','base'); 41 | tRFSHANKform = getTransform(myanymal,currentRobotJConfig,'RF_SHANK','base'); 42 | tRHSHANKform = getTransform(myanymal,currentRobotJConfig,'RH_SHANK','base'); 43 | LFSHANK_pos = tform2trvec(tLFSHANKform); 44 | LHSHANK_pos = tform2trvec(tLHSHANKform); 45 | RFSHANK_pos = tform2trvec(tRFSHANKform); 46 | RHSHANK_pos = tform2trvec(tRHSHANKform); 47 | 48 | tLFTHIGHform = getTransform(myanymal,currentRobotJConfig,'LF_THIGH','base'); 49 | tLHTHIGHform = getTransform(myanymal,currentRobotJConfig,'LH_THIGH','base'); 50 | tRFTHIGHform = getTransform(myanymal,currentRobotJConfig,'RF_THIGH','base'); 51 | tRHTHIGHform = getTransform(myanymal,currentRobotJConfig,'RH_THIGH','base'); 52 | LFTHIGH_pos = tform2trvec(tLFTHIGHform); 53 | LHTHIGH_pos = tform2trvec(tLHTHIGHform); 54 | RFTHIGH_pos = tform2trvec(tRFTHIGHform); 55 | RHTHIGH_pos = tform2trvec(tRHTHIGHform); 56 | 57 | FOOT_Hight=-0.5; 58 | 59 | homePosLF=[LFSHANK_pos(1),LFTHIGH_pos(2),FOOT_Hight]; 60 | homePosLH=[LHSHANK_pos(1),LHTHIGH_pos(2),FOOT_Hight]; 61 | homePosRF=[RFSHANK_pos(1),RFTHIGH_pos(2),FOOT_Hight]; 62 | homePosRH=[RHSHANK_pos(1),RHTHIGH_pos(2),FOOT_Hight]; 63 | % homePos= 64 | 65 | ik = inverseKinematics('RigidBodyTree', myanymal); 66 | weights=[0,0,0,1,1,1]; 67 | qSolLF = ik(LF_FOOT,trvec2tform(homePosLF),weights,currentRobotJConfig); 68 | qSolLH = ik(LH_FOOT,trvec2tform(homePosLH),weights,currentRobotJConfig); 69 | qSolRF = ik(RF_FOOT,trvec2tform(homePosRF),weights,currentRobotJConfig); 70 | qSolRH = ik(RH_FOOT,trvec2tform(homePosRH),weights,currentRobotJConfig); 71 | % qSol.JointPosition=[qSolLF(1:3).JointPosition,qSolLH(4:6).JointPosition,qSolRF(7:9).JointPosition,qSolRH(10:12).JointPosition]'; 72 | qSol=currentRobotJConfig; 73 | qSol(1).JointPosition=qSolLF(1).JointPosition; 74 | qSol(2).JointPosition=qSolLF(2).JointPosition; 75 | qSol(3).JointPosition=qSolLF(3).JointPosition; 76 | qSol(4).JointPosition=qSolLH(4).JointPosition; 77 | qSol(5).JointPosition=qSolLH(5).JointPosition; 78 | qSol(6).JointPosition=qSolLH(6).JointPosition; 79 | qSol(7).JointPosition=qSolRF(7).JointPosition; 80 | qSol(8).JointPosition=qSolRF(8).JointPosition; 81 | qSol(9).JointPosition=qSolRF(9).JointPosition; 82 | qSol(10).JointPosition=qSolRH(10).JointPosition; 83 | qSol(11).JointPosition=qSolRH(11).JointPosition; 84 | qSol(12).JointPosition=qSolRH(12).JointPosition; 85 | 86 | currentRobotJConfig =qSol; 87 | show(myanymal,qSol) 88 | hold on 89 | 90 | 91 | 92 | 93 | 94 | initialPos=[[-0.180304649622485;0.707778746139701;-0.910179587563713;-0.180304649622485;-0.707778746139701;0.910179587563713;0.180304649622485;0.707778746139702;-0.910179587563714;0.180304649622485;-0.707778746139702;0.910179587563713]]; 95 | 96 | % axis equal 97 | % %convert Position to qici 98 | % trvec = [0.5 6 100]; 99 | % tform = trvec2tform(trvec) -------------------------------------------------------------------------------- /utility/createDDPGAgent.m: -------------------------------------------------------------------------------- 1 | function agent = createDDPGAgent(numObs, obsInfo, numAct, actInfo, Ts) 2 | % Walking Robot -- DDPG Agent Setup Script 3 | % Copyright 2020 The MathWorks, Inc. 4 | 5 | %% Create the actor and critic networks using the createNetworks helper function 6 | [criticNetwork,~,actorNetwork] = createNetworks(numObs,numAct); 7 | 8 | %% Specify options for the critic and actor representations using rlRepresentationOptions 9 | criticOptions = rlRepresentationOptions('Optimizer','adam','LearnRate',1e-3,... 10 | 'GradientThreshold',1,'L2RegularizationFactor',2e-4,'UseDevice','cpu'); 11 | actorOptions = rlRepresentationOptions('Optimizer','adam','LearnRate',1e-3,... 12 | 'GradientThreshold',1,'L2RegularizationFactor',1e-5,'UseDevice','cpu'); 13 | 14 | %% Create critic and actor representations using specified networks and 15 | % options 16 | critic = rlQValueRepresentation(criticNetwork,obsInfo,actInfo,'Observation',{'observation'},'Action',{'action'},criticOptions); 17 | actor = rlDeterministicActorRepresentation(actorNetwork,obsInfo,actInfo,'Observation',{'observation'},'Action',{'ActorTanh1'},actorOptions); 18 | 19 | %% Specify DDPG agent options 20 | agentOptions = rlDDPGAgentOptions; 21 | agentOptions.SampleTime = Ts; 22 | agentOptions.DiscountFactor = 0.99; 23 | agentOptions.MiniBatchSize = 256; 24 | agentOptions.ExperienceBufferLength = 1e6; 25 | agentOptions.TargetSmoothFactor = 5e-3; 26 | agentOptions.NoiseOptions.MeanAttractionConstant = 1; 27 | agentOptions.NoiseOptions.Variance = 0.1; 28 | 29 | agentOptions.SaveExperienceBufferWithAgent = true; 30 | agentOptions.ResetExperienceBufferBeforeTraining = false; 31 | %% Create agent using specified actor representation, critic representation and agent options 32 | agent = rlDDPGAgent(actor,critic,agentOptions); 33 | -------------------------------------------------------------------------------- /utility/createNetworks.m: -------------------------------------------------------------------------------- 1 | function [criticNetwork1, criticNetwork2, actorNetwork] = createNetworks(numObs, numAct) 2 | % Walking Robot -- Neural Network Setup Script 3 | % Copyright 2020 The MathWorks, Inc. 4 | 5 | % Network structure inspired by original 2015 DDPG paper 6 | % "Continuous Control with Deep Reinforcement Learning", Lillicrap et al. 7 | % https://arxiv.org/pdf/1509.02971.pdf 8 | 9 | %% CRITIC 10 | % Create the critic network layers 11 | criticLayerSizes = [400 300]; 12 | 13 | %% First Critic network 14 | statePath1 = [ 15 | featureInputLayer(numObs,'Normalization','none','Name', 'observation') 16 | fullyConnectedLayer(criticLayerSizes(1), 'Name', 'CriticStateFC1', ... 17 | 'Weights',2/sqrt(numObs)*(rand(criticLayerSizes(1),numObs)-0.5), ... 18 | 'Bias',2/sqrt(numObs)*(rand(criticLayerSizes(1),1)-0.5)) 19 | reluLayer('Name','CriticStateRelu1') 20 | fullyConnectedLayer(criticLayerSizes(2), 'Name', 'CriticStateFC2', ... 21 | 'Weights',2/sqrt(criticLayerSizes(1))*(rand(criticLayerSizes(2),criticLayerSizes(1))-0.5), ... 22 | 'Bias',2/sqrt(criticLayerSizes(1))*(rand(criticLayerSizes(2),1)-0.5)) 23 | ]; 24 | actionPath1 = [ 25 | featureInputLayer(numAct,'Normalization','none', 'Name', 'action') 26 | fullyConnectedLayer(criticLayerSizes(2), 'Name', 'CriticActionFC1', ... 27 | 'Weights',2/sqrt(numAct)*(rand(criticLayerSizes(2),numAct)-0.5), ... 28 | 'Bias',2/sqrt(numAct)*(rand(criticLayerSizes(2),1)-0.5)) 29 | ]; 30 | commonPath1 = [ 31 | additionLayer(2,'Name','add') 32 | reluLayer('Name','CriticCommonRelu1') 33 | fullyConnectedLayer(1, 'Name', 'CriticOutput',... 34 | 'Weights',2*5e-3*(rand(1,criticLayerSizes(2))-0.5), ... 35 | 'Bias',2*5e-3*(rand(1,1)-0.5)) 36 | ]; 37 | 38 | % Connect the layer graph 39 | criticNetwork1 = layerGraph(statePath1); 40 | criticNetwork1 = addLayers(criticNetwork1, actionPath1); 41 | criticNetwork1 = addLayers(criticNetwork1, commonPath1); 42 | criticNetwork1 = connectLayers(criticNetwork1,'CriticStateFC2','add/in1'); 43 | criticNetwork1 = connectLayers(criticNetwork1,'CriticActionFC1','add/in2'); 44 | 45 | %% Second Critic network 46 | statePath2 = [ 47 | featureInputLayer(numObs,'Normalization','none','Name', 'observation') 48 | fullyConnectedLayer(criticLayerSizes(1), 'Name', 'CriticStateFC1', ... 49 | 'Weights',2/sqrt(numObs)*(rand(criticLayerSizes(1),numObs)-0.5), ... 50 | 'Bias',2/sqrt(numObs)*(rand(criticLayerSizes(1),1)-0.5)) 51 | reluLayer('Name','CriticStateRelu1') 52 | fullyConnectedLayer(criticLayerSizes(2), 'Name', 'CriticStateFC2', ... 53 | 'Weights',2/sqrt(criticLayerSizes(1))*(rand(criticLayerSizes(2),criticLayerSizes(1))-0.5), ... 54 | 'Bias',2/sqrt(criticLayerSizes(1))*(rand(criticLayerSizes(2),1)-0.5)) 55 | ]; 56 | actionPath2 = [ 57 | featureInputLayer(numAct,'Normalization','none', 'Name', 'action') 58 | fullyConnectedLayer(criticLayerSizes(2), 'Name', 'CriticActionFC1', ... 59 | 'Weights',2/sqrt(numAct)*(rand(criticLayerSizes(2),numAct)-0.5), ... 60 | 'Bias',2/sqrt(numAct)*(rand(criticLayerSizes(2),1)-0.5)) 61 | ]; 62 | commonPath2 = [ 63 | additionLayer(2,'Name','add') 64 | reluLayer('Name','CriticCommonRelu1') 65 | fullyConnectedLayer(1, 'Name', 'CriticOutput',... 66 | 'Weights',2*5e-3*(rand(1,criticLayerSizes(2))-0.5), ... 67 | 'Bias',2*5e-3*(rand(1,1)-0.5)) 68 | ]; 69 | 70 | % Connect the layer graph 71 | criticNetwork2 = layerGraph(statePath2); 72 | criticNetwork2 = addLayers(criticNetwork2, actionPath2); 73 | criticNetwork2 = addLayers(criticNetwork2, commonPath2); 74 | criticNetwork2 = connectLayers(criticNetwork2,'CriticStateFC2','add/in1'); 75 | criticNetwork2 = connectLayers(criticNetwork2,'CriticActionFC1','add/in2'); 76 | 77 | %% ACTOR 78 | % Create the actor network layers 79 | actorLayerSizes = [400 300]; 80 | actorNetwork = [ 81 | featureInputLayer(numObs,'Normalization','none','Name','observation') 82 | fullyConnectedLayer(actorLayerSizes(1), 'Name', 'ActorFC1', ... 83 | 'Weights',2/sqrt(numObs)*(rand(actorLayerSizes(1),numObs)-0.5), ... 84 | 'Bias',2/sqrt(numObs)*(rand(actorLayerSizes(1),1)-0.5)) 85 | reluLayer('Name', 'ActorRelu1') 86 | fullyConnectedLayer(actorLayerSizes(2), 'Name', 'ActorFC2', ... 87 | 'Weights',2/sqrt(actorLayerSizes(1))*(rand(actorLayerSizes(2),actorLayerSizes(1))-0.5), ... 88 | 'Bias',2/sqrt(actorLayerSizes(1))*(rand(actorLayerSizes(2),1)-0.5)) 89 | reluLayer('Name', 'ActorRelu2') 90 | fullyConnectedLayer(numAct, 'Name', 'ActorFC3', ... 91 | 'Weights',2*5e-3*(rand(numAct,actorLayerSizes(2))-0.5), ... 92 | 'Bias',2*5e-3*(rand(numAct,1)-0.5)) 93 | tanhLayer('Name','ActorTanh1') 94 | ]; -------------------------------------------------------------------------------- /utility/createTD3Agent.m: -------------------------------------------------------------------------------- 1 | function agent = createTD3Agent(numObs, obsInfo, numAct, actInfo, Ts) 2 | % Walking Robot -- TD3 Agent Setup Script 3 | % Copyright 2020 The MathWorks, Inc. 4 | 5 | %% Create the actor and critic networks using the createNetworks helper function 6 | [criticNetwork1,criticNetwork2,actorNetwork] = createNetworks(numObs,numAct); % Use of 2 Critic networks 7 | % figure 8 | % plot(criticNetwork1) 9 | % figure 10 | % plot(criticNetwork2) 11 | % 12 | % deepNetworkDesigner(actorNetwork) 13 | 14 | %% Specify options for the critic and actor representations using rlRepresentationOptions 15 | criticOptions = rlRepresentationOptions('Optimizer','adam','LearnRate',1e-3,... 16 | 'GradientThreshold',1,'L2RegularizationFactor',2e-4,'UseDevice','cpu'); 17 | actorOptions = rlRepresentationOptions('Optimizer','adam','LearnRate',1e-3,... 18 | 'GradientThreshold',1,'L2RegularizationFactor',1e-5,'UseDevice','cpu'); 19 | 20 | %% Create critic and actor representations using specified networks and 21 | % options 22 | critic1 = rlQValueRepresentation(criticNetwork1,obsInfo,actInfo,'Observation',{'observation'},'Action',{'action'},criticOptions); 23 | critic2 = rlQValueRepresentation(criticNetwork2,obsInfo,actInfo,'Observation',{'observation'},'Action',{'action'},criticOptions); 24 | actor = rlDeterministicActorRepresentation(actorNetwork,obsInfo,actInfo,'Observation',{'observation'},'Action',{'ActorTanh1'},actorOptions); 25 | 26 | %% Specify TD3 agent options 27 | agentOptions = rlTD3AgentOptions; 28 | agentOptions.SampleTime = Ts; 29 | agentOptions.DiscountFactor = 0.99; 30 | agentOptions.MiniBatchSize = 256; 31 | agentOptions.ExperienceBufferLength = 1e6; 32 | agentOptions.TargetSmoothFactor = 5e-3; 33 | agentOptions.TargetPolicySmoothModel.Variance = 0.2; % target policy noise 34 | agentOptions.TargetPolicySmoothModel.LowerLimit = -0.5; 35 | agentOptions.TargetPolicySmoothModel.UpperLimit = 0.5; 36 | agentOptions.ExplorationModel = rl.option.OrnsteinUhlenbeckActionNoise; % set up OU noise as exploration noise (default is Gaussian for rlTD3AgentOptions) 37 | agentOptions.ExplorationModel.MeanAttractionConstant = 1; 38 | agentOptions.ExplorationModel.Variance = 0.1; 39 | 40 | agentOptions.SaveExperienceBufferWithAgent = true; 41 | agentOptions.ResetExperienceBufferBeforeTraining = false; 42 | %% Create agent using specified actor representation, critic representations and agent options 43 | agent = rlTD3Agent(actor, [critic1,critic2], agentOptions); -------------------------------------------------------------------------------- /utility/initAnymalParam.m: -------------------------------------------------------------------------------- 1 | addpath(genpath('anymal_b_simple_description')) 2 | initialPos=[[-0.180304649622485;0.707778746139701;-0.910179587563713;-0.180304649622485;-0.707778746139701;0.910179587563713;0.180304649622485;0.707778746139702;-0.910179587563714;0.180304649622485;-0.707778746139702;0.910179587563713]]; 3 | 4 | initialHeight=0.58; 5 | joint.stiffness=0; 6 | joint.damping=8; 7 | 8 | % gaitTable 9 | 10 | % open_system('anymalrobot') 11 | -------------------------------------------------------------------------------- /utility/initializeRobotParameters.m: -------------------------------------------------------------------------------- 1 | % % Body and leg geometry 2 | % L = 1; % Distance b/w front and rear hip joints 3 | L_back = 1.5; 4 | l1 = 0.5517; % Link #1 5 | l2 = 0.5517; % Link #2 6 | % 7 | % % Robot mass 8 | M = 2; % Torso 9 | m1 = 0.2; % Leg link #1 10 | m2 = 0.2; % Leg link #2 11 | 12 | % Gravity 13 | g = -9.81; 14 | 15 | % Sample Time 16 | Ts = 0.025; % change to 0.025 17 | 18 | % Simulation Time 19 | Tf = 10; 20 | % 21 | % % Desired height 22 | %期望身高,测试在0。46-0,48之间波动 23 | h_final = 0.47; 24 | % 25 | % % Initial body height and foot displacement 26 | % init_foot_disp_x = 0; 27 | % init_body_height = h_final; 28 | % 29 | % % Initial joint angles and velocities 30 | d2r = pi/180; 31 | % init_ang_FL = d2r * quadrupedInverseKinematics(init_foot_disp_x,-init_body_height,l1,l2); 32 | % init_ang_FR = init_ang_FL; 33 | % init_ang_RL = init_ang_FL; 34 | % init_ang_RR = init_ang_FL; 35 | % init_whip_FL = 0; 36 | % init_whip_FR = 0; 37 | % init_whip_RL = 0; 38 | % init_whip_RR = 0; 39 | % 40 | % % initial height 41 | % foot_height = 0.05*l2*(1-sin(2*pi-(3*pi/2+init_ang_FL(1)+init_ang_FL(2)))); 42 | % y_init = init_body_height + foot_height; 43 | 44 | % % Initial body speeds in x,y 45 | % vx_init = 0; 46 | % vy_init = 0; 47 | % 48 | % % Contact friction properties 49 | mu_kinetic = 0.88; 50 | mu_static = 0.9; 51 | % v_thres = 0.001; 52 | % 53 | % % Ground properties 54 | % ground.stiffness = 1e3; 55 | % ground.damping = 1e2; 56 | % ground.length = 100; 57 | % ground.width = 1; 58 | % ground.depth = 0.05; 59 | % 60 | % % Hip and Knee Joint properties 61 | % joint.stiffness = 0; 62 | % joint.damping = 8; 63 | % joint.limitStiffness = 500; 64 | % joint.limitDamping = 50; 65 | % joint.transitionWidth = 2 * d2r; 66 | % hip_eq_angle = 0; 67 | % knee_eq_angle = 0; 68 | 69 | % Define limits on variables 70 | u_max = 25; % max joint torque = +/- u_max 71 | y_min = 0.35; % min height of body from ground 72 | y_max = 0.5; % max translation in z 73 | vx_max = 2.5; % max horizontal speed of body 74 | vy_max = 2.5; % max vertical speed of body 75 | vz_max = 2.5; % max lateral speed of body 76 | roll_max = 10 * d2r; % max roll angle of body 77 | pitch_max = 10 * d2r; % max pitch angle of body 78 | yaw_max = 20 * d2r; % max yaw angle of body 79 | omega_x_max = pi/2; % max angular speed about x 80 | omega_y_max = pi/2; % max angular speed about x 81 | omega_z_max = pi/2; % max angular speed about x 82 | q_hip_min = -120 * d2r; % hip and knee joint angle limit 83 | q_hip_max = -30 * d2r; 84 | %另一个轴目前复用的hip轴的,需要修改 85 | q_knee_min = 60 * d2r; 86 | q_knee_max = 140 * d2r; 87 | w_max = 2*pi*60/60; % hip and knee joint angular speed limit 88 | z_max = 0.58;%l1*cos(q_hip_max) + l2*cos(q_hip_max+q_knee_min); % max height of body from ground 89 | %最大摩擦力,需求根据实际情况修改 90 | normal_force_max = ((M+4*m1+4*m2)*abs(g))/4; 91 | friction_force_max = mu_static * normal_force_max; 92 | 93 | 94 | -------------------------------------------------------------------------------- /utility/quadrupedResetFcn.m: -------------------------------------------------------------------------------- 1 | % Helper function to reset walking robot simulation with different initial conditions 2 | % 3 | % Copyright 2019 The MathWorks, Inc. 4 | 5 | function in = quadrupedResetFcn(in) 6 | % Randomization Parameters 7 | 8 | % l1 = evalin('base','l1'); 9 | % l2 = evalin('base','l2'); 10 | 11 | max_foot_disp_x = 0.05; 12 | max_foot_disp_y = 0.05; 13 | min_body_height = 0.52; 14 | max_body_height = 0.3; 15 | % max_speed_x = 0.05; 16 | % max_speed_y = 0.025; 17 | 18 | 19 | 20 | 21 | % y_body = 0; 22 | % vx = 0; 23 | % vy = 0; 24 | % th_FL = zeros(1,2); 25 | % th_FR = zeros(1,2); 26 | % th_RL = zeros(1,2); 27 | % th_RR = zeros(1,2); 28 | 29 | % Chance of randomizing initial conditions 30 | if rand < -0.5 31 | % Randomize height 32 | b = min_body_height + (max_body_height - min_body_height) * rand; 33 | 34 | % Randomize x-displacement of foot from hip joint 35 | a = -max_foot_disp_x + 2 * max_foot_disp_x * rand(1,4); 36 | 37 | c = -max_foot_disp_y + 2 * max_foot_disp_y * rand(1,4); 38 | 39 | % 需要添加计算initialPos函数的函数 40 | 41 | 42 | initialHeight = b; 43 | 44 | % Chance of starting from default initial conditions 45 | else 46 | initialHeight = 0.58; 47 | initialPos=[-0.180304649622485;0.707778746139701;-0.910179587563713;-0.180304649622485;-0.707778746139701;0.910179587563713;0.180304649622485;0.707778746139702;-0.910179587563714;0.180304649622485;-0.707778746139702;0.910179587563713]; 48 | 49 | end 50 | 51 | in = setVariable(in,'initialHeight',initialHeight); 52 | in = setVariable(in,'initialPos',initialPos); 53 | 54 | 55 | end --------------------------------------------------------------------------------