mit-aera / FlightGoggles

A framework for photorealistic hardware-in-the-loop agile flight simulation using Unity3D and ROS. Developed by MIT AERA group.
http://flightgoggles.mit.edu
Other
402 stars 99 forks source link

catkin build error #173

Open curious-energy opened 3 years ago

curious-energy commented 3 years ago

When I build this project, some error occur

Errors     << flightgoggles_car_dynamics:make /home/lx/goggles_ws/logs/flightgoggles_car_dynamics/build.make.001.log
In file included from /opt/ros/melodic/include/ros/serialization.h:37:0,
                 from /opt/ros/melodic/include/ros/publisher.h:34,
                 from /opt/ros/melodic/include/ros/node_handle.h:32,
                 from /opt/ros/melodic/include/ros/ros.h:45,
                 from /home/lx/goggles_ws/src/flightgoggles/flightgoggles_car_dynamics/src/flightgoggles_car_dynamics_node.hpp:12,
                 from /home/lx/goggles_ws/src/flightgoggles/flightgoggles_car_dynamics/src/flightgoggles_car_dynamics_node.cpp:8:
/opt/ros/melodic/include/ros/message_traits.h: In instantiation of ‘static const char* ros::message_traits::MD5Sum<M>::value(const M&) [with M = ros::Time]’:
/opt/ros/melodic/include/ros/message_traits.h:254:102:   required from ‘const char* ros::message_traits::md5sum(const M&) [with M = ros::Time]’
/opt/ros/melodic/include/ros/publisher.h:116:38:   required from ‘void ros::Publisher::publish(const M&) const [with M = ros::Time]’
/home/lx/goggles_ws/src/flightgoggles/flightgoggles_car_dynamics/src/flightgoggles_car_dynamics_node.cpp:137:35:   required from here
/opt/ros/melodic/include/ros/message_traits.h:125:14: error: ‘const class ros::Time’ has no member named ‘__getMD5Sum’
     return m.__getMD5Sum().c_str();
            ~~^~~~~~~~~~~
/opt/ros/melodic/include/ros/message_traits.h: In instantiation of ‘static const char* ros::message_traits::DataType<M>::value(const M&) [with M = ros::Time]’:
/opt/ros/melodic/include/ros/message_traits.h:263:104:   required from ‘const char* ros::message_traits::datatype(const M&) [with M = ros::Time]’
/opt/ros/melodic/include/ros/publisher.h:118:11:   required from ‘void ros::Publisher::publish(const M&) const [with M = ros::Time]’
/home/lx/goggles_ws/src/flightgoggles/flightgoggles_car_dynamics/src/flightgoggles_car_dynamics_node.cpp:137:35:   required from here
/opt/ros/melodic/include/ros/message_traits.h:142:14: error: ‘const class ros::Time’ has no member named ‘__getDataType’
     return m.__getDataType().c_str();
            ~~^~~~~~~~~~~~~
make[2]: *** [CMakeFiles/flightgoggles_car_dynamics_node.dir/src/flightgoggles_car_dynamics_node.cpp.o] Error 1
make[1]: *** [CMakeFiles/flightgoggles_car_dynamics_node.dir/all] Error 2
make: *** [all] Error 2
cd /home/lx/goggles_ws/build/flightgoggles_car_dynamics; catkin build --get-env flightgoggles_car_dynamics | catkin env -si  /usr/bin/make --jobserver-fds=4,5 -j; cd -

...............................................................................
Failed     << flightgoggles_car_dynamics:make                [ Exited with code 2 ]
Failed    <<< flightgoggles_car_dynamics                     [ 1.7 seconds ]   
_______________________________________________________________________________
Errors     << flightgoggles_uav_dynamics:make /home/lx/goggles_ws/logs/flightgoggles_uav_dynamics/build.make.001.log
In file included from /opt/ros/melodic/include/ros/serialization.h:37:0,
                 from /opt/ros/melodic/include/ros/publisher.h:34,
                 from /opt/ros/melodic/include/ros/node_handle.h:32,
                 from /opt/ros/melodic/include/ros/ros.h:45,
                 from /home/lx/goggles_ws/src/flightgoggles/flightgoggles_uav_dynamics/src/flightgoggles_uav_dynamics_node.hpp:14,
                 from /home/lx/goggles_ws/src/flightgoggles/flightgoggles_uav_dynamics/src/flightgoggles_uav_dynamics_node.cpp:10:
/opt/ros/melodic/include/ros/message_traits.h: In instantiation of ‘static const char* ros::message_traits::MD5Sum<M>::value(const M&) [with M = ros::Time]’:
/opt/ros/melodic/include/ros/message_traits.h:254:102:   required from ‘const char* ros::message_traits::md5sum(const M&) [with M = ros::Time]’
/opt/ros/melodic/include/ros/publisher.h:116:38:   required from ‘void ros::Publisher::publish(const M&) const [with M = ros::Time]’
/home/lx/goggles_ws/src/flightgoggles/flightgoggles_uav_dynamics/src/flightgoggles_uav_dynamics_node.cpp:278:35:   required from here
/opt/ros/melodic/include/ros/message_traits.h:125:14: error: ‘const class ros::Time’ has no member named ‘__getMD5Sum’
     return m.__getMD5Sum().c_str();
            ~~^~~~~~~~~~~
/opt/ros/melodic/include/ros/message_traits.h: In instantiation of ‘static const char* ros::message_traits::DataType<M>::value(const M&) [with M = ros::Time]’:
/opt/ros/melodic/include/ros/message_traits.h:263:104:   required from ‘const char* ros::message_traits::datatype(const M&) [with M = ros::Time]’
/opt/ros/melodic/include/ros/publisher.h:118:11:   required from ‘void ros::Publisher::publish(const M&) const [with M = ros::Time]’
/home/lx/goggles_ws/src/flightgoggles/flightgoggles_uav_dynamics/src/flightgoggles_uav_dynamics_node.cpp:278:35:   required from here
/opt/ros/melodic/include/ros/message_traits.h:142:14: error: ‘const class ros::Time’ has no member named ‘__getDataType’
     return m.__getDataType().c_str();
            ~~^~~~~~~~~~~~~
make[2]: *** [CMakeFiles/flightgoggles_uav_dynamics_node.dir/src/flightgoggles_uav_dynamics_node.cpp.o] Error 1
make[1]: *** [CMakeFiles/flightgoggles_uav_dynamics_node.dir/all] Error 2
make: *** [all] Error 2
cd /home/lx/goggles_ws/build/flightgoggles_uav_dynamics; catkin build --get-env flightgoggles_uav_dynamics | catkin env -si  /usr/bin/make --jobserver-fds=4,5 -j; cd -

...............................................................................
Failed     << flightgoggles_uav_dynamics:make                [ Exited with code 2 ]
Failed    <<< flightgoggles_uav_dynamics                     [ 1.9 seconds ]   

system: ubuntu 18.04 ros melodic

reference: ROS Client

bedaberner commented 3 years ago

I encounter the same build error using the same setup (18.04,melodic)

maulanaazhari commented 3 years ago

Hi @bedaberner @curious-energy, this problem happened because the code tries to publish non-message object, particularly in the file flightgoggles/flightgoggles_uav_dynamics/src/flightgoggles_uav_dynamics_node.cpp and flighgoggles/flightgoggles_car_dynamics/src/flightgoggles_car_dynamics_node.cpp. you can solve this problem by changing every line of clockPub_.publish(currentTime_); in those files to this:

std_msgs::Time time_msg;
time_msg.data = currentTime_;
clockPub_.publish(time_msg);

However, I still don't know whether it is the correct message object, but in my local machine, it works in the roslaunch flightgoggles teleopExample.launch run

note: in the publisher definition, clockPub_ uses the rosgraph_msgs/Clock message object, but when I changed the message object, I got another error in the flightgoggles_marker_visualizer_node.

mhathiyari commented 2 years ago

@curious-energy @bedaberner Any updates on the solution to your problem. Does @maulanaazhari solution work?

maulanaazhari commented 2 years ago

@mhathiyari worth to try, let us know the result!

mhathiyari commented 2 years ago

@maulanaazhari It didn't. wondering how the others above solved it.

mhathiyari commented 2 years ago

Just an update used docker with ros kinetic, and you dont get the above error. Thus you can run the flight googles code in the docker and unity env on your local machine. You can use docker --net host -it NAME command to make sure your host and container share the same network thus allowing the simulation code and unity engine to communicate.

tenghooi commented 1 year ago

For me changing to the following works,

rosgraphmsgs::Clock clock; clock.clock = currentTime; clockPub_.publish(clock);

Cheers.