C-Frost安装及Cassie计算样例

本文运行环境为:Matlab2021b/Mathematic 13/Ubuntu18.04

一、 C-Frost安装

1、安装ipopt

安装参考

2、执行NLP例子验证是否安装成功

官方步骤

1)修改create_problem.m文件中的 FROST_PATH路径

2)修改CMakeLists.txt文件中的C_FROST_ROOT_PATH路径

3)使用Matlab运行create_problem.m文件,会生成c_code文件夹

4)在该文件夹下执行下面的命令

mkdir build
cd build
cmake ..
make
make install
cd ..
./program --initial 'res/init.json' --options '../ipopt.opt' --data 'res/data.json' --bounds 'res/bounds.json' --output '../output.json'

编译成功出现下面的结果

运行最后一句程序成功后出现下面的结果

5)在主文件夹下会生成output.json文件,在matlab中要打开它需要下载Jsonlab文件后将其路径添加到matlab路径当中

二、运行cassie计算样例

1)复制Cassie_ModelC-Frostfrost-dev三个文件夹到submodules文件夹下,frost-dev可能需要返回到原版本,具体参考此博客配置
在这里插入图片描述
2)运行Cassie_Example/cassie_dynamics_library/gen_lib.m文件,运行成功出现下面三个文件夹
在这里插入图片描述

3)执行编译

mkdir build
cd build
make -j8
make install

4)成功后在lib文件夹下会出现libcassie_dynamics.a文件

5)运行`Cassie_Example/opt_two_step/cassie_opt.m’文件,运行成功出现如下动画(这部分时间比较长,估计得十分钟左右)
在这里插入图片描述

usr/bin/ld: warning: /usr/lib/gcc/x86_64-linux-gnu/7/libstdc++.so: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001

请添加图片描述

三、过程中遇到的错误

1)执行/home/robot/Downloads/C-Frost/Examples/NLPExample例子报错

错误使用 cell/ismember (第 34 行)
类 double 的输入 A 和类 cell 的输入 B 必须为字符向量元胞数组,除非其中某个输入为字符向量。

出错 mustBeMember (第 14 行)
    if ~all(ismember(A, B), "all")

出错 NonlinearProgram (第 75 行)
                option.DerivativeLevel {mustBeMember(option.DerivativeLevel, {0,1,2})} = 1

出错 create_problem (第 27 行)
nlp = NonlinearProgram('nlp051');

修改方案:

/home/robot/frost-dev/matlab/nlp/@NonlinearProgram/NonlinearProgram.m改回原来的版本

修改前:
        function obj = NonlinearProgram(name, option)
            % The default class constructor function
            %
            % Parameters: 
            %  name: the name of the problem
            %  option: the options

            arguments
                name char {mustBeTextScalar}
                option.DerivativeLevel {mustBeMember(option.DerivativeLevel, {0,1,2})} = 1
                option.EqualityConstraintBoundary double {mustBePositive} = 0
            end

            obj.Name = name;
            % default options
            obj.Options = struct('DerivativeLevel', option.DerivativeLevel, ...
                'EqualityConstraintBoundary', option.EqualityConstraintBoundary);
	 end

修改后:

 	 function obj = NonlinearProgram(name)
            % The default class constructor function
            %
            % Parameters: 
            %  name: the name of the problem

            if nargin > 0
                validateattributes(name, {'char'},...
                    {'scalartext'},'NonlinearProgram','name');
                obj.Name = name;
            end
            % default options
            obj.Options = struct('DerivativeLevel', 1, ...
                'EqualityConstraintBoundary', 0);
	end

2)运行cassie_opt.m时报错

MEX 文件 '/home/robot/Desktop/Cassie_CFROST/submodules/frost-dev/third/ipopt/ipopt.mexa64' 无效: /lib/x86_64-linux-gnu/libm.so.6:
version `GLIBC_2.29' not found (required by /home/robot/Desktop/Cassie_CFROST/submodules/frost-dev/third/ipopt/ipopt.mexa64)

出错 IpoptApplication/optimize (第 48 行)
    [sol, info] = ipopt(x0, Funcs, opts);

出错 two_step.utils.solve (第 41 行)
        [sol, info] = optimize(solver, x0);

3)GLIBC版本过低

参考此方案解决,安装后最好重启以下电脑
注意:glibc错误会导致终端无法使用,替换前先备份原版本的文件,要是遇到删除后终端无法打开的情况,用同系统的启动盘复制原始文件替换即可恢复。

https://github.com/UMich-BipedLab/Cassie_CFROST
https://github.com/ayonga/frost-dev
https://github.com/UMich-BipedLab/Cassie_Model

猜你喜欢

转载自blog.csdn.net/qq_43309940/article/details/127560217
今日推荐