Revision: 6366 http://playerstage.svn.sourceforge.net/playerstage/?rev=6366&view=rev Author: gerkey Date: 2008-04-18 15:50:59 -0700 (Fri, 18 Apr 2008)
Log Message: ----------- updated the parser Modified Paths: -------------- code/player/trunk/utils/playerlog2carmenlog.py Modified: code/player/trunk/utils/playerlog2carmenlog.py =================================================================== --- code/player/trunk/utils/playerlog2carmenlog.py 2008-04-18 08:38:29 UTC (rev 6365) +++ code/player/trunk/utils/playerlog2carmenlog.py 2008-04-18 22:50:59 UTC (rev 6366) @@ -97,36 +97,77 @@ # we're also interested in laser scans elif type == 'laser': - if msgsubtype != 1: - print 'Skipping laser message with subtype ' + `msgsubtype` - continue - header = 'FLASER' - time = lsplit[0] - min_angle = lsplit[8] - max_angle = lsplit[9] - if (min_angle != '-1.5708') or (max_angle != '+1.5708'): - print 'Sorry, CARMEN requires 180-degree FOV for laser' - sys.exit(-1) - num_readings = int(lsplit[12]) - if (num_readings != 181) and (num_readings != 361): - print 'Sorry, I can only convert 1-deg and 0.5-deg resolution logs' - sys.exit(-1) - i = 0 - scanstr = '' - while i < (num_readings - 1): - range = lsplit[13 + 2*i] - scanstr += range + ' ' - i += num_readings/180 + if msgsubtype == 1: + header = 'FLASER' + time = lsplit[0] + min_angle = lsplit[8] + max_angle = lsplit[9] + if (min_angle != '-1.5708') or (max_angle != '+1.5708'): + print 'Sorry, CARMEN requires 180-degree FOV for laser' + sys.exit(-1) + num_readings = int(lsplit[12]) + if (num_readings != 181) and (num_readings != 361): + print 'Sorry, I can only convert 1-deg and 0.5-deg resolution logs' + sys.exit(-1) + i = 0 + scanstr = '' + while i < (num_readings - 1): + range = lsplit[13 + 2*i] + scanstr += range + ' ' + i += num_readings/180 + + l_x = x + offset_x*math.cos(theta) + l_y = y + offset_x*math.sin(theta) - l_x = x + offset_x*math.cos(theta) - l_y = y + offset_x*math.sin(theta) + outfile.write(header + ' 180 ' + scanstr + + str(l_x) + ' ' + str(l_y) + ' ' + str(theta) + ' ' + + str(x) + ' ' + str(y) + ' ' + str(theta) + ' ' + + time + ' ' + host + ' ' + time + '\n') + elif msgsubtype == 2: + # split the pose from the scan out as an ODOM message + header = 'ODOM' + time = lsplit[0] + x = float(lsplit[8]) + y = float(lsplit[9]) + theta = float(lsplit[10]) + tv = '0.000' + rv = '0.000' + accel = '0.000' + outfile.write(header + ' ' + str(x) + ' ' + str(y) + ' ' + str(theta) + ' ' + tv + ' ' + rv + ' ' + accel + ' ' + time + ' ' + host + ' ' + time + '\n') - outfile.write(header + ' 180 ' + scanstr + - str(l_x) + ' ' + str(l_y) + ' ' + str(theta) + ' ' + - str(x) + ' ' + str(y) + ' ' + str(theta) + ' ' + - time + ' ' + host + ' ' + time + '\n') + header = 'FLASER' + time = lsplit[0] + min_angle = lsplit[11] + max_angle = lsplit[12] + if (min_angle != '-1.5708') or (max_angle != '+1.5708'): + print 'Sorry, CARMEN requires 180-degree FOV for laser' + sys.exit(-1) + num_readings = int(lsplit[15]) + if (num_readings != 181) and (num_readings != 361): + print 'Sorry, I can only convert 1-deg and 0.5-deg resolution logs' + sys.exit(-1) + i = 0 + scanstr = '' + while i < (num_readings - 1): + range = lsplit[16 + 2*i] + scanstr += range + ' ' + i += num_readings/180 + + + + l_x = x + offset_x*math.cos(theta) + l_y = y + offset_x*math.sin(theta) + + outfile.write(header + ' 180 ' + scanstr + + str(l_x) + ' ' + str(l_y) + ' ' + str(theta) + ' ' + + str(x) + ' ' + str(y) + ' ' + str(theta) + ' ' + + time + ' ' + host + ' ' + time + '\n') + + else: + print 'Skipping laser message with subtype ' + `msgsubtype` + continue else: #print 'Ignoring line of type ' + type pass This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Playerstage-commit mailing list Playerstage-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/playerstage-commit