例子:Behavior Trees in Robotics and AI
一、编译报错 – 已解决√
输入cmake …命令时报错如下:
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find Lua (missing: LUA_LIBRARIES LUA_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.16/Modules/FindLua.cmake:231 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
bt_editor/CMakeLists.txt:24 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/xj/E2024/youbot/build/CMakeFiles/CMakeOutput.log".
See also "/home/xj/E2024/youbot/build/CMakeFiles/CMakeError.log".
按这个操作,不报错了。
Solution:
Install a recent Lua version including the development files. First try:
sudo apt -y install liblua5.4-dev
if that package can’t be found, try
sudo apt -y install liblua5.3-dev
and go on trying liblua5.2-dev, liblua5.1-dev or liblua5.0-dev. Which version will work depends on your Ubuntu version.
然后运行结果如下:
(base) xj@xj:~/E2024/youbot/build$ cmake ..
CMake Warning (dev) at CMakeLists.txt:3 (project):
Policy CMP0048 is not set: project() command manages VERSION variables.
Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
The following variable(s) would be set to empty:
CMAKE_PROJECT_VERSION
CMAKE_PROJECT_VERSION_MAJOR
CMAKE_PROJECT_VERSION_MINOR
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found Lua: /usr/lib/x86_64-linux-gnu/liblua5.3.so;/usr/lib/x86_64-linux-gnu/libm.so (found version "5.3.3")
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xj/E2024/youbot/build
二、程序运行报错 – 已解决√
打开vrep时报错:
[CoppeliaSim:error] plugin 'ROS2Interface': load failed (could not load). The plugin probably couldn't load dependency libraries. For additional infos, modify the script 'libLoadErrorCheck.sh', run it and inspect the output.
解决办法: 再打开vrep之前运行roscore就可以了。
vrep中小车开始移动,并尝试抓住方块,但是始终无法抓住,并且报错如下:
[/youBot@childScript:error] 1326: in sim._getObjectHandle: object does not exist, or alias/path is ill formatted.
Since CoppeliaSim V4.3.0, objects should be retrieved via a path and alias, e.g. "./path/to/alias", ":/path/to/alias", "/path/to/alias", etc.
You however tried to access an object in a way that doesn't follow the new notation, i.e. "place1" wasn't found.
Note also that object aliases are distinct from object names, which are deprecated and not displayed anymore. Additionally, sim.getObject is preferred over sim.getObjectHandle.
Make sure to read the following page for additional details: https://www.coppeliarobotics.com/helpFiles/en/accessingSceneObjects.htm
stack traceback:
[C]: in function 'sim._getObjectHandle'
/home/xj/CoppeliaSim/lua/sim.lua:1326: in function 'sim.getObjectHandle'
[string "/youBot@childScript"]:229: in function 'sim_code_function_to_run'
把vrep版本换成4.1.0,又报错:
[youBot@childScript:error] 229: Object does not exist. (in function 'sim.getObjectHandle')
stack traceback:
[C]: in function 'getObjectHandle'
[string "youBot@childScript"]:229: in main chunk
说明不是版本的问题。
解决方案:
参考这篇博文vrep.CoppeliaSim 4.1与4.3在获取对象句柄的区别,把youbot的script里面所有的
XXX=sim.getObjectHandle('YYY')
改为
XXX=sim.getObject('./YYY')
再运行就不报错了。
三、没有解决终极问题: -_-
但是。。。vrep中小车开始移动,并尝试抓住方块,还是始终无法抓住,夹爪一抓住方块就扔掉是为什么呢?最后小车摇摇晃晃的慢慢停下来了也没抓住。