dji_sdk_test.cpp
Go to the documentation of this file.
00001 #include "dji_sdk_test.h"
00002 
00003 void dji_sdk_node::SetUp() {
00004 
00005   ASSERT_TRUE(ros::master::check()) << "ROS master is not up\n";
00006 
00007   rosAdapter = new DJI::onboardSDK::ROSAdapter;
00008   ros::NodeHandle nh;
00009   ros::NodeHandle nh_private("~");
00010   djiSDKNode = new DJISDKNode(nh, nh_private);
00011 
00012   activation_publisher = nh.advertise<std_msgs::UInt8>("dji_sdk/activation", 10);
00013   activation_subscriber = nh.subscribe<std_msgs::UInt8>("dji_sdk/activation", 10, &dji_sdk_node::activation_subscriber_callback, this);
00014 }
00015 
00016 void dji_sdk_node::TearDown() {
00017   
00018   activation_subscriber.shutdown();
00019   activation_publisher.shutdown();
00020  
00021   //TODO find a better way to clean 
00022 /*  delete rosAdapter;
00023   rosAdapter = NULL;
00024   delete djiSDKNode;
00025   djiSDKNode = NULL;
00026 */
00027 }
00028 
00029 TEST_F(dji_sdk_node, test01) {
00030 
00031   ros::Duration(1.0).sleep();
00032   ros::spinOnce();
00033 
00047   ASSERT_FALSE(activation);
00048 }
00049 
00050 int main(int argc, char **argv) {
00051 
00052   testing::InitGoogleTest(&argc, argv);
00053   ros::init(argc, argv, "dji_sdk");
00054  
00055   ros::AsyncSpinner spinner(1);
00056   spinner.start();
00057 
00058   int ret =  RUN_ALL_TESTS();
00059   
00060   spinner.stop();
00061   ros::shutdown();
00062 
00063   return ret;
00064 }


dji_sdk
Author(s): Botao Hu
autogenerated on Thu Jun 6 2019 17:55:30