本文整理汇总了C++中ros::ServiceClient::shutdown方法的典型用法代码示例。如果您正苦于以下问题:C++ ServiceClient::shutdown方法的具体用法?C++ ServiceClient::shutdown怎么用?C++ ServiceClient::shutdown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ros::ServiceClient
的用法示例。
在下文中一共展示了ServiceClient::shutdown方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
tf::TransformListener listener;
bool pickPlaceGreen = false;
bool pickPlaceRed = false;
bool graspObject = false;
while(ros::ok())
{
if(graspObject)
{
std::string type="BOX";
std::string prop="GREEN";
int id=0;
std::stringstream ss_object_name;
ss_object_name << prop << "_" << type << "_" << id;
tf::StampedTransform stamped_transform;
try{
/* get the pose of the object w.r.t gripperbot_base frame */
listener.waitForTransform(ss_object_name.str(), "gripperbot_base",
ros::Time(0), ros::Duration(1.0));
listener.lookupTransform(ss_object_name.str(), "gripperbot_base",
ros::Time(0), stamped_transform);
float x,y,z;
x = stamped_transform.getOrigin().getX();
y = stamped_transform.getOrigin().getY();
z = stamped_transform.getOrigin().getZ();
/*checking for invalid/unreachable/noisy pose estimated from the camera*/
if(z < 0) z = -z;
if(x < 0) continue;
/* move the gripperbot using the obtained object position */
grasp(x,y,z);
}
catch (tf::TransformException ex){
std::cout << "NO " << prop << " " << type << "found to grasp" << std::endl;
ros::Duration(1.0).sleep();
}
graspObject = false;
}
if(pickPlaceGreen)
{
pick("GREEN_BOX_0");
place("GREEN_CONTAINER_0");
pickPlaceGreen = false;
pickPlaceRed = true;
}
if(pickPlaceRed)
{
pick("RED_BOX_0");
place("RED_CONTAINER_0");
pickPlaceRed = false;
pickPlaceGreen = true;
}
imshow("demo", demoImg);
k = cv::waitKey(100);
if((int)(k & 0xFF) == 27)
break;
if((int)(k & 0xFF) == 'p')
graspObject=true;
if((int)(k & 0xFF) == 'g')
pickPlaceGreen=true;
if((int)(k & 0xFF) == 'r')
pickPlaceRed=true;
if((int)(k & 0xFF) == 'm')
turn_mic_on();
ros::spinOnce();
}
demoImg.release();
cv::destroyWindow("demoImg");
cambot_client.shutdown();
gripperbot_client.shutdown();
opengripper_client.shutdown();
closegripper_client.shutdown();
world_model_client.shutdown();
mic_on_client.shutdown();
mic_off_client.shutdown();
return 1;
}
catch (std::exception& e)
{
std::cout << e.what() << endl;
}
return 0;
};
示例2: TearDown
void TearDown()
{
load_srv_.shutdown();
}
示例3: main
int main(int argc, char** argv)
{
try
{
ros::init(argc, argv, "demo_cogsys_cpp");
cv::Mat demoImg(480,640, CV_8UC3);
cv::namedWindow("demo", 1);
demoImg=cv::Scalar(0,0,0);
cv::putText(demoImg, "Press ESC to quit app", cv::Point(30,30), cv::FONT_HERSHEY_COMPLEX_SMALL, 0.8, cv::Scalar(0,255,0), 1, CV_AA);
cv::putText(demoImg, "Press g to grasp GREEN object", cv::Point(30,70), cv::FONT_HERSHEY_COMPLEX_SMALL, 0.8, cv::Scalar(0,255,0), 1, CV_AA);
cv::putText(demoImg, "Please implement your own activation login for grasping", cv::Point(30,100), cv::FONT_HERSHEY_COMPLEX_SMALL, 0.8, cv::Scalar(0,255,0), 1, CV_AA);
cv::putText(demoImg, "using natural language (pressing 'g' is only for testing)", cv::Point(30,130), cv::FONT_HERSHEY_COMPLEX_SMALL, 0.8, cv::Scalar(0,255,0), 1, CV_AA);
cv::putText(demoImg, "Press m to activate microphone", cv::Point(30,160), cv::FONT_HERSHEY_COMPLEX_SMALL, 0.8, cv::Scalar(0,255,0), 1, CV_AA);
mSub = new comminterface::ActorsSubscriber("/object_detector/objects_data");
mSub->start();
int k;
ros::NodeHandle n;
gripperbot_client = n.serviceClient<robot_control_srvs::MoveToOS>("/gripperbot_control/move_to_cs");
opengripper_client = n.serviceClient<gripper_control_srvs::OpenGripper>("/gripper_control/open_gripper");
closegripper_client = n.serviceClient<gripper_control_srvs::CloseGripper>("/gripper_control/close_gripper");
sub_speech = n.subscribe("/re_speech_recognition/output", 1, analyzeSpeech);
mic_on_client = n.serviceClient<speech_recognition_srvs::TurnOn>("/re_speech_recognition/turn_on");
mic_off_client = n.serviceClient<speech_recognition_srvs::TurnOff>("/re_speech_recognition/turn_off");
home();
bool graspObject = false;
while(true)
{
if(graspObject)
{
grasp("BOX", "GREEN");
graspObject=false;
}
imshow("demo", demoImg);
k = cv::waitKey(100);
if((int)(k & 0xFF) == 27)
break;
if((int)(k & 0xFF) == 'g')
graspObject=true;
if((int)(k & 0xFF) == 'm')
turn_mic_on();
}
demoImg.release();
mSub->stopThread();
cv::destroyWindow("demoImg");
gripperbot_client.shutdown();
opengripper_client.shutdown();
closegripper_client.shutdown();
mic_on_client.shutdown();
mic_off_client.shutdown();
delete mSub;
return 1;
}
catch (std::exception& e)
{
std::cout << e.what() << endl;
}
return 0;
};