ROS与Arduino硬件之rosserial_arduino(win10)
大过节的,赶上现在这个病毒情况,为自己好为大家好,不出门瞎逛了,窝在家里写个贴吧。
虽说ROS的仿真软件gezabo功能很强悍,只要能写插件就可以模拟各种传感器执行器,
比如一个机器人有个显示器,这样的执行器就不易仿真,不如给现实的机器人上接个显示器来的快捷。
写gezabo插件也得有一定的功底。
还需要消耗人月,
最终机器人落地还得需要理论联系实际不是,不能让产品落地的创意也只能算臆想。
我们基于ros框架,快速搭建一个真实实验器械或机构时,需要的各种简单传感器和执行器。
比如给机器人系统加个数码管、超声、按键、舵机或者其他什么东西。
使用万能的Arduino开发制作是条捷径。
有了这样的传感器模块,就使得ros开发过程中灵活度很强,既不影响现有的系统,又能随意扩展。
当然开发这些模块我们可以自定义通讯协议,开发单片机程序,编写ros驱动节点进行协议解析,最终转换成ros消息,跟其他ros节点沟通。
不过ros生态已经准备了使用rosserial_arduino包的方案。
用此方案可以使arduino硬件内也可以像运行ros节点那样使用msg 和srv与上位机沟通。
硬件各个模块也变成了一个个节点,体现出ros分布式松耦合的特性,在开发过程中减少出错率,减少反复调试硬件的时间,减少协议通讯编代码的工作量。
其不足之处就是要额外占用单片机的一些资源。
总之这么好的懒人服务包怎么也要一啦
官方
简选前辈的博文
https://blog.csdn.net/wanzew/article/details/80030768
ROS学习之Arduino篇——rosserial_arduino包
1、源码安装
cd <ws>/src
git clone https://github.com/ros-drivers/rosserial.git
cd <ws>
catkin_make
catkin_make install
2、把 ros_lib 安装到Arduino的开发环境中
sketchbook为Arduino安装以后的项目文件夹路径
cd <sketchbook>/libraries
rm -rf ros_lib
rosrun rosserial_arduino make_libraries.py
就是说,这样的操作可以把ros的头文件,移植成arduino使用的头文件
看起来so easy ,让我们在win10下试试(注:如果你是ubuntu那下面的有些问题可能不会出现)。
克隆不必多说,
catkin_make会遇到这样的问题
本地已经安装过相应的ros包了,编译安装时重复会报错
主要错误提示如下
说
add_executable cannot create target
"make_libraries.py_executable_install_python" because another target with
the same name already exists. The existing target is an executable created
in source directory
全文
D:\project\ros\zzz_arduino>catkin_make
Base path: D:\project\ros\zzz_arduino
Source space: D:\project\ros\zzz_arduino\src
Build space: D:\project\ros\zzz_arduino\build
Devel space: D:\project\ros\zzz_arduino\devel
Install space: D:\project\ros\zzz_arduino\install
####
#### Running command: "nmake cmake_check_build_system" in "D:\project\ros\zzz_arduino\build"
####
Microsoft (R) ?????????ù??? 14.23.28107.0 ??
??????? (C) Microsoft Corporation?? ?????????????
CMake Warning (dev) in CMakeLists.txt:
No project() command is present. The top-level CMakeLists.txt file must
contain a literal, direct call to the project() command. Add a line of
code such as
project(ProjectName)
near the top of the file, but after cmake_minimum_required().
CMake is pretending there is a "project(Project)" command on the first
line.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Using CATKIN_DEVEL_PREFIX: D:/project/ros/zzz_arduino/devel
-- Using CMAKE_PREFIX_PATH: C:/opt/ros/melodic/x64;C:/opt/rosdeps/x64;C:/opt/vcpkg/installed/x64-windows
-- This workspace overlays: C:/opt/ros/melodic/x64
-- Using PYTHON_EXECUTABLE: C:/opt/python27amd64/python.exe
-- Using default Python package layout
-- Using empy: C:/opt/python27amd64/lib/site-packages/em.pyc
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: D:/project/ros/zzz_arduino/build/test_results
-- Found gtest: gtests will be built
-- Using Python nosetests: C:/opt/python27amd64/Scripts/nosetests-2.7.exe
-- catkin 0.7.18
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 14 packages in topological order:
-- ~~ - rosserial (metapackage)
-- ~~ - rosserial_arduino
-- ~~ - rosserial_mbed
-- ~~ - rosserial_msgs
-- ~~ - rosserial_python
-- ~~ - rosserial_tivac
-- ~~ - rosserial_vex_cortex
-- ~~ - rosserial_vex_v5
-- ~~ - rosserial_xbee
-- ~~ - rosserial_client
-- ~~ - rosserial_server
-- ~~ - rosserial_embeddedlinux
-- ~~ - rosserial_test
-- ~~ - rosserial_windows
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin metapackage: 'rosserial'
-- ==> add_subdirectory(rosserial/rosserial)
-- +++ processing catkin package: 'rosserial_arduino'
-- ==> add_subdirectory(rosserial/rosserial_arduino)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- rosserial_arduino: 1 messages, 1 services
-- +++ processing catkin package: 'rosserial_mbed'
-- ==> add_subdirectory(rosserial/rosserial_mbed)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- rosserial_mbed: 1 messages, 1 services
CMake Error at C:/opt/ros/melodic/x64/share/catkin/cmake/platform/windows.cmake:140 (add_executable):
add_executable cannot create target
"make_libraries.py_executable_install_python" because another target with
the same name already exists. The existing target is an executable created
in source directory
"D:/project/ros/zzz_arduino/src/rosserial/rosserial_arduino". See
documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
C:/opt/ros/melodic/x64/share/catkin/cmake/catkin_install_python.cmake:52 (add_python_executable)
rosserial/rosserial_mbed/CMakeLists.txt:27 (catkin_install_python)
-- +++ processing catkin package: 'rosserial_msgs'
-- ==> add_subdirectory(rosserial/rosserial_msgs)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- rosserial_msgs: 2 messages, 1 services
-- +++ processing catkin package: 'rosserial_python'
-- ==> add_subdirectory(rosserial/rosserial_python)
CMake Error at C:/opt/ros/melodic/x64/share/catkin/cmake/platform/windows.cmake:140 (add_executable):
add_executable cannot create target
"serial_node.py_executable_install_python" because another target with the
same name already exists. The existing target is an executable created in
source directory
"D:/project/ros/zzz_arduino/src/rosserial/rosserial_arduino". See
documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
C:/opt/ros/melodic/x64/share/catkin/cmake/catkin_install_python.cmake:52 (add_python_executable)
rosserial/rosserial_python/CMakeLists.txt:9 (catkin_install_python)
-- +++ processing catkin package: 'rosserial_tivac'
-- ==> add_subdirectory(rosserial/rosserial_tivac)
-- +++ processing catkin package: 'rosserial_vex_cortex'
-- ==> add_subdirectory(rosserial/rosserial_vex_cortex)
CMake Error at C:/opt/ros/melodic/x64/share/catkin/cmake/platform/windows.cmake:140 (add_executable):
add_executable cannot create target
"make_libraries.py_executable_install_python" because another target with
the same name already exists. The existing target is an executable created
in source directory
"D:/project/ros/zzz_arduino/src/rosserial/rosserial_arduino". See
documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
C:/opt/ros/melodic/x64/share/catkin/cmake/catkin_install_python.cmake:52 (add_python_executable)
rosserial/rosserial_vex_cortex/CMakeLists.txt:25 (catkin_install_python)
-- +++ processing catkin package: 'rosserial_vex_v5'
-- ==> add_subdirectory(rosserial/rosserial_vex_v5)
CMake Error at C:/opt/ros/melodic/x64/share/catkin/cmake/platform/windows.cmake:140 (add_executable):
add_executable cannot create target
"make_libraries.py_executable_install_python" because another target with
the same name already exists. The existing target is an executable created
in source directory
"D:/project/ros/zzz_arduino/src/rosserial/rosserial_arduino". See
documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
C:/opt/ros/melodic/x64/share/catkin/cmake/catkin_install_python.cmake:52 (add_python_executable)
rosserial/rosserial_vex_v5/CMakeLists.txt:25 (catkin_install_python)
-- +++ processing catkin package: 'rosserial_xbee'
-- ==> add_subdirectory(rosserial/rosserial_xbee)
-- +++ processing catkin package: 'rosserial_client'
-- ==> add_subdirectory(rosserial/rosserial_client)
-- +++ processing catkin package: 'rosserial_server'
-- ==> add_subdirectory(rosserial/rosserial_server)
-- +++ processing catkin package: 'rosserial_embeddedlinux'
-- ==> add_subdirectory(rosserial/rosserial_embeddedlinux)
CMake Error at C:/opt/ros/melodic/x64/share/catkin/cmake/platform/windows.cmake:140 (add_executable):
add_executable cannot create target
"make_libraries.py_executable_install_python" because another target with
the same name already exists. The existing target is an executable created
in source directory
"D:/project/ros/zzz_arduino/src/rosserial/rosserial_arduino". See
documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
C:/opt/ros/melodic/x64/share/catkin/cmake/catkin_install_python.cmake:52 (add_python_executable)
rosserial/rosserial_embeddedlinux/CMakeLists.txt:16 (catkin_install_python)
-- +++ processing catkin package: 'rosserial_test'
-- ==> add_subdirectory(rosserial/rosserial_test)
-- +++ processing catkin package: 'rosserial_windows'
-- ==> add_subdirectory(rosserial/rosserial_windows)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
CMake Error at C:/opt/ros/melodic/x64/share/catkin/cmake/platform/windows.cmake:140 (add_executable):
add_executable cannot create target
"make_libraries.py_executable_install_python" because another target with
the same name already exists. The existing target is an executable created
in source directory
"D:/project/ros/zzz_arduino/src/rosserial/rosserial_arduino". See
documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
C:/opt/ros/melodic/x64/share/catkin/cmake/catkin_install_python.cmake:52 (add_python_executable)
rosserial/rosserial_windows/CMakeLists.txt:18 (catkin_install_python)
-- Configuring incomplete, errors occurred!
See also "D:/project/ros/zzz_arduino/build/CMakeFiles/CMakeOutput.log".
See also "D:/project/ros/zzz_arduino/build/CMakeFiles/CMakeError.log".
NMAKE : fatal error U1077: ??C:\opt\python27amd64\Lib\site-packages\cmake\data\bin\cmake.exe??: ???????0x1??
Stop.
Invoking "nmake cmake_check_build_system" failed
相关问题
https://answers.ros.org/question/212536/cmake-error-add_executable/
引用
add_custom_target cannot create target "pcl_ros_gencfg" because another
target with the same name already exists. The existing target is a custom
target created in source directory "/home/gordon/catkin_ws/src/flight".
See documentation for policy CMP0002 for more details.
CMake Error at navigation/voxel_grid/CMakeLists.txt:28 (add_executable):
add_executable cannot create target "voxel_grid" because another target
with the same name already exists. The existing target is a shared library
created in source directory
"/home/gordon/catkin_ws/src/navigation/voxel_grid". See documentation for
policy CMP0002 for more details.
I know of one solution that is to use catkin_make_isolated to prevent these from happening but I was told that it will make the whole thing work slower.
!!!!!!!!!!!!!!
catkin_make_isolated
!!!!!!!!!!!!!!
不改变现有的环境,使用隔离编译。
又遇到一个小问题,Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. 原因是window版本和Ubuntu版本编译配置不同吧。
D:\project\ros\zzz_arduino>catkin_make_isolated
。。。。。。
[ 50%] Building CXX object CMakeFiles/rosserial_server_serial_node.dir/src/serial_node.cpp.obj
serial_node.cpp
Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:
- add -D_WIN32_WINNT=0x0501 to the compiler command line; or
- add _WIN32_WINNT=0x0501 to your project's Preprocessor Definitions.
Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
D:\project\ros\zzz_arduino\devel_isolated\rosserial_msgs\include\rosserial_msgs/Log.h(50): error C2143: 语法错误: 缺少“}”(在“常数”的前面)
D:\project\ros\zzz_arduino\devel_isolated\rosserial_msgs\include\rosserial_msgs/Log.h(58): note: 查看对正在编译的 类 模板 实例化“rosserial_msgs::Log_<ContainerAllocator>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(54): note: 查看对正在编译的 类 模板 实例化“boost::arg<9>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(53): note: 查看对正在编译的 类 模板 实例化“boost::arg<8>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(52): note: 查看对正在编译的 类 模板 实例化“boost::arg<7>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(51): note: 查看对正在编译的 类 模板 实例化“boost::arg<6>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(50): note: 查看对正在编译的 类 模板 实例化“boost::arg<5>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(49): note: 查看对正在编译的 类 模板 实例化“boost::arg<4>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(48): note: 查看对正在编译的 类 模板 实例化“boost::arg<3>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(47): note: 查看对正在编译的 类 模板 实例化“boost::arg<2>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(46): note: 查看对正在编译的 类 模板 实例化“boost::arg<1>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/asio/use_future.hpp(138): note: 查看对正在编译的 类 模板 实例化“boost::asio::use_future_t<std::allocator<void>>::std_allocator_void”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/asio/use_future.hpp(146): note: 查看对正在编译的 类 模板 实例化“boost::asio::use_future_t<std::allocator<void>>”的引用
D:\project\ros\zzz_arduino\devel_isolated\rosserial_msgs\include\rosserial_msgs/Log.h(50): error C2059: 语法错误:“常数”
D:\project\ros\zzz_arduino\devel_isolated\rosserial_msgs\include\rosserial_msgs/Log.h(52): error C2143: 语法错误: 缺少“;”(在“}”的前面)
D:\project\ros\zzz_arduino\devel_isolated\rosserial_msgs\include\rosserial_msgs/Log.h(52): error C2238: 意外的标记位于“;”之前
D:\project\ros\zzz_arduino\src\rosserial\rosserial_server\include\rosserial_server/topic_handlers.h(111): warning C4267: “参数”: 从“size_t”转换到 “uint32_t”,可能丢失数据
D:\project\ros\zzz_arduino\src\rosserial\rosserial_server\include\rosserial_server/topic_handlers.h(178): warning C4267: “参数”: 从“size_t”转换到 “uint32_t”,可能丢失数据
NMAKE : fatal error U1077: “E:\PROGRA~3\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1423~1.281\bin\Hostx64\x64\cl.exe”: 返回代码“0x2”
Stop.
NMAKE : fatal error U1077: “"E:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\HostX64\x64\nmake.exe"”: 返回代码“0x2”
Stop.
NMAKE : fatal error U1077: “"E:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\HostX64\x64\nmake.exe"”: 返回代码“0x2”
Stop.
<== Failed to process package 'rosserial_server':
Command '['D:\\project\\ros\\zzz_arduino\\devel_isolated\\rosserial_python\\env.bat', 'nmake']' returned non-zero exit status 2
Reproduce this error by running:
==> cd 'D:\project\ros\zzz_arduino\build_isolated\rosserial_server' && 'D:\project\ros\zzz_arduino\devel_isolated\rosserial_python\env.bat' nmake
Command failed, exiting.
新的问题
Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. 问题
解决
https://blog.csdn.net/sols000/article/details/85615819
在编译ASIO 时,出现编译警告Please define _WIN32_WINNT 解决办法
包含头文件 #include <sdkddkver.h>即可。
改一改源文件,不过还是有问题:
D:\project\ros\zzz_arduino>catkin_make_isolated
。。。。。。
[ 50%] Building CXX object CMakeFiles/rosserial_server_serial_node.dir/src/serial_node.cpp.obj
serial_node.cpp
D:\project\ros\zzz_arduino\devel_isolated\rosserial_msgs\include\rosserial_msgs/Log.h(50): error C2143: 语法错误: 缺少“}”(在“常数”的前面)
D:\project\ros\zzz_arduino\devel_isolated\rosserial_msgs\include\rosserial_msgs/Log.h(58): note: 查看对正在编译的 类 模板 实例化“rosserial_msgs::Log_<ContainerAllocator>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(54): note: 查看对正在编译的 类 模板 实例化“boost::arg<9>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(53): note: 查看对正在编译的 类 模板 实例化“boost::arg<8>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(52): note: 查看对正在编译的 类 模板 实例化“boost::arg<7>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(51): note: 查看对正在编译的 类 模板 实例化“boost::arg<6>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(50): note: 查看对正在编译的 类 模板 实例化“boost::arg<5>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(49): note: 查看对正在编译的 类 模板 实例化“boost::arg<4>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(48): note: 查看对正在编译的 类 模板 实例化“boost::arg<3>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(47): note: 查看对正在编译的 类 模板 实例化“boost::arg<2>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/bind/placeholders.hpp(46): note: 查看对正在编译的 类 模板 实例化“boost::arg<1>”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/asio/use_future.hpp(138): note: 查看对正在编译的 类 模板 实例化“boost::asio::use_future_t<std::allocator<void>>::std_allocator_void”的引用
C:\opt\rosdeps\x64\include\boost-1_66\boost/asio/use_future.hpp(146): note: 查看对正在编译的 类 模板 实例化“boost::asio::use_future_t<std::allocator<void>>”的引用
D:\project\ros\zzz_arduino\devel_isolated\rosserial_msgs\include\rosserial_msgs/Log.h(50): error C2059: 语法错误:“常数”
D:\project\ros\zzz_arduino\devel_isolated\rosserial_msgs\include\rosserial_msgs/Log.h(52): error C2143: 语法错误: 缺少“;”(在“}”的前面)
D:\project\ros\zzz_arduino\devel_isolated\rosserial_msgs\include\rosserial_msgs/Log.h(52): error C2238: 意外的标记位于“;”之前
D:\project\ros\zzz_arduino\src\rosserial\rosserial_server\include\rosserial_server/topic_handlers.h(111): warning C4267: “参数”: 从“size_t”转换到 “uint32_t”,可能丢失数据
D:\project\ros\zzz_arduino\src\rosserial\rosserial_server\include\rosserial_server/topic_handlers.h(178): warning C4267: “参数”: 从“size_t”转换到 “uint32_t”,可能丢失数据
NMAKE : fatal error U1077: “E:\PROGRA~3\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1423~1.281\bin\Hostx64\x64\cl.exe”: 返回代码“0x2”
Stop.
NMAKE : fatal error U1077: “"E:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\HostX64\x64\nmake.exe"”: 返回代码“0x2”
Stop.
NMAKE : fatal error U1077: “"E:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\HostX64\x64\nmake.exe"”: 返回代码“0x2”
Stop.
<== Failed to process package 'rosserial_server':
Command '['D:\\project\\ros\\zzz_arduino\\devel_isolated\\rosserial_python\\env.bat', 'nmake']' returned non-zero exit status 2
Reproduce this error by running:
==> cd 'D:\project\ros\zzz_arduino\build_isolated\rosserial_server' && 'D:\project\ros\zzz_arduino\devel_isolated\rosserial_python\env.bat' nmake
Command failed, exiting.
好吧,ubuntu还是跟windows不一样。有问题放一放,暂时不解决这个问题,注释掉注释掉!!所有相关的统统注释掉。CMakeLists.txt:注释
#add_executable(${PROJECT_NAME}_serial_node src/serial_node.cpp)
#target_link_libraries(${PROJECT_NAME}_serial_node ${catkin_LIBRARIES} ${PROJECT_NAME}_lookup)
#set_target_properties(${PROJECT_NAME}_serial_node PROPERTIES OUTPUT_NAME serial_node PREFIX "")
#add_dependencies(${PROJECT_NAME}_serial_node ${catkin_EXPORTED_TARGETS})
#add_executable(${PROJECT_NAME}_socket_node src/socket_node.cpp)
#target_link_libraries(${PROJECT_NAME}_socket_node ${catkin_LIBRARIES} ${PROJECT_NAME}_lookup)
#set_target_properties(${PROJECT_NAME}_socket_node PROPERTIES OUTPUT_NAME socket_node PREFIX "")
#add_dependencies(${PROJECT_NAME}_socket_node ${catkin_EXPORTED_TARGETS})
#add_executable(${PROJECT_NAME}_udp_socket_node src/udp_socket_node.cpp)
#target_link_libraries(${PROJECT_NAME}_udp_socket_node ${catkin_LIBRARIES} ${PROJECT_NAME}_lookup)
#set_target_properties(${PROJECT_NAME}_udp_socket_node PROPERTIES OUTPUT_NAME udp_socket_node PREFIX "")
#add_dependencies(${PROJECT_NAME}_udp_socket_node ${catkin_EXPORTED_TARGETS})
#install(
#TARGETS
#${PROJECT_NAME}_serial_node
#${PROJECT_NAME}_socket_node
#${PROJECT_NAME}_udp_socket_node
#RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
#)
编译成功
是不是可以只取关键的包编译,进行转换呢?有待试验
-------------------------------------------------------------------------------------
执行命令
rosrun rosserial_arduino make_libraries.py
命令生成rospack返回的所有包的头文件,包括msg、srv的头文件。
拷贝到arduino库libraries/ros_lib中
开发硬件程序时,可以include这些文件。
python部分代码
rospack = rospkg.RosPack()
# copy ros_lib stuff in 复制rosserial_arduino包内ros_lib的内容
rosserial_arduino_dir = rospack.get_path(THIS_PACKAGE)
shutil.copytree(rosserial_arduino_dir+"/src/ros_lib", path+"/ros_lib")
rosserial_client_copy_files(rospack, path+"/ros_lib/")#ros中所有包的头文件??
# generate messages依照ros中定义的 msg srv ,生成嵌入式程序用的消息 .h文件(自动移植)
rosserial_generate(rospack, path+"/ros_lib", ROS_TO_EMBEDDED_TYPES)
最后运行make_libraries.py提示需要Arduino sketchbook/libraries folder目录参数
D:\project\ros\zzz_arduino\a>rosrun rosserial_arduino make_libraries.py
make_libraries.py generates the Arduino rosserial library files. It
requires the location of your Arduino sketchbook/libraries folder.
rosrun rosserial_arduino make_libraries.py <output_path>
好吧,先随意找个目录测试:
D:\project\ros\zzz_arduino\a>rosrun rosserial_arduino make_libraries.py D:\project\ros\zzz_arduino\a
Exporting to D:\project\ros\zzz_arduino\a
Exporting actionlib
Messages:
TestAction,TestActionFeedback,TestActionGoal,TestActionResult,TestFeedback,TestGoal,TestRequestAction,TestRequestActionFeedback,TestRequestActionGoal,TestRequestActionResult,TestRequestFeedback,TestRequestGoal,TestRequestResult,TestResult,TwoIntsAction,TwoIntsActionFeedback,TwoIntsActionGoal,TwoIntsActionResult,TwoIntsFeedback,TwoIntsGoal,TwoIntsResult,
Exporting actionlib_msgs
Messages:
GoalID,GoalStatus,GoalStatusArray,
Exporting actionlib_tutorials
Messages:
AveragingAction,AveragingActionFeedback,AveragingActionGoal,AveragingActionResult,AveragingFeedback,AveragingGoal,AveragingResult,FibonacciAction,FibonacciActionFeedback,FibonacciActionGoal,FibonacciActionResult,FibonacciFeedback,FibonacciGoal,FibonacciResult,
Exporting base_local_planner
Messages:
Position2DInt,
Exporting bond
Messages:
Constants,Status,
Exporting control_msgs
Messages:
FollowJointTrajectoryAction,FollowJointTrajectoryActionFeedback,FollowJointTrajectoryActionGoal,FollowJointTrajectoryActionResult,FollowJointTrajectoryFeedback,FollowJointTrajectoryGoal,FollowJointTrajectoryResult,GripperCommand,GripperCommandAction,GripperCommandActionFeedback,GripperCommandActionGoal,GripperCommandActionResult,GripperCommandFeedback,GripperCommandGoal,GripperCommandResult,JointControllerState,JointJog,JointTolerance,JointTrajectoryAction,JointTrajectoryActionFeedback,JointTrajectoryActionGoal,JointTrajectoryActionResult,JointTrajectoryControllerState,JointTrajectoryFeedback,JointTrajectoryGoal,JointTrajectoryResult,PidState,PointHeadAction,PointHeadActionFeedback,PointHeadActionGoal,PointHeadActionResult,PointHeadFeedback,PointHeadGoal,PointHeadResult,SingleJointPositionAction,SingleJointPositionActionFeedback,SingleJointPositionActionGoal,SingleJointPositionActionResult,SingleJointPositionFeedback,SingleJointPositionGoal,SingleJointPositionResult,
Services:
QueryCalibrationState,QueryTrajectoryState,
Exporting control_toolbox
Services:
SetPidGains,
Exporting controller_manager_msgs
Messages:
ControllersStatistics,ControllerState,ControllerStatistics,HardwareInterfaceResources,
Services:
ListControllers,ListControllerTypes,LoadController,ReloadControllerLibraries,SwitchController,UnloadController,
Exporting costmap_2d
Messages:
VoxelGrid,
Exporting diagnostic_msgs
Messages:
DiagnosticArray,DiagnosticStatus,KeyValue,
Services:
AddDiagnostics,SelfTest,
Exporting dynamic_reconfigure
Messages:
BoolParameter,Config,ConfigDescription,DoubleParameter,Group,GroupState,IntParameter,ParamDescription,SensorLevels,StrParameter,
Services:
Reconfigure,
Exporting gazebo_msgs
Messages:
ContactsState,ContactState,LinkState,LinkStates,ModelState,ModelStates,ODEJointProperties,ODEPhysics,WorldState,
Services:
ApplyBodyWrench,ApplyJointEffort,BodyRequest,DeleteLight,DeleteModel,GetJointProperties,GetLightProperties,GetLinkProperties,GetLinkState,GetModelProperties,GetModelState,GetPhysicsProperties,GetWorldProperties,JointRequest,SetJointProperties,SetJointTrajectory,SetLightProperties,SetLinkProperties,SetLinkState,SetModelConfiguration,SetModelState,SetPhysicsProperties,SpawnModel,
Exporting geometry_msgs
Messages:
Accel,AccelStamped,AccelWithCovariance,AccelWithCovarianceStamped,Inertia,InertiaStamped,Point,Point32,PointStamped,Polygon,PolygonStamped,Pose,Pose2D,PoseArray,PoseStamped,PoseWithCovariance,PoseWithCovarianceStamped,Quaternion,QuaternionStamped,Transform,TransformStamped,Twist,TwistStamped,TwistWithCovariance,TwistWithCovarianceStamped,Vector3,Vector3Stamped,Wrench,WrenchStamped,
Exporting laser_assembler
Services:
AssembleScans,AssembleScans2,
Exporting map_msgs
Messages:
OccupancyGridUpdate,PointCloud2Update,ProjectedMap,ProjectedMapInfo,
Services:
GetMapROI,GetPointMap,GetPointMapROI,ProjectedMapsInfo,SaveMap,SetMapProjections,
Exporting move_base_msgs
Messages:
MoveBaseAction,MoveBaseActionFeedback,MoveBaseActionGoal,MoveBaseActionResult,MoveBaseFeedback,MoveBaseGoal,MoveBaseResult,
Exporting nav_msgs
Messages:
GetMapAction,GetMapActionFeedback,GetMapActionGoal,GetMapActionResult,GetMapFeedback,GetMapGoal,GetMapResult,GridCells,MapMetaData,OccupancyGrid,Odometry,Path,
Services:
GetMap,GetPlan,SetMap,
Exporting navfn
Services:
MakeNavPlan,SetCostmap,
Exporting nodelet
Services:
NodeletList,NodeletLoad,NodeletUnload,
Exporting pcl_msgs
Messages:
ModelCoefficients,PointIndices,PolygonMesh,Vertices,
Services:
UpdateFilename,
Exporting polled_camera
Services:
GetPolledImage,
Exporting robotiq_2f_gripper_control
Messages:
Robotiq2FGripper_robot_input,Robotiq2FGripper_robot_output,
Exporting roscpp
Messages:
Logger,
Services:
Empty,GetLoggers,SetLoggerLevel,
Exporting roscpp_tutorials
Services:
TwoInts,
Exporting rosgraph_msgs
Messages:
Clock,Log,TopicStatistics,
Exporting rospy_tutorials
Messages:
Floats,HeaderString,
Services:
AddTwoInts,BadTwoInts,
Exporting rosserial_arduino
Messages:
Adc,
Services:
Test,
Exporting rosserial_mbed
Messages:
Adc,
Services:
Test,
Exporting rosserial_msgs
Messages:
Log,TopicInfo,
Services:
RequestMessageInfo,the rosdep view is empty: call 'sudo rosdep init' and 'rosdep update'
Unable to build service: rosserial_msgs/RequestMessageInfo
RequestParam,RequestServiceInfo,Unable to build service: rosserial_msgs/RequestServiceInfo
Exporting sensor_msgs
Messages:
BatteryState,CameraInfo,ChannelFloat32,CompressedImage,FluidPressure,Illuminance,Image,Imu,JointState,Joy,JoyFeedback,JoyFeedbackArray,LaserEcho,LaserScan,MagneticField,MultiDOFJointState,MultiEchoLaserScan,NavSatFix,NavSatStatus,PointCloud,PointCloud2,PointField,Range,RegionOfInterest,RelativeHumidity,Temperature,TimeReference,
Services:
SetCameraInfo,
Exporting shape_msgs
Messages:
Mesh,MeshTriangle,Plane,SolidPrimitive,
Exporting smach_msgs
Messages:
SmachContainerInitialStatusCmd,SmachContainerStatus,SmachContainerStructure,
Exporting std_msgs
Messages:
Bool,Byte,ByteMultiArray,Char,ColorRGBA,Duration,Empty,Float32,Float32MultiArray,Float64,Float64MultiArray,Header,Int16,Int16MultiArray,Int32,Int32MultiArray,Int64,Int64MultiArray,Int8,Int8MultiArray,MultiArrayDimension,MultiArrayLayout,String,Time,UInt16,UInt16MultiArray,UInt32,UInt32MultiArray,UInt64,UInt64MultiArray,UInt8,UInt8MultiArray,
Exporting std_srvs
Services:
Empty,SetBool,Trigger,
Exporting stereo_msgs
Messages:
DisparityImage,
Exporting tf
Messages:
tfMessage,
Services:
FrameGraph,
Exporting tf2_msgs
Messages:
LookupTransformAction,LookupTransformActionFeedback,LookupTransformActionGoal,LookupTransformActionResult,LookupTransformFeedback,LookupTransformGoal,LookupTransformResult,TF2Error,TFMessage,
Services:
FrameGraph,
Exporting theora_image_transport
Messages:
Packet,
Exporting topic_tools
Services:
DemuxAdd,DemuxDelete,DemuxList,DemuxSelect,MuxAdd,MuxDelete,MuxList,MuxSelect,
Exporting trajectory_msgs
Messages:
JointTrajectory,JointTrajectoryPoint,MultiDOFJointTrajectory,MultiDOFJointTrajectoryPoint,
Exporting turtle_actionlib
Messages:
ShapeAction,ShapeActionFeedback,ShapeActionGoal,ShapeActionResult,ShapeFeedback,ShapeGoal,ShapeResult,Velocity,
Exporting turtlesim
Messages:
Color,Pose,
Services:
Kill,SetPen,Spawn,TeleportAbsolute,TeleportRelative,
Exporting visualization_msgs
Messages:
ImageMarker,InteractiveMarker,InteractiveMarkerControl,InteractiveMarkerFeedback,InteractiveMarkerInit,InteractiveMarkerPose,InteractiveMarkerUpdate,Marker,MarkerArray,MenuEntry,
成功!
依葫芦画瓢,现在自定义一个msg和srv来生成arduino使用的头文件,开发个arduino ros节点试试吧。