Error showing while doing make in build folder

asked 2019-06-11 03:52:19 -0500

Arushi gravatar image

updated 2019-06-11 03:57:33 -0500

gvdhoorn gravatar image

I am currently have ROS melodic on Ubuntu Mate for pi. Pi model - Raspberry pi 3 B+ Model. On doing cmake .. and make in the build folder, I am getting the following error:

~/Desktop/UAV-communication-relay-master/UAV_Mission_Control_Program/build$ make
[  0%] Built target _uav_control_generate_messages_check_deps_datalink_send
[  0%] Built target std_msgs_generate_messages_py
[  0%] Built target _uav_control_generate_messages_check_deps_DFrame
[  0%] Built target _uav_control_generate_messages_check_deps_channel_stat
[ 15%] Built target uav_control_generate_messages_py
[ 15%] Built target std_msgs_generate_messages_nodejs
[ 15%] Built target rosgraph_msgs_generate_messages_eus
[ 15%] Built target rosgraph_msgs_generate_messages_cpp
[ 15%] Built target std_msgs_generate_messages_lisp
[ 15%] Built target roscpp_generate_messages_lisp
[ 15%] Built target roscpp_generate_messages_cpp
[ 15%] Built target roscpp_generate_messages_eus
[ 15%] Built target std_msgs_generate_messages_eus
[ 15%] Built target std_msgs_generate_messages_cpp
[ 15%] Built target rosgraph_msgs_generate_messages_py
[ 15%] Built target rosgraph_msgs_generate_messages_nodejs
[ 25%] Built target uav_control_generate_messages_cpp
[ 25%] Built target roscpp_generate_messages_py
[ 37%] Built target uav_control_generate_messages_eus
[ 46%] Built target uav_control_generate_messages_lisp
[ 46%] Built target roscpp_generate_messages_nodejs
[ 56%] Built target uav_control_generate_messages_nodejs
[ 56%] Built target rosgraph_msgs_generate_messages_lisp
[ 62%] Built target verify_port_assignment
[ 65%] Building CXX object CMakeFiles/cmd.dir/src/cmd.cpp.o
/home/arushi/Desktop/UAV-communication-relay-master/UAV_Mission_Control_Program/src/cmd.cpp: In function ‘void gcs_callback(uav_control::DFrame)’:
/home/arushi/Desktop/UAV-communication-relay-master/UAV_Mission_Control_Program/src/cmd.cpp:386:30: error: ‘mavros_msgs::SetMode::Response {aka struct mavros_msgs::SetModeResponse_<std::allocator<void> >}’ has no member named ‘success’
              if(sss.response.success){
                              ^~~~~~~
CMakeFiles/cmd.dir/build.make:62: recipe for target 'CMakeFiles/cmd.dir/src/cmd.cpp.o' failed
make[2]: *** [CMakeFiles/cmd.dir/src/cmd.cpp.o] Error 1
CMakeFiles/Makefile2:142: recipe for target 'CMakeFiles/cmd.dir/all' failed
make[1]: *** [CMakeFiles/cmd.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

Below is the cmd.cpp file. Also I have installed mavros in the src folder.

#include "unistd.h"
#include "stdio.h"
#include "sys/types.h"
#include "sys/stat.h"
#include "errno.h"
#include "fcntl.h"
#include "pthread.h"
#include "string.h"
#include "termios.h"
#include "stdint.h"
#include "math.h"

#include "ros/ros.h"
#include "std_msgs/String.h"
#include "std_msgs/Int32.h"
#include "mavlink2.0/common/mavlink.h"
#include "sysid.h"

#include <uav_control/DFrame.h>
#include <uav_control/datalink_send.h>

#include <geometry_msgs/Vector3.h>
#include <geometry_msgs/Point.h>
#include <mavros_msgs/SetMode.h>
#include <mavros_msgs/State.h>
#include <mavros_msgs/PositionTarget.h>
#include <mavros_msgs/CommandInt.h>
#include <mavros_msgs/CommandLong.h>
#include <mavros_msgs/CommandTOL.h>
#include <mavros_msgs/CommandBool.h>
#include <mavros_msgs/StreamRate.h>
#include <mavros_msgs/BatteryStatus.h>
#include <mavros_msgs/Mavlink.h>

/**
 *  subscriber callbacks
 */
void gcs_callback(const uav_control::DFrame msg);
void state_callback(const mavros_msgs::State msg);
void mavlink_callback(const mavros_msgs::Mavlink msg);

/**
 *  List of valid commands
 */
static const int cmd_num = 7;
static const char* cmd_list[7] = {
  "takeoff",        // 0 (action)
  "land",       // 1 (action)
  "goto",       // 2 go to a specific GPS location (action)
  "mission_start",  // 3 (action)
  "mission_abort",  // 4 (action)
  "rtl",        // 5 return to launch (action)
  "arm"                 // 6 arm/disarm the aircraft
};   


/**
 *  command execution status flag
 *  avoid execution of contradicting commands (i.e. landing during takeoff)
 */
static int cmd_current;
static bool cmd_running;
static bool rtl_running;

// current heading
static uint16_t heading;

ros::ServiceClient client_sendack;
ros::ServiceClient client_arm;
ros::ServiceClient client_takeoff;
ros::ServiceClient client_land;
ros::ServiceClient client_cmdlong;
ros::ServiceClient client_setmode;
ros::Publisher pub_setpoint_raw_local_ned;

/**
 *  current uav state
 */
mavros_msgs::State state;

/**
 *  system id
 */
const uint8_t sysid ...
(more)
edit retag flag offensive close merge delete

Comments

1

It looks like you're trying to build https://github.com/YifanJiangPolyU/UA... . In the future, if you're trying to build an open-source repository, please include a link to the repository in your question.

ahendrix gravatar imageahendrix ( 2019-06-11 10:32:13 -0500 )edit

Apologies for the same. I didn't know. Will be careful from now onwards.

Arushi gravatar imageArushi ( 2019-06-11 11:28:42 -0500 )edit

It looks like that code was written against an old version of the mavros_msgs package. You should try to upgrade all of the code, but it looks like there's a lot to upgrade. I suggest you pay attention the the line numbers in the error message to make sure that you're fixing the correct line of code for each error.

ahendrix gravatar imageahendrix ( 2019-06-11 12:38:33 -0500 )edit

Yes. But the success class member is present in the mavros_msgs file. Then why it is showing error? How can I upgrade to remove this error, I am stuck on it from the past few days.

Arushi gravatar imageArushi ( 2019-06-11 21:56:29 -0500 )edit

Which file?

ahendrix gravatar imageahendrix ( 2019-06-12 00:03:40 -0500 )edit

CommandTOL file which I have attached in the question. The mavros_msgs file that cmd.cpp is using.

Arushi gravatar imageArushi ( 2019-06-12 01:18:04 -0500 )edit

It looks like this code is expecting the SetMode.srv in mavros_msgs to have a success field, but it has mode_sent instead.

ahendrix gravatar imageahendrix ( 2019-06-12 03:21:25 -0500 )edit

Okay. I should either change the mode_sent to success or success in other files to mode_sent?

Arushi gravatar imageArushi ( 2019-06-12 03:51:16 -0500 )edit