问题描述
我想在catkin工作区之外创建ROS发布者节点。
可以创建吗?
I want to create a ROS publisher node outside a catkin workspace.Can it be created?
推荐答案
当然可以。像对待其他任何cpp库或python包一样对待ROS。
Of course you can. Treat ROS like any other cpp library or python package.
在python中,必须保持 PYTHONPATH
环境变量指向在 /opt/ros/kinetic/lib/python2.7/dist-packages
中的ros软件包。
In python you have to keep PYTHONPATH
environment variable pointing to ros packages in /opt/ros/kinetic/lib/python2.7/dist-packages
.
在cpp中您必须告诉编译器在哪里寻找包含( / opt / ros / kinetic / include
),库( / opt / ros / kinetic / lib
)以及要导入的库。对于最简单的应用程序, -lroscpp -lrostime -lrosconsole
就足够了。例如:
In cpp you have to tell compiler where to look for includes (/opt/ros/kinetic/include
), libraries (/opt/ros/kinetic/lib
) and which library to import. For the simplest application -lroscpp -lrostime -lrosconsole
should be sufficient. Ex:
g++ node.cpp -o node -I/opt/ros/kinetic/include -L/opt/ros/kinetic/lib -lroscpp -lrostime -lrosconsole
请记住,您仍然需要ros环境变量,例如 ROS_MASTER_URI
。
Remember that you still need ros environment variables like ROS_MASTER_URI
.
但是,我不知道是否有一种简单的方法可以在不使用<$ c的情况下生成自定义ros消息$ c> catkin_make 和cmake文件。
However, I don't know if there is an easy way to generate custom ros messages without using catkin_make
and cmake files.
这篇关于可以在柳絮工作区之外创建ROS节点吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!