OpenSim教程五 |
您所在的位置:网站首页 › opensim软件有什么用 › OpenSim教程五 |
OpenSim是开源的生物力学仿真系统,官方提供的GUI软件可以满足一般的模型编辑、运动学数据导入、动力学仿真查看等任务。但如果用户想根据自己需要扩展一些功能(如编写插件、自定义驱动方法、在其他软件中调用OpenSim接口等),就需要源码安装OpenSim了。 跟所有开源C++项目一样,OpenSim的源码安装需要用到git,CMake、MSVC等工具,对于新手来说具有一定难度。我也是根据Github上Readme的指引倒腾了很久才安装成功。先说一下几个需要注意的问题:1、安装的工具要具有相同的位数(32位或64位);2、要把电脑系统语言设置为英文;3、编译安装需要长时间等待。 下面是我根据官方指引在windows 10下源码安装OpenSim 4.0的步骤: 1、下载安装Visual Studio、git、CMake、Chocolatey等工具; 2、以管理员身份打开PowerShell,运行指令 choco install python2 jdk8 swig3、通过git下载OpenSim源代码 git clone https://github.com/opensim-org/opensim-core.git4、编译、安装依赖库BTK、docopt和simbody mkdir opensim_dependencies_build cd .\opensim_dependencies_build cmake ..\opensim-core\dependencies ` -G"Visual Studio 15 2017 Win64" ` -DCMAKE_INSTALL_PREFIX="..\opensim_dependencies_install" cmake --build . --config RelWithDebInfo -- /maxcpucount:8结束后会在C:\opensim_dependencies_install文件夹中出现三个包含对应内容的子文件夹。 5、生成OpenSim解决方案并编译 cd .. mkdir opensim_build cd .\opensim_build cmake ..\opensim-core ` -G"Visual Studio 15 2017 Win64" ` -DCMAKE_INSTALL_PREFIX="..\opensim_install" ` -DOPENSIM_DEPENDENCIES_DIR="..\opensim_dependencies_install" ` -DBUILD_JAVA_WRAPPING=ON ` -DBUILD_PYTHON_WRAPPING=ON ` -DWITH_BTK=ON cmake --build . --config RelWithDebInfo -- /maxcpucount:8这里的JAVA_WRAPPING设为on是为了在matlab中顺利调用OpenSim画图接口,编译过程中会闪过设置matlab的窗口;PYTHON_WRAPPING设为on是为了用python调用OpenSim接口。 6、单元测试 ctest --build-config RelWithDebInfo --parallel 8测试主要函数是否能正确使用 7、安装到指定文件夹 cmake --build . --config RelWithDebInfo --target install -- /maxcpucount:8结束后在C:\opensim_install文件夹会包含OpenSim的所有内容 至此,OpenSim的安装就结束了。大家可以根据自己的软件版本和安装目录自行修改上面指令,祝顺利! |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |