Hi,
I'm trying to Integrate pixhawk with Nvidia Jetson TK1. I was able to use ROS/Mavros and communicate with pixhawk by ros commands. Now I'm trying to use roscpp and mavros C++ api to communicate with pixhawk by C++ development on Jetson. I was able to run hello world program by following this tutorial http://jbohren.com/articles/roscpp-hello-world/
Now, I'm trying to use it and mavros api to send arming commands to pixhawk. I modified it this way and compiled the program.
// Include the ROS C++ APIs
#include <ros/ros.h>
#include <mavros/mavros.h>
#include <mavros/CommandBool.h>
#include <mavros/mavros_plugin.h>
#include <pluginlib/class_list_macros.h>
#include <iostream>
using namespace mavros;
using namespace mavplugin;
// Standard C++ entry point
int main(int argc, char** argv) {
// Announce this program to the ROS master as a "node" called "hello_world_node"
ros::init(argc, argv, "mavros");
// Start the node resource managers (communication, time, etc)
ros::start();
// Broadcast a simple log message
ROS_INFO_STREAM("Hello, world!");
//Create Request and Response structures for Arming service
CommandBool::Request arm_req;//=new CommandBool::Request<std::Allocator<void>>();
arm_req.value=1;
CommandBool::Response arm_res;//=new CommandBool::Response();
//Send arming command to master node
bool result=mavplugin::CommandPlugin::arming_cb(&arm_req, &arm_res);
// Process ROS callbacks until receiving a SIGINT (ctrl-c)
ros::spin();
// Stop the node's resources
ros::shutdown();
// Exit tranquilly
return 0;
}
I got the following error message after compiling this:
sample.cpp: In function ‘int main(int, char**)’:
sample.cpp:28:26: error: ‘mavplugin::CommandPlugin’ has not been declared
bool result=mavplugin::CommandPlugin::arming_cb(&arm_req, &arm_res);
Can anyone please suggest me how to proceed? Thanks.
Originally posted by the_reddevil on ROS Answers with karma: 1 on 2015-02-10
Post score: 0
Original comments
Comment by cong on 2018-01-04:
Can you tell how to use ROS/Mavros and communicate with pixhawk by ros commands?
Email:[email protected]
Thx!