chobitsfan / mavlink-udp-proxy

2 stars 2 forks source link

Missing ros/ros.h #1

Open patrickpoirier51 opened 12 months ago

patrickpoirier51 commented 12 months ago

Hello @chobitsfan

Trying to build but it is missing ros/ros.h I have ros noetic install but this is not built as a standalonr (not as a catskin module)

STEPS: git clone https://github.com/chobitsfan/mavlink-udp-proxy.git git checkout fcu_imu git submodule update --init --recursive

./build_it

ERROR: Submodule 'mavlink' (https://github.com/mavlink/c_library_v2.git) registered for path 'mavlink' Cloning into '/home/orangepi/mavlink-udp-proxy/mavlink'... Submodule path 'mavlink': checked out '4d067a7fb9ac5609168678d5d9fd4e2ffe55b708' orangepi@orangepizero2w:~/mavlink-udp-proxy$ ./build_it my_mavlink_udp.cpp:19:10: fatal error: ros/ros.h: No such file or directory 19 | #include <ros/ros.h> | ^~~ compilation terminated.

chobitsfan commented 12 months ago

Hi @patrickpoirier51

May you need to source ros setup.bash first?

patrickpoirier51 commented 12 months ago

Well, it is already part of my bashrc

source /opt/ros/noetic/setup.bash source /home/orangepi/ros_ws/devel/setup.bash

printenv | grep ros PKG_CONFIG_PATH=/home/orangepi/ros_ws/devel/lib/pkgconfig:/opt/ros/noetic/lib/pkgconfig ROS_PACKAGE_PATH=/home/orangepi/ros_ws/src/VINS-Mono-fcu_imu/benchmark_publisher:/home/orangepi/ros_ws/src/VINS-Mono-fcu_imu/camera_model:/home/orangepi/ros_ws/src/VINS-Mono-fcu_imu/ar_demo:/home/orangepi/ros_ws/src/VINS-Mono-fcu_imu/feature_tracker:/home/orangepi/ros_ws/src/VINS-Mono-fcu_imu/pose_graph:/home/orangepi/ros_ws/src/VINS-Mono-fcu_imu/vins_estimator:/opt/ros/noetic/share ROSLISP_PACKAGE_DIRECTORIES=/home/orangepi/ros_ws/devel/share/common-lisp ROS_ETC_DIR=/opt/ros/noetic/etc/ros CMAKE_PREFIX_PATH=/home/orangepi/ros_ws/devel:/opt/ros/noetic PYTHONPATH=/opt/ros/noetic/lib/python3/dist-packages LD_LIBRARY_PATH=/home/orangepi/ros_ws/devel/lib:/opt/ros/noetic/lib PATH=/opt/ros/noetic/bin:/usr/lib/ccache:/home/orangepi/ardupilot/Tools/autotest:/opt/gcc-arm-none-eabi-10-2020-q4-major/bin:/home/orangepi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin ROS_ROOT=/opt/ros/noetic/share/ros

patrickpoirier51 commented 12 months ago

OK Found answer here

https://roboticsbackend.com/ros-node-outside-catkin-workspace/ need to add path during build -I/opt/ros/noetic/include -L/opt/ros/noetic/lib

g++ -O1 -g0 -Wall -Wno-address-of-packed-member -Wno-unused-result my_mavlink_udp.cpp -o mavlink_udp -I/opt/ros/noetic/include -L/opt/ros/noetic/lib -lm -lroscpp -lrostime -lrosconsole -lroscpp_serialization

chobitsfan commented 12 months ago

Thank you @patrickpoirier51

I found the reason why I do not need to specify path. I install ros from debian repository. It is then installed to system folder

patrickpoirier51 commented 12 months ago

Great

I am curious about the argument passed, is it just for testing ?

ros::init(argc, argv, "test_node_outside_catkin_ws");
ros::NodeHandle ros_nh;
ROS_INFO("It worked!");

Suggestion: This argument could be used to set the Mavlink serial device, that would save us from building code if we change device uart_fd = open("/dev/ttyAMA0", O_RDWR);

chobitsfan commented 12 months ago

Hi @patrickpoirier51

I am curious about the argument passed, is it just for testing ?

Yes, I try not to use catkin_make for this little program

This argument could be used to set the Mavlink serial device, that would save us from building code if we change device

Good idea