<s> import os <EOL> import math <EOL> from director import robotsystem <EOL> from director . consoleapp import ConsoleApp <EOL> from director import ioUtils <EOL> from director import segmentation <EOL> from director import applogic <EOL> from director import visualization as vis <EOL> from director import continuouswalkingdemo <EOL> from director import objectmodel as om <EOL> from director import ikplanner <EOL> from director import navigationpanel <EOL> from director import cameraview <EOL> from director import playbackpanel <EOL> from director import drcargs <EOL> import drc as lcmdrc <EOL> app = ConsoleApp ( ) <EOL> dataDir = app . getTestingDataDirectory ( ) <EOL> view = app . createView ( ) <EOL> segmentation . _defaultSegmentationView = view <EOL> footstepsPanel = None <EOL> robotsystem . create ( view , globals ( ) ) <EOL> def processSingleBlock ( robotStateModel , whichFile = <NUM_LIT:0> ) : <EOL> if ( whichFile == <NUM_LIT:0> ) : <EOL> polyData = ioUtils . readPolyData ( os . path . join ( dataDir , '<STR_LIT>' ) ) <EOL> vis . updatePolyData ( polyData , '<STR_LIT>' , parent = '<STR_LIT>' ) <EOL> else : <EOL> polyData = ioUtils . readPolyData ( os . path . join ( dataDir , '<STR_LIT>' ) ) <EOL> cwdemo . chosenTerrain = '<STR_LIT>' <EOL> cwdemo . supportContact = lcmdrc . footstep_params_t . SUPPORT_GROUPS_MIDFOOT_TOE <EOL> vis . updatePolyData ( polyData , '<STR_LIT>' , parent = '<STR_LIT>' ) <EOL> if drcargs . args ( ) . directorConfigFile . find ( '<STR_LIT>' ) != - <NUM_LIT:1> : <EOL> standingFootName = '<STR_LIT>' <EOL> else : <EOL> standingFootName = '<STR_LIT>' <EOL> standingFootFrame = robotStateModel . getLinkFrame ( standingFootName ) <EOL> vis . updateFrame ( standingFootFrame , standingFootName , parent = '<STR_LIT>' , visible = False ) <EOL> polyData = cwdemo . getRecedingTerrainRegion ( polyData , footstepsDriver . getFeetMidPoint ( robotStateModel ) ) <EOL> clusters = segmentation . findHorizontalSurfaces ( polyData ) <EOL> if ( clusters is None ) : <EOL> print "<STR_LIT>" <EOL> return <EOL> blocks , match_idx , groundPlane = cwdemo . extractBlocksFromSurfaces ( clusters , standingFootFrame ) <EOL> footsteps = cwdemo . placeStepsOnBlocks ( blocks , groundPlane , standingFootName , standingFootFrame ) <EOL> cwdemo . drawFittedSteps ( footsteps ) <EOL> def processSnippet ( ) : <EOL> obj = om . getOrCreateContainer ( '<STR_LIT>' ) <EOL> om . getOrCreateContainer ( '<STR_LIT>' , obj ) <EOL> if ( continuouswalkingDemo . processContinuousStereo ) : <EOL> polyData = ioUtils . readPolyData ( os . path . join ( dataDir , '<STR_LIT>' ) ) <EOL> polyData = segmentation . applyVoxelGrid ( polyData , leafSize = <NUM_LIT> ) <EOL> else : <EOL> polyData = ioUtils . readPolyData ( os . path . join ( dataDir , '<STR_LIT>' ) ) <EOL> vis . updatePolyData ( polyData , '<STR_LIT>' , parent = '<STR_LIT>' ) <EOL> if drcargs . args ( ) . directorConfigFile . find ( '<STR_LIT>' ) != - <NUM_LIT:1> : <EOL> standingFootName = '<STR_LIT>' <EOL> else : <EOL> standingFootName = '<STR_LIT>' <EOL> standingFootFrame = robotStateModel . getLinkFrame ( standingFootName ) <EOL> vis . updateFrame ( standingFootFrame , standingFootName , parent = '<STR_LIT>' , visible = False ) <EOL> clusters = segmentation . findHorizontalSurfaces ( polyData ) <EOL> if ( clusters is None ) : <EOL> print "<STR_LIT>" <EOL> return <EOL> blocks , match_idx , groundPlane = cwdemo . extractBlocksFromSurfaces ( clusters , standingFootFrame ) <EOL> footsteps = cwdemo . placeStepsOnBlocks ( blocks , groundPlane , standingFootName , standingFootFrame ) <EOL> cwdemo . drawFittedSteps ( footsteps ) <EOL> navigationPanel = None <EOL> continuouswalkingDemo = continuouswalkingdemo . ContinousWalkingDemo ( robotStateModel , footstepsPanel , footstepsDriver , playbackpanel , robotStateJointController , ikPlanner , <EOL> teleopJointController , navigationPanel , cameraview , jointLimitChecker = None ) <EOL> cwdemo = continuouswalkingDemo <EOL> processSingleBlock ( robotStateModel , <NUM_LIT:1> ) <EOL> '''<STR_LIT>''' <EOL> if app . getTestingInteractiveEnabled ( ) : <EOL> view . show ( ) <EOL> app . showObjectModel ( ) <EOL> app . start ( ) </s>
