I want to create a ROS publisher node outside a catkin workspace. Can it be created?
相关问题
- How can I embed another software in my qt window i
- ROS, opencv3 and CMake - unable to remove the libr
- Drone's motion is unstable with ROS topics
- Cmake not detecting boost-python when installing R
- Add CUDA to ROS Package
相关文章
- How would you publish a message in ROS of a vector
- How to port a qmake project to cmake
- Kinect / Primesense (Xtion) ROS Ubuntu through Vir
- Import OpenCV Mat into C++ Tensorflow without copy
- 如何启动一个节点,在ROS2参数?(How to launch a node with a para
- 使用rostopic酒馆时发布/订阅的问题(Publisher/Subscriber issues
- 关于Python并行处理[复制](Parallel Processing on Python [du
- ROS水电opencv2“catkin_make”期间链接错误(ROS hydro opencv2
Yes, in Python, you can write ROS nodes outside your catkin workspace.
Launch your
roscore
and then run the Python script in a new terminal normally likepython filename
and it runs as it would if you had placed in inside your catkin workspace and built and sourced it.I have successfully created subscriber and publisher nodes and run them on an actual TurtleBot2 without the nodes being inside the catkin workspace.
I don't think the method I have described works for C++. It only works for Python. In C++ you will have to link the libraries while compiling. So, check that. For example, we do g++ filename.cpp -lm, where -lm links the math library to be used in the filename.cpp, so you might need to check how to do that. On the other hand, it is easier to just add the file in your catkin workspace or just shift to Python.
You have to include ros/ros.h and std_msgs/message_name.h where message_name is replaced by whatever message you're using in code. You might find these files somewhere or you can get the source code of the files online by searching.
Of course you can. Treat ROS like any other cpp library or python package.
In python you have to keep
PYTHONPATH
environment variable pointing to ros packages in/opt/ros/kinetic/lib/python2.7/dist-packages
.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:Remember that you still need ros environment variables like
ROS_MASTER_URI
.However, I don't know if there is an easy way to generate custom ros messages without using
catkin_make
and cmake files.