⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parser.h

📁 一个很全的matlab工具包
💻 H
字号:
// $Id: parser.h,v 1.10 2004/03/03 16:01:09 kgadeyne Exp $// Copyright (C) 2003 Klaas Gadeyne <klaas dot gadeyne at mech dot kuleuven dot ac dot be>//  // This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.//  // This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the// GNU General Public License for more details.//  // You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.//  #ifndef __PARSER__#define __PARSER__extern "C"{#undef __USE_EXTERN_INLINES // If not, results in a parse error in			    // argp.h#include <argp.h>#include <stdlib.h>#define MAX_NUM_ARGS 9    const char *argp_program_version = "test_bootstrapfilter version double o seven";  const char *argp_program_bug_address = "<klaas dot gadeyne at mech dot kuleuven dot ac dot be>";  /** Structure used by main() to communicate with parse_opt       (Command Line (CL) Arguments parsing. */  struct arguments  {    char *args[MAX_NUM_ARGS];  /* args */    /// Verbose or not?    int verbose; /* The -v flag */    /// Number of Samples    unsigned int num_samples;    /// Number of time steps    unsigned int num_time_steps;     /// Resample period    unsigned int resample_period;    /// Port number used to send (only if compiled with #ifdef _SOCKET_?)    unsigned int port;    /// Wall coordinate 1: Wall = rico_wall * x + offset wall    double rico_wall;    /// Wall coordinate 2 : Wall = rico_wall * x + offset wall    double offset_wall;     /// Linear speed of the robot    double linear_speed;    /// Rotational speed of the robot    double rot_speed;    /// Name of file??    char *name;  };  /*    OPTIONS.  Field 1 in ARGP.    Order of fields:     {    NAME of the long option,     KEY (= short option),     ARG (name of the options argument),     FLAGS (flags describing the option, eg. OPTION_HIDDEN: Don't show the current option in --help output.,     DOC (documentation)    }.  */  static struct argp_option options[MAX_NUM_ARGS+1+1] =    {      {"verbose", 'v', 0, 0, "Produce verbose output"},      {"num_samples", 's', "NUM_SAMPLES", 0,"Set num_samples to NUM_SAMPLES"},      {"num_time_steps", 't', "NUM_TIME_STEPS", 0,"Set num_time_steps to NUM_TIME_STEPS"},      {"resample_period", 'r', "RESAMPLE_PERIOD", 0,"Set the resample period to RESAMPLE_PERIOD"},      {"linear_speed", 'l', "LINEAR_SPEED", 0, "Set linear_speed to LINEAR_SPEED"},      {"rot_speed", 'b', "ROT_SPEED", 0, "Set rot_speed to ROT_SPEED"},      {"port", 'p', "PORT", 0,"Set connection port to PORT"},      {"rico_wall", 'c', "RICO_WALL", 0,"Set rico of wall to RICO_WALL"},      {"offset_wall", 'o', "OFFSET_WALL", 0,"Set offset of wall to OFFSET_WALL"},      {"name", 'n', "NAME", 0, "Set name of the experiment to NAME"},      {0} // This should always be the last option    };  /*    ARGS_DOC. Field 3 in ARGP.    A description of the non-option command-line arguments    that we accept.  */  static char args_doc[] = "";  /*    DOC.  Field 4 in ARGP.    Program documentation.  */  static char doc[] = "Test Bootstrap Filter -- A program to estimate the location of a Mobile Robot by means of a laser scanner and a particle filter";  /*    PARSER. Field 2 in ARGP. Order of parameters: KEY, ARG, STATE.  */  static error_t  parse_opt (int key, char *arg, struct argp_state *state)  {    struct arguments *arguments = (struct arguments *)state->input;    switch (key)      {      case 'v':	arguments->verbose = 1;      break;      case 's':	arguments->num_samples = strtoul(arg,NULL,0);	break;      case 't':	arguments->num_time_steps = strtoul(arg,NULL,0);	break;      case 'r':	arguments->resample_period = strtoul(arg,NULL,0);	break;      case 'l':	arguments->linear_speed = strtod(arg,NULL);	break;      case 'b':	arguments->rot_speed = strtod(arg,NULL);	break;      case 'p':	arguments->port = strtoul(arg,NULL,0);	break;      case 'c':	arguments->rico_wall = strtod(arg,NULL);	break;      case 'o':	arguments->offset_wall = strtod(arg,NULL);	break;      case 'n':	arguments->name = arg;	break;      case ARGP_KEY_ARG: // Current CL argument is not an option	if (state->arg_num >= MAX_NUM_ARGS) argp_usage(state);	arguments->args[state->arg_num] = arg;	break;      case ARGP_KEY_END: // All CLs have been parsed	// if (state->arg_num < MAX_NUM_ARGS)argp_usage (state);	break;      default:	return ARGP_ERR_UNKNOWN;      }    return 0;  }  /*    The ARGP structure itself.  */  static struct argp argp = {options, parse_opt, args_doc, doc};} // End extern "C"#endif // __PARSER__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -