def parse_arguments(): descriptionTxt = """Sync diagnostics file(s) from given robot to current devlaptop.""" exampleTxt = "TODO" parser = argparse.ArgumentParser( description=descriptionTxt, epilog=exampleTxt, formatter_class=argparse.RawDescriptionHelpFormatter) robot = rtdb2tools.guessAgentId() parser.add_argument('-r', '--robot', help='robot ID to use', type=int, default=robot) parser.add_argument('-f', '--frequency', help='refresh frequency in Hz', type=float, default=1) parser.add_argument('-p', '--filepattern', help='file pattern to sync (newest only)', type=str, default="/tmp/diagnostics_r*.txt") # TODO: target option? so it can be run on robot return parser.parse_args()
def parse_arguments(): descriptionTxt = """Plot ball tracking performance for given RDL and given timestamp. See also plot_balls_live.py which updates live during playback. """ exampleTxt = "" parser = argparse.ArgumentParser( description=descriptionTxt, epilog=exampleTxt, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('-a', '--agent', help='agent ID to use', type=int, default=rtdb2tools.guessAgentId()) parser.add_argument( "-t", "--timestamp", type=float, required=True, help="timestamp of interest (age relative to start of log)") parser.add_argument("-w", "--timewindow", type=float, default=0.001, help="time window in seconds around given timestamp") parser.add_argument('rdlfile', help='extract data from RDL file instead of live RTDB', default=None, nargs='?') return parser.parse_args()
def parse_arguments(): descriptionTxt = """Analyze localization noise levels from RDL file, write a brief report to stdout. """ exampleTxt = """Examples: analyze_localization /var/tmp/20191205_204236_r6.rdl overall standard deviation (n=2657): x : 0.0107 y : 0.0083 Rz: 0.0042 """ parser = argparse.ArgumentParser( description=descriptionTxt, epilog=exampleTxt, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('-r', '--robot', help='robot ID to use', type=int, default=rtdb2tools.guessAgentId()) parser.add_argument('-p', '--plot', help='show a plot', action='store_true') parser.add_argument('-s', '--summary', help='only display overall summary', action='store_true') parser.add_argument('-a', '--all', help='show as much as possible', action='store_true') parser.add_argument('rdlfile', help='analyze given RDL file', type=str) return parser.parse_args()
def parse_arguments(): descriptionTxt = """Monitor motion performance parameters from RTDB, write continuously to a diagnostics file. Note: where relevant (like robot velocity), data is shown in RCS instead of FCS.""" exampleTxt = "" parser = argparse.ArgumentParser( description=descriptionTxt, epilog=exampleTxt, formatter_class=argparse.RawDescriptionHelpFormatter) robot = rtdb2tools.guessAgentId() parser.add_argument('-r', '--robot', help='robot ID to use', type=int, default=robot) parser.add_argument('-f', '--frequency', help='refresh frequency in Hz', type=float, default=30) parser.add_argument('-o', '--output', help='output file', type=str, default=defaultOutputFile(robot)) parser.add_argument('-s', '--stdout', help='print to stdout instead of to some default file', action='store_true') return parser.parse_args()
def parse_arguments(): descriptionTxt = """Analyze intercept (pass acceptance) performance, write a report to stdout. """ exampleTxt = """Examples output: analyzed 70 intercept attempts by robot 5 id timestamp gotBall duration noBall verdict details 1 2020-02-08,15:42:49.543537 False 13.9000 0.0% failed: ball never came close enough 3.9m 2 2020-02-08,15:43:05.876877 True 2.6333 0.0% OK 3 2020-02-08,15:43:10.543537 False 2.4000 0.0% failed: ball never came close enough 1.4m 4 2020-02-08,15:43:14.510204 True 2.6000 0.0% OK ..... 66 2020-02-08,15:54:27.643577 False 5.2333 43.0% failed: ball never came close enough 1.2m 67 2020-02-08,15:54:33.510215 False 2.4667 0.0% failed: ball never came close enough 12.1m 68 2020-02-08,15:54:36.676902 False 1.9667 0.0% failed: ball never came close enough 10.9m 69 2020-02-08,15:54:39.476890 False 0.5000 0.0% failed: intercept duration too short 0.5s 70 2020-02-08,15:54:40.543602 False 12.2667 0.0% failed: ball never came close enough 10.1m 37.1% (n= 26) failed: ball never came close enough 24.3% (n= 17) failed: intercept duration too short 21.4% (n= 15) failed: unknown reason 15.7% (n= 11) OK 1.4% (n= 1) failed: ball bounced off """ parser = argparse.ArgumentParser( description=descriptionTxt, epilog=exampleTxt, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('-r', '--robot', help='robot ID to use', type=int, default=rtdb2tools.guessAgentId()) parser.add_argument('-p', '--plot', help='show a plot', action='store_true') parser.add_argument('-d', '--dump', help='dump dataframe ASCII tables to /tmp', action='store_true') parser.add_argument('-a', '--all', help='show as much as possible', action='store_true') parser.add_argument( '-f', '--frequency', help= 'resample frequency to use (typically best to slightly undersample heartbeat)', type=float) parser.add_argument('rdlfile', help='analyze given RDL file', type=str) return parser.parse_args()
def parse_arguments(): descriptionTxt = """Analyze motion performance from RDL file, write a brief report to stdout. """ exampleTxt = """Examples: analyze_motion.py /var/tmp/20191205_204236_r6.rdl TODO """ parser = argparse.ArgumentParser(description=descriptionTxt, epilog=exampleTxt, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('-r', '--robot', help='robot ID to use', type=int, default=rtdb2tools.guessAgentId()) parser.add_argument('-p', '--plot', help='show a plot', action='store_true') parser.add_argument('rdlfile', help='analyze given RDL file', type=str) return parser.parse_args()
def parse_arguments(): descriptionTxt = """Monitor intercept performance parameters from RTDB, write continuously to stdout. """ exampleTxt = """Examples: monitor_intercept.py monitor_intercept.py -r 2 Example output: TODO (desc) """ parser = argparse.ArgumentParser( description=descriptionTxt, epilog=exampleTxt, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('-r', '--robot', help='robot ID to use', type=int, default=rtdb2tools.guessAgentId()) parser.add_argument('-f', '--frequency', help='refresh frequency in Hz', type=float, default=10) return parser.parse_args()
parser.add_argument('-n', '--numRepeats', help='number of repeats', type=int, default=2) return parser.parse_args() def main(args): # move to starting position rl = RobotLibrary(args.robot, joystick=False) rl.move(args.x, args.y, 0.0) # configure twister = Twister(args.robot, rci=rl._rci) twister.dof = 'Rz' # most stable, due to each wheel contributing the same twister.speed = args.vRz twister.repeats = args.numRepeats twister.duration = args.duration twister.disableVisionLoc = True # the point of this procedure is to compare vision with encoders twister.accelerationLimit = 2.0 # must prevent wheel slip # run twister.run() if __name__ == '__main__': args = parse_arguments() robot = rtdb2tools.guessAgentId() if robot == 0 or robot == None: raise RuntimeError("Error: could not determine robot ID, this script should run on a robot") args.robot = robot main(args)
self.rtdb2Store.put(self.agent, self.key, self.rtdbData) if __name__ == "__main__": # Argument parsing. descriptionTxt = 'This tool allows you to edit an RtDB item in the database given an RtDB key.\n' exampleTxt = 'Example: rtdb2_edit.py CONFIG_PATHPLANNING\n' parser = argparse.ArgumentParser( description=descriptionTxt, epilog=exampleTxt, formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-a', '--agent', help='agent ID to use', type=int, default=rtdb2tools.guessAgentId()) parser.add_argument('-p', '--path', help='database path to use', type=str, default=RTDB2_DEFAULT_PATH) parser.add_argument('key', help='RtDB key to edit') args = parser.parse_args() dataHandler = RtDBDataHandler(args.path, args.agent, args.key) App = TestApp() App.setDataHandler(dataHandler) App.run()
def parse_arguments(): parser = argparse.ArgumentParser( description= """Automated single-robot intercept test. Robot will choose a position in a circle, continuously attempting to intercept the ball and pass to next robot. Includes a fallback getball in case ball bounces off. See also: wrapper script interceptCircle.py.""" ) parser.add_argument( '-a', '--actionradius', help= 'zone/action radius: in case intercept fails and ball is within this radius, just do a getball fallback', type=float, default=2.0) parser.add_argument( '-c', '--circleradius', help= 'home position circle radius on which robot default positions are set', type=float, default=4.0) parser.add_argument('-t', '--target', help='pass target (default: next robot)', type=float, nargs=2, default=None) parser.add_argument( '-n', '--targetnoise', help='aim given amount of meters at a random side next to the target', type=float, default=0.0) parser.add_argument( '-w', '--dontwait', help='do not wait with intercepting until previous robot has the ball', action='store_true') parser.add_argument('-q', '--quiet', help='suppress output', action='store_true') # TODO use option 'active' intercept? parser.add_argument( '--home', help= 'home position (x,y), default calculated based on available robots and circleradius', type=float, nargs=2, default=None) parser.add_argument( '-i', '--index', help= 'home position index to choose (starting count at 1), default calculate based on available robots', type=int, nargs=2, default=None) parser.add_argument('-r', '--robot', help='robot ID to use (intended only for simulation)', type=int, default=rtdb2tools.guessAgentId()) parser.add_argument('--ignore', help='robots to be ignored', type=int, nargs='+', default=[1]) return parser.parse_args()