catkin_make fails: /opt/ros/kinetic/include/std_msgs/Float32.h errors
I've installed ROS Kinetic from source on Debian 9 running on the BeagleBone Blue. I can run roscore and successfully create a workspace. I'm trying to create a node/package that will control the motors of a rover. I'm using the Float32 message type in my code. after sourcing the setup.bash for both my kinetic install and workspace, I run catkin_make from the root of the workspace. The following output is printed:
[ 0%] Built target roscpp_generate_messages_nodejs
[ 0%] Built target std_msgs_generate_messages_cpp
[ 0%] Built target roscpp_generate_messages_cpp
[ 0%] Built target roscpp_generate_messages_eus
[ 0%] Built target std_msgs_generate_messages_eus
[ 0%] Built target std_msgs_generate_messages_lisp
[ 0%] Built target std_msgs_generate_messages_nodejs
[ 0%] Built target rosgraph_msgs_generate_messages_nodejs
[ 0%] Built target rosgraph_msgs_generate_messages_lisp
[ 0%] Built target rosgraph_msgs_generate_messages_cpp
[ 0%] Built target rosgraph_msgs_generate_messages_py
[ 0%] Built target roscpp_generate_messages_py
[ 0%] Built target rosgraph_msgs_generate_messages_eus
[ 0%] Built target roscpp_generate_messages_lisp
[ 0%] Built target std_msgs_generate_messages_py
[ 33%] Building CXX object drive/CMakeFiles/drive.dir/src/drive.cpp.o
In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
from /usr/include/c++/6/string:40,
from /opt/ros/kinetic/include/std_msgs/Float32.h:9,
from /home/rover/RoverDaemons/src/drive/src/drive.cpp:9:
/usr/include/c++/6/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
In file included from /usr/include/c++/6/bits/stl_algo.h:60:0,
from /usr/include/c++/6/algorithm:62,
from /usr/include/boost/math/tools/config.hpp:18,
from /usr/include/boost/math/special_functions/round.hpp:13,
from /opt/ros/kinetic/include/ros/time.h:58,
from /opt/ros/kinetic/include/ros/serialization.h:34,
from /opt/ros/kinetic/include/std_msgs/Float32.h:14,
from /home/rover/RoverDaemons/src/drive/src/drive.cpp:9:
/usr/include/c++/6/bits/algorithmfwd.h:375:41: error: macro "min" passed 3 arguments, but takes just 2
min(const _Tp&, const _Tp&, _Compare);
^
The output I've included is abbreviate to include only the first 2 errors but there are many more all referencing the Float32.h file. The drive.cpp code looks like
/* drive_node.cpp
* licence: GPLv3
*/
#include "MotorControl.hpp"
#include <rc_usefulincludes.h>
#include <roboticscape.h>
#include <std_msgs/Float32.h>
#include <ros/ros.h>
using namespace std;
using namespace rover;
void speedCallback(const std_msgs::Float32::ConstPtr& msg,
MotorControl motor_control){
/* if they differ from current values then set speed and diff to new */
if( msg->data != motor_control.get_speed() ){
motor_control.set_speed(msg->data);
}
/* publish new speed to /drive_status */
}
void diffCallback(const std_msgs::Float32::ConstPtr& msg,
MotorControl motor_control){
/* if they differ from current values then set speed and diff to new */
if( msg->data != motor_control.get_diff() ){
motor_control.set_diff(msg->data);
}
/* publish new diff to /drive_status */
}
int main( int argc, char** argv ) {
MotorControl motor_control = new MotorControl();
ros::init(argc, argv, "drive");
ros::NodeHandle n;
/* subscribe to /drive_speed and /drive_diff */
ros::Subscriber speedSub = n.subscribe("drive_speed", 1000,
boost::bind(speedCallback, _1, motor_control));
ros::Subscriber diffSub = n.subscribe("diff_speed", 1000,
boost::bind(diffCallback, _1, motor_control));
ros::spin();
// exit cleanly
delete(motor_control);
return 0 ...