代码格式
通用格式
ros::init(argc,argv,"node_name");init<----int()
"node_name"<----'node_name'ros::NodeHandle n;NodeHandle<----ros::Nodehandle
客户端Client独有的
//客户端Client
ros::service::waitForSevice("/spawn");
ros::ServiceClient add_turtle=n.ServiceClient("/spawn");spawn<-----Spawnturtlesim_Spawn srv;
//参数有:srv.request.x;srv.request.y;srv.request.name;add_turtle.call(srv);