samplerobot-terrain-walk.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 """
00004  this is example file for SampleRobot robot terrain walking
00005 
00006  for SlopeUpDown
00007  $ roslaunch hrpsys samplerobot.launch CONTROLLER_PERIOD:=200 PROJECT_FILE:=`rospack find hrpsys`/share/hrpsys/samples/SampleRobot/SampleRobot.TerrainFloor.SlopeUpDown.xml
00008  $ rosrun hrpsys samplerobot-terrain-walk.py --SlopeUpDown
00009 
00010  for StairUp
00011  $ roslaunch hrpsys samplerobot.launch CONTROLLER_PERIOD:=200 PROJECT_FILE:=`rospack find hrpsys`/share/hrpsys/samples/SampleRobot/SampleRobot.TerrainFloor.StairUp.xml
00012  $ rosrun hrpsys samplerobot-terrain-walk.py --StairUp
00013 
00014  for StairDown
00015  $ roslaunch hrpsys samplerobot.launch CONTROLLER_PERIOD:=200 PROJECT_FILE:=`rospack find hrpsys`/share/hrpsys/samples/SampleRobot/SampleRobot.TerrainFloor.StairDown.xml
00016  $ rosrun hrpsys samplerobot-terrain-walk.py --StairDown
00017 
00018 """
00019 
00020 import imp, sys, os
00021 
00022 # set path to hrpsys to use HrpsysConfigurator
00023 try:
00024     imp.find_module('hrpsys') # catkin installed
00025     sys.path.append(imp.find_module('hrpsys')[1])
00026 except: # rosbuild installed
00027     import roslib
00028     roslib.load_manifest('hrpsys')
00029 
00030 sys.path.append(os.path.dirname(os.path.abspath(__file__))+'/../share/hrpsys/samples/SampleRobot/') # set path to SampleRobot
00031 
00032 import samplerobot_terrain_walk
00033 
00034 if __name__ == '__main__':
00035     samplerobot_terrain_walk.demo()
00036     import sys
00037     if len(sys.argv) != 2:
00038         print "Usage:"
00039         print " ",sys.argv[0]," --StairUp or --StairDown or --SlopeUpDown"
00040     else:
00041         if sys.argv[1] == "--StairUp":
00042             samplerobot_terrain_walk.demoStairUp()
00043         elif sys.argv[1] == "--StairDown":
00044             samplerobot_terrain_walk.demoStairDown()
00045         elif sys.argv[1] == "--SlopeUpDown":
00046             samplerobot_terrain_walk.demoSlopeUpDown()
00047         else:
00048             print "Usage:"
00049             print " ",sys.argv[0]," --StairUp or --StairDown or --SlopeUpDown"
00050 
00051 
00052 ## IGNORE ME: this code used for rostest
00053 if [s for s in sys.argv if "--gtest_output=xml:" in s] :
00054     import unittest, rostest
00055     rostest.run('hrpsys', 'samplerobot_terrain_walk', unittest.TestCase, sys.argv)
00056 
00057 
00058 
00059 
00060 
00061 


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Wed Aug 26 2015 11:53:03