ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Hello,
I had the same issue that you had. What I found is that ROS has all their C++ libraries under /opt/ros/[version]/lib
. What you need to link to get ROS working is roscpp, rostime, rosconsole, roscpp_serialization, and boost_system. Include the ros headers to your project. They are under /opt/ros/[version]/include
.
To make ROS recognize that you have a project place an xml file called package.xml and load it the basic data for it to work. Then you need to set a ROS package path to the directory above the project root.
For example if your project is under ~/git/my_ros_project
you need to have the ROS_PACKAGE_PATH
environment variable set to export ROS_PACKAGE_PATH=~/git:$ROS_PACKAGE_PATH
. Then under the ~/git/my_ros_project
you need an project.xml file.
You can checkout my repository for a relative decent template structure if you need help. https://git.root3287.site/Root3287/ROS-Template. Then look into the premake5.lua file and see how the project is set up. All that is currently missing is generating MSG and SRV files which could be generated by the rosrun gencpp gen_cpp.py
command.
I hope this helps!
2 | No.2 Revision |
Hello,
I had the same issue that you had. What I found is that ROS has all their C++ libraries under /opt/ros/[version]/lib
. What you need to link to get ROS working is roscpp, rostime, rosconsole, roscpp_serialization, and boost_system. Include the ros headers to your project. They are under /opt/ros/[version]/include
.
To make ROS recognize that you have a project place an xml file called package.xml and load it the basic data for it to work. Then you need to set a ROS package path to the directory above the project root.
For example if your project is under ~/git/my_ros_project
you need to have the ROS_PACKAGE_PATH
environment variable set to export ROS_PACKAGE_PATH=~/git:$ROS_PACKAGE_PATH
. Then under the ~/git/my_ros_project
you need an project.xml file.
You can checkout my repository for a relative decent template structure if you need help. https://git.root3287.site/Root3287/ROS-Template. Then look into the premake5.lua file and see how the project is set up. All that is currently missing is generating MSG and SRV files which could be generated by the rosrun gencpp gen_cpp.py
command.
I hope this helps!
Edit 1: From the comments, if you installed ROS anywhere else, you need to change the /opt/ros
to where ever you installed ros. Check comments.