====== Lua for miniHUBO ====== ===== Upennalizers Github and Wiki ===== [[https://github.com/UPenn-RoboCup/UPennalizers|Github]]\\ [[https://github.com/UPenn-RoboCup/UPennalizers/wiki|Wiki]]\\ ==== Development Workstation Setup ==== Installers and Instructions: [[https://github.com/UPenn-RoboCup/UPennalizers/wiki/Setup-Development-Workstation|Setup]]\\ ===== Lua Documentation ===== [[http://www.lua.org/docs.html|Documentation]]\\ ===== Webots Setup for DASL MiniHUBO Model ===== Please refer to the Upennalizers Development Workstation Setup guide for the github repository and necessary installs needed. To compile the UPenn code for use with MiniHUBO, we need to compile for the generic version (not Darwin or Nao). cd ~/UPennalizers/Lib sudo make setup_webots_generic After that, for ease of use later, we will create a symbolic link between one of the default Darwin Controllers and the Webots default controllers folder cd $WEBOTS_HOME/resources/projects/default/controllers$ sudo ln -s ~/UPennalizers/WebotsController darwin-op_team_1 where $WEBOTS_HOME likely resides in **usr/local/**. ===== Some files need to be changed ===== ==== start.lua ==== In UPennalizers/WebotsController/, edit **start.lua** by commenting out the line **dofile("Player/player.lua");** and uncommenting **dofile("Player/Test/test_walk_webots_op.lua");**. Save it. **NOTE:** If you are unable to copy the code without the line numbers, try Firefox. **Edited start.lua:** require('controller'); print("\nStarting Webots Lua controller..."); playerID = os.getenv('PLAYER_ID') + 0; teamID = os.getenv('TEAM_ID') + 0; --dofile("Player/player.lua"); -- Run test_vision --dofile("Player/Test/test_vision_webots_op.lua"); dofile("Player/Test/test_walk_webots_op.lua"); ==== test_walk_webots_op.lua ==== test_walk_webots_op.lua is located in Upennalizers/Player/Test/. Comment out the two lines (39 and 40) ... require('shm') require('Body') require('vector') -- BodyFSM=require('BodyFSM'); -- HeadFSM=require('HeadFSM'); require('getch') require('Motion'); require('walk'); require('Speak') require('util') darwin = false; webots = false; ... ==== GenericWebotsBody.lua ==== GenericWebotsBody.lua is located in UPennalizers/Lib/Platform/WebotsGeneric/Body/. **Edited GenericWebotsBody.lua:** module(..., package.seeall); require('controller'); controller.wb_robot_init(); timeStep = controller.wb_robot_get_basic_time_step(); tDelta = .001*timeStep; -- Get webots tags: tags = {}; jointNames = {"HeadYaw", "HeadPitch", "LShoulderPitch", "LShoulderRoll", "LShoulderYaw", "LElbowPitch", "LHipYaw", "LHipRoll", "LHipPitch", "LKneePitch", "LAnklePitch", "LAnkleRoll", "RHipYaw", "RHipRoll", "RHipPitch", "RKneePitch", "RAnklePitch", "RAnkleRoll", "RShoulderPitch", "RShoulderRoll", "RShoulderYaw", "RElbowPitch", "CHipYaw"}; -- Added this joint nJoint = #jointNames; indexHead = 1; nJointHead = 2; indexLArm = 3; nJointLArm = 4; indexLLeg = 7; nJointLLeg = 6; indexRLeg = 13; nJointRLeg = 6; indexRArm = 19; nJointRArm = 4; indexCHipYaw = 23; -- Added for "CHipYaw" ... ===== Test it ===== YOU MUST MAKE THE SYSTEM EVERY TIME YOU EDIT GENERIC WEBOTS BODY you must now cd to the UPennalizers/Lib directory and make. make setup_webots_generic This will copy the changed files into the Player/Lib directory. Now, if you open up the world file for Penn's MiniHUBO model, he should start walking in place when you push play.