├── __init__.py ├── corpus ├── __init__.py ├── ktest │ ├── .gitignore │ └── Makefile ├── leds.py ├── ImageSubscriber.h ├── Lights.cpp ├── COMKinematics.h ├── sensors.py ├── WBLights.h ├── ThreadedImageTranscriber.h ├── ImageTranscriber.h ├── WBEnactor.h ├── Lights.h ├── synchro.py ├── WBTranscriber.h ├── ThreadedMotionEnactor.h ├── WBImageTranscriber.h ├── NaoRGBLight.h ├── PyLights.h ├── PySensors.h ├── PyRoboGuardian.h ├── NaoLights.h ├── cmake.man.corpus │ ├── corpusconfig.h.in │ └── buildconfig.cmake ├── NaoEnactor.h ├── messaging.h ├── messaging.cpp ├── Transcriber.h └── PyLights.cpp ├── frames ├── .gitignore ├── grab └── sync ├── tables ├── .gitignore └── sync ├── noggin ├── util │ └── __init__.py ├── playbook │ ├── __init__.py │ └── PBInterface.py ├── typeDefs │ ├── __init__.py │ ├── Sonar.py │ ├── VisualObject.py │ └── Play.py ├── headTracking │ ├── __init__.py │ ├── TrackingConstants.py │ └── BasicStates.py ├── navigator │ ├── NavMath.py │ ├── __init__.py │ └── ChaseStates.py ├── __init__.py ├── players │ ├── __init__.py │ ├── pGoTo.py │ ├── pMotion.py │ ├── pSnapshot.py │ ├── pWalkUnitTest.py │ ├── BrunswickSpeeds.py │ ├── pNone.py │ ├── pSweet.py │ ├── pTestLookTo.py │ ├── NoneStates.py │ ├── PositionConstants.py │ ├── pKicker.py │ ├── SweetStates.py │ ├── GoalieConstants.py │ ├── MakeKickStates.py │ ├── KickerStates.py │ ├── pData.py │ ├── pMakeKick.py │ ├── SnapshotStates.py │ ├── PositionTransitions.py │ ├── PenaltyKickStates.py │ ├── DataStates.py │ └── KickingHelpers.py ├── cmake.noggin │ ├── Switch.py.in │ ├── WebotsConfig.py.in │ ├── TeamConfig.py.in │ ├── nogginconfig.in │ └── buildconfig.cmake ├── PyLoc.h ├── offline │ ├── NavStructs.h │ ├── convertRobotLog.cpp │ ├── mclTest.cpp │ ├── navToObs.cpp │ └── README ├── Makefile ├── GameStates.py ├── FallController.py └── LocSystem.h ├── motion ├── gaits │ ├── __init__.py │ └── GaitConstants.py ├── debug │ ├── .gitignore │ ├── accel │ │ ├── ZmpEKF.cpp │ │ ├── .gitignore │ │ ├── ZmpAccEKF.cpp │ │ ├── AccEKF.cpp │ │ ├── README │ │ ├── Makefile │ │ ├── accel.R │ │ ├── zmpaccel.R │ │ └── zmp_log.R │ ├── Makefile │ ├── gains_log.R │ ├── sensor_zmp.R │ ├── sensor_log.R │ ├── dest_log.R │ ├── joints_log.R │ ├── effector_log.R │ ├── stiff_log.R │ ├── locus_log.R │ └── com_f_log.R ├── nao-motion.dia ├── octave │ ├── obsplot.m │ └── setupobserver.m ├── FreezeCommand.h ├── UnfreezeCommand.h ├── NullBodyProvider.h ├── BaseFreezeCommand.h ├── NullHeadProvider.h ├── __init__.py ├── BaseFreezeCommand.cpp ├── MetaGait.h ├── SensorAngles.h ├── StepCommand.h ├── WalkingArm.h ├── SpringSensor.h ├── ChainQueue.cpp ├── PyMotion.h ├── NullProvider.h ├── cmake.man.motion │ ├── motionconfig.in │ └── buildconfig.cmake ├── Gait.h ├── RobotGaits.py ├── Gait.cpp ├── ChainQueue.h ├── LinearChoppedCommand.h ├── mathematica │ └── README ├── ChoppedCommand.h ├── WalkController.h ├── SmoothChoppedCommand.h ├── MotionCommand.h ├── ChopShop.h ├── Motion.cpp ├── HeadJointCommand.cpp ├── WalkingConstants.h ├── JointCommand.h ├── HeadJointCommand.h ├── ZmpEKF.h └── SetHeadCommand.h ├── vision ├── matrix.py ├── ConcreteLandmark.cpp ├── __init__.py ├── Zlib.h ├── cmake.vision │ ├── profileconfig.h.in │ ├── visionconfig.h.in │ └── buildconfig.cmake ├── ConcreteLandmark.h ├── VisionStructs.h ├── VisualDetection.cpp ├── VisionHelpers.h ├── Makefile ├── Blobs.h ├── VisualBall.cpp ├── Field.h ├── Cross.h ├── Profiler.h └── VisualRobot.cpp ├── .gitmodules ├── include ├── LineDef.h ├── BasicWorldConstants.h ├── WBNames.h ├── debug.h ├── SensorDef.h ├── CortexDef.h ├── AiboConnect.h └── Common.h ├── searchman ├── cmake ├── proxies.cmake ├── FindWEBOTS.cmake ├── geode.cmake ├── FindFINK.cmake └── FindBOOST_PYTHON.cmake ├── cmake.man ├── nameconfig.in └── upload.sh.in ├── comm ├── cmake.comm │ ├── commconfig.in │ └── buildconfig.cmake ├── Makefile ├── __init__.py ├── GameControllerConfig.h └── CommTimer.h ├── .gitignore ├── TMan.h ├── TTMan.h ├── TMan.cpp ├── scripts └── setup-autologin ├── manmodule.h └── TTMan.cpp /__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /corpus/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frames/.gitignore: -------------------------------------------------------------------------------- 1 | * -------------------------------------------------------------------------------- /tables/.gitignore: -------------------------------------------------------------------------------- 1 | * -------------------------------------------------------------------------------- /noggin/util/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /motion/gaits/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /noggin/playbook/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /noggin/typeDefs/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /motion/debug/.gitignore: -------------------------------------------------------------------------------- 1 | *.pdf 2 | -------------------------------------------------------------------------------- /noggin/headTracking/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /noggin/navigator/NavMath.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /noggin/navigator/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /motion/debug/accel/ZmpEKF.cpp: -------------------------------------------------------------------------------- 1 | ../../ZmpEKF.cpp -------------------------------------------------------------------------------- /vision/matrix.py: -------------------------------------------------------------------------------- 1 | 2 | from _matrix import * 3 | -------------------------------------------------------------------------------- /corpus/ktest/.gitignore: -------------------------------------------------------------------------------- 1 | com 2 | newiktest 3 | *.o 4 | -------------------------------------------------------------------------------- /motion/debug/accel/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | accel 3 | *.pdf -------------------------------------------------------------------------------- /motion/debug/accel/ZmpAccEKF.cpp: -------------------------------------------------------------------------------- 1 | ../../ZmpAccEKF.cpp -------------------------------------------------------------------------------- /noggin/__init__.py: -------------------------------------------------------------------------------- 1 | from _localization import Loc 2 | -------------------------------------------------------------------------------- /motion/debug/accel/AccEKF.cpp: -------------------------------------------------------------------------------- 1 | ../../../corpus/AccEKF.cpp -------------------------------------------------------------------------------- /noggin/players/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = ['0.0.1'] 2 | -------------------------------------------------------------------------------- /noggin/cmake.noggin/Switch.py.in: -------------------------------------------------------------------------------- 1 | 2 | from . import ${PYTHON_PLAYER} as selectedPlayer 3 | -------------------------------------------------------------------------------- /motion/nao-motion.dia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/northern-bites/nao-man/HEAD/motion/nao-motion.dia -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "tables"] 2 | path = tables 3 | url = robocup@robocup.bowdoin.edu:git/tables.git 4 | -------------------------------------------------------------------------------- /corpus/leds.py: -------------------------------------------------------------------------------- 1 | 2 | try: 3 | import _leds 4 | except ImportError: 5 | import sys 6 | print >>sys.stderr, "**** WARNING - no backend _leds module located ****" 7 | -------------------------------------------------------------------------------- /include/LineDef.h: -------------------------------------------------------------------------------- 1 | /* Line Landmark Constants 2 | */ 3 | 4 | #ifndef LineDef_h_DEFINED 5 | #define LineDef_h_DEFINED 6 | 7 | 8 | #endif // LineDef_h_DEFINED 9 | 10 | -------------------------------------------------------------------------------- /noggin/cmake.noggin/WebotsConfig.py.in: -------------------------------------------------------------------------------- 1 | WEBOTS_ACTIVE = "${WEBOTS_BACKEND}" 2 | 3 | if WEBOTS_ACTIVE == "ON": 4 | WEBOTS_ACTIVE = True 5 | else: 6 | WEBOTS_ACTIVE = False 7 | -------------------------------------------------------------------------------- /noggin/cmake.noggin/TeamConfig.py.in: -------------------------------------------------------------------------------- 1 | # File to set the team number and player number in python. Generated by CMake. 2 | PLAYER_NUMBER = ${GC_PLAYER_NUMBER} 3 | TEAM_NUMBER = ${GC_TEAM_NUMBER} 4 | -------------------------------------------------------------------------------- /motion/octave/obsplot.m: -------------------------------------------------------------------------------- 1 | startTime = 1; 2 | endTime = 3; 3 | plot([startTime:dt:endTime],[result_zmp(startTime/dt:endTime/dt) ; result_zmp_ref(startTime/dt:endTime/dt) ; result_x(startTime/dt:endTime/dt)]) 4 | -------------------------------------------------------------------------------- /motion/debug/Makefile: -------------------------------------------------------------------------------- 1 | 2 | R=R 3 | R_FILES = $(wildcard *.R) 4 | R_OPTS = --no-save 5 | CAT = cat 6 | 7 | graphs : 8 | for rf in $(R_FILES); do $(R) $(R_OPTS) < $$rf; done; 9 | 10 | clean: 11 | $(RM) *.pdf -------------------------------------------------------------------------------- /corpus/ImageSubscriber.h: -------------------------------------------------------------------------------- 1 | #ifndef IMAGE_SUBSCRIBER_H 2 | #define IMAGE_SUBSCRIBER_H 3 | 4 | class ImageSubscriber { 5 | public: 6 | virtual void notifyNextVisionImage() = 0; 7 | virtual ~ImageSubscriber() {} 8 | }; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /include/BasicWorldConstants.h: -------------------------------------------------------------------------------- 1 | #ifndef BasicWorldConstants_h 2 | #define BasicWorldConstants_h 3 | 4 | static const float GRAVITY_mss = -9.8f; //in Z direction (up is positive)m/s^2 5 | 6 | static const int DAYS_PER_YEAR = 365; //Except for leap years.... uh oh 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /searchman: -------------------------------------------------------------------------------- 1 | if [ `uname -s` = "Darwin" ]; then 2 | 3 | grep -rn --exclude=frames --exclude=tables --exclude=build --exclude=install "$1" * 4 | 5 | else 6 | 7 | grep -rn --exclude-dir=frames --exclude-dir=tables --exclude-dir=build --exclude-dir=install "$1" * 8 | 9 | 10 | fi -------------------------------------------------------------------------------- /corpus/Lights.cpp: -------------------------------------------------------------------------------- 1 | #include "Lights.h" 2 | const std::string Lights::LED_NAMES[Lights::NUM_LED_NAMES] = { 3 | "LeftEar","RightEar", 4 | "LeftEye","RightEye", 5 | "Chest", 6 | "LeftFoot", "RightFoot"}; 7 | 8 | 9 | Lights::Lights(){}; 10 | Lights::~Lights(){}; 11 | 12 | -------------------------------------------------------------------------------- /cmake/proxies.cmake: -------------------------------------------------------------------------------- 1 | SET( AL_DIR "$ENV{AL_DIR}" ) 2 | 3 | SET( PROXIES_INCLUDE_DIR ${AL_DIR}/include/alproxies/ ) 4 | #FILE( GLOB PROXIES_FILES RELATIVE ${PROXIES_INCLUDE_DIR} ${PROXIES_INCLUDE_DIR}*proxy.h ) 5 | SET(${PROXIES_FILES} "" ) 6 | 7 | MARK_AS_ADVANCED( PROXIES_INCLUDE_DIR PROXIES_FILES ) 8 | -------------------------------------------------------------------------------- /noggin/players/pGoTo.py: -------------------------------------------------------------------------------- 1 | 2 | from . import SoccerFSA 3 | from . import GoToStates 4 | 5 | class SoccerPlayer(SoccerFSA.SoccerFSA): 6 | def __init__(self, brain): 7 | SoccerFSA.SoccerFSA.__init__(self,brain) 8 | self.addStates(GoToStates) 9 | self.setName('pGoTo') 10 | -------------------------------------------------------------------------------- /noggin/players/pMotion.py: -------------------------------------------------------------------------------- 1 | 2 | from . import SoccerFSA 3 | from . import MotionStates 4 | 5 | class SoccerPlayer(SoccerFSA.SoccerFSA): 6 | def __init__(self, brain): 7 | SoccerFSA.SoccerFSA.__init__(self,brain) 8 | self.addStates(MotionStates) 9 | self.setName('pMotion') 10 | -------------------------------------------------------------------------------- /noggin/players/pSnapshot.py: -------------------------------------------------------------------------------- 1 | 2 | from . import SoccerFSA 3 | from . import SnapshotStates 4 | 5 | class SoccerPlayer(SoccerFSA.SoccerFSA): 6 | def __init__(self, brain): 7 | SoccerFSA.SoccerFSA.__init__(self,brain) 8 | self.addStates(SnapshotStates) 9 | self.setName('pSnapshot') 10 | -------------------------------------------------------------------------------- /noggin/players/pWalkUnitTest.py: -------------------------------------------------------------------------------- 1 | 2 | from . import SoccerFSA 3 | from . import WalkTestStates 4 | 5 | class SoccerPlayer(SoccerFSA.SoccerFSA): 6 | def __init__(self, brain): 7 | SoccerFSA.SoccerFSA.__init__(self,brain) 8 | self.addStates(WalkTestStates) 9 | self.setName('pWalkUnitTest') 10 | -------------------------------------------------------------------------------- /motion/FreezeCommand.h: -------------------------------------------------------------------------------- 1 | #ifndef FreezeCommand_h 2 | #define FreezeCommand_h 3 | 4 | #include "BaseFreezeCommand.h" 5 | 6 | class FreezeCommand : public BaseFreezeCommand { 7 | public: 8 | FreezeCommand() : BaseFreezeCommand(MotionConstants::DEFAULT_OFF_STIFFNESS){} 9 | ~FreezeCommand(){}; 10 | 11 | }; 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /motion/debug/accel/README: -------------------------------------------------------------------------------- 1 | To run, 2 | type 'make run'. This will compile the sources, run them, and then run R on their output and generate some nice pdf graphs. 3 | 4 | Assumes that there is a tab separated csv located at 5 | ../../../../Desktop/accels.csv 6 | 7 | To change this file path, edit the make file or run ./accel manually. -------------------------------------------------------------------------------- /motion/UnfreezeCommand.h: -------------------------------------------------------------------------------- 1 | #ifndef UnfreezeCommand_h 2 | #define UnfreezeCommand_h 3 | 4 | #include "BaseFreezeCommand.h" 5 | 6 | class UnfreezeCommand : public BaseFreezeCommand { 7 | public: 8 | UnfreezeCommand() : BaseFreezeCommand(MotionConstants::DEFAULT_ON_STIFFNESS){} 9 | ~UnfreezeCommand(){}; 10 | 11 | }; 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /motion/gaits/GaitConstants.py: -------------------------------------------------------------------------------- 1 | # configuration parameters that are unchanged between gaits 2 | # 3 | # if you want to modify them in your gait, DON'T CHANGE THEM HERE 4 | 5 | WALKING = 1.0 6 | NON_WALKING = 0.0 7 | 8 | ODO_CONFIG = (1.0, #xOdoScale 9 | 1.0, #yOdoScale 10 | 1.0) #thetaOdoScale 11 | 12 | ARM_CONFIG = (0.0,) #armAmplitude (degs) 13 | -------------------------------------------------------------------------------- /corpus/COMKinematics.h: -------------------------------------------------------------------------------- 1 | #ifndef COMKinematics_h_DEFINED 2 | #define COMKinematics_h_DEFINED 3 | 4 | #include "Kinematics.h" 5 | 6 | namespace Kinematics{ 7 | 8 | const NBMath::ufvector4 9 | getCOMc(const std::vector bodyAngles); 10 | 11 | const NBMath::ufvector4 12 | slowCalculateChainCom(const ChainID id, 13 | const float angles[]); 14 | 15 | }; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /motion/NullBodyProvider.h: -------------------------------------------------------------------------------- 1 | #ifndef NullBodyProvider_h 2 | #define NullBodyProvider_h 3 | 4 | #include "NullProvider.h" 5 | 6 | class NullBodyProvider : public NullProvider { 7 | public: 8 | NullBodyProvider(boost::shared_ptr s, 9 | boost::shared_ptr p) : 10 | NullProvider(s, p, MotionConstants::null_body_mask){} 11 | ~NullBodyProvider(){}; 12 | }; 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /motion/BaseFreezeCommand.h: -------------------------------------------------------------------------------- 1 | #ifndef BaseFreezeCommand_h 2 | #define BaseFreezeCommand_h 3 | 4 | #include "MotionCommand.h" 5 | 6 | class BaseFreezeCommand : public MotionCommand { 7 | public: 8 | BaseFreezeCommand(float stiffness); 9 | virtual ~BaseFreezeCommand(); 10 | 11 | float getStiffness(); 12 | private: 13 | void setChainList(); 14 | float targetStiffness; 15 | }; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /motion/NullHeadProvider.h: -------------------------------------------------------------------------------- 1 | #ifndef NullHeadProvider_h 2 | #define NullHeadProvider_h 3 | 4 | #include "NullProvider.h" 5 | 6 | class NullHeadProvider : public NullProvider { 7 | public: 8 | NullHeadProvider(boost::shared_ptr s, 9 | boost::shared_ptr p) : 10 | NullProvider(s, p, MotionConstants::null_head_mask){} 11 | ~NullHeadProvider() {}; 12 | }; 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /noggin/PyLoc.h: -------------------------------------------------------------------------------- 1 | #ifndef PyLoc_h_DEFINED 2 | #define PyLoc_h_DEFINED 3 | #include 4 | void c_init_localization(); 5 | // C++ backend insertion (must be set before import) 6 | // can only be called once (subsequent calls ignored) 7 | void set_loc_reference(boost::shared_ptr _loc); 8 | void set_ballEKF_reference(boost::shared_ptr _ballEKF); 9 | #endif // PyLoc_h_DEFINED 10 | -------------------------------------------------------------------------------- /noggin/players/BrunswickSpeeds.py: -------------------------------------------------------------------------------- 1 | MAX_X_SPEED = 13 2 | MIN_X_SPEED = -4 3 | MIN_X_MAGNITUDE = 1.5 4 | 5 | MAX_Y_SPEED = 13 6 | MIN_Y_SPEED = -MAX_Y_SPEED 7 | MIN_Y_MAGNITUDE = 3 8 | 9 | MAX_SPIN_SPEED = 30.0 10 | MIN_SPIN_SPEED = -MAX_SPIN_SPEED 11 | MIN_SPIN_MAGNITUDE = 4.0 12 | 13 | MAX_SPIN_WHILE_X_SPEED = 30.0 14 | MIN_SPIN_WHILE_X_SPEED = -MAX_SPIN_WHILE_X_SPEED 15 | MIN_SPIN_WHILE_X_MAGNITUDE = 4.0 16 | -------------------------------------------------------------------------------- /noggin/players/pNone.py: -------------------------------------------------------------------------------- 1 | 2 | import man.motion as motion 3 | 4 | from . import SoccerFSA 5 | from . import NoneStates 6 | 7 | class SoccerPlayer(SoccerFSA.SoccerFSA): 8 | def __init__(self, brain): 9 | SoccerFSA.SoccerFSA.__init__(self,brain) 10 | #jf- self.setTimeFunction(self.brain.nao.getSimulatedTime) 11 | self.addStates(NoneStates) 12 | self.setName('Player pNone') 13 | -------------------------------------------------------------------------------- /motion/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from _motion import (MotionInterface, 3 | BodyJointCommand, 4 | HeadJointCommand, 5 | GaitCommand, 6 | SetHeadCommand, 7 | CoordHeadCommand, 8 | WalkCommand, 9 | FreezeCommand, 10 | UnfreezeCommand, 11 | StepCommand) 12 | -------------------------------------------------------------------------------- /vision/ConcreteLandmark.cpp: -------------------------------------------------------------------------------- 1 | #include "ConcreteLandmark.h" 2 | 3 | ConcreteLandmark::ConcreteLandmark(const float _fieldX, 4 | const float _fieldY) : 5 | fieldX(_fieldX), fieldY(_fieldY) { 6 | } 7 | 8 | ConcreteLandmark::ConcreteLandmark(const ConcreteLandmark& other) : 9 | fieldX(other.fieldX), fieldY(other.fieldY) { 10 | 11 | } 12 | 13 | ConcreteLandmark::~ConcreteLandmark() {} 14 | -------------------------------------------------------------------------------- /noggin/players/pSweet.py: -------------------------------------------------------------------------------- 1 | # 2 | # A behavior to test SweetMoves. 3 | # 4 | 5 | from . import SoccerFSA 6 | from . import SweetStates 7 | 8 | class SoccerPlayer(SoccerFSA.SoccerFSA): 9 | def __init__(self, brain): 10 | SoccerFSA.SoccerFSA.__init__(self,brain) 11 | self.addStates(SweetStates) 12 | self.setName('pSweet') 13 | # No fall protection when testing sweetMoves 14 | brain.roboguardian.enableFallProtection(False) 15 | 16 | -------------------------------------------------------------------------------- /cmake.man/nameconfig.in: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- Tell editors this is a C++ file (despite it's .in extension) */ 2 | /* This is an auto generated file. Please do not edit it.*/ 3 | 4 | 5 | #ifndef _nameconfig_h 6 | #define _nameconfig_h 7 | 8 | 9 | 10 | 11 | // :::::::::::::::::::::::::::::::::::::::::::::::::::::: Options variables :::.. 12 | 13 | 14 | //Get names into C++ 15 | #define ROBOT_NAME_${ROBOT_NAME} 16 | 17 | 18 | #endif // !_nameconfig_h 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /corpus/sensors.py: -------------------------------------------------------------------------------- 1 | 2 | import sys 3 | try: 4 | import _sensors 5 | except ImportError: 6 | print >>sys.stderr,"**** WARNING - no backend _sensors module located ****" 7 | _sensors = None 8 | 9 | if _sensors and not hasattr(_sensors, "inst"): 10 | raise ImportError("C++ _sensors backend is not initialized. Did you mean " 11 | "to compile with USE_PYSENSORS_FAKE_BACKEND?") 12 | 13 | 14 | def Sensors(): 15 | return _sensors.inst 16 | -------------------------------------------------------------------------------- /noggin/players/pTestLookTo.py: -------------------------------------------------------------------------------- 1 | """ a behavoir that tests the lookTo of headTracking by using points strictly relative to the robots posiiton and shouldn't be screwed up by bad localization""" 2 | 3 | from . import SoccerFSA 4 | from . import TestLookToStates 5 | 6 | class SoccerPlayer(SoccerFSA.SoccerFSA): 7 | def __init__(self, brain): 8 | SoccerFSA.SoccerFSA.__init__(self, brain) 9 | self.addStates(TestLookToStates) 10 | self.setName('pTestLookTo') 11 | -------------------------------------------------------------------------------- /noggin/navigator/ChaseStates.py: -------------------------------------------------------------------------------- 1 | 2 | DEBUG = False 3 | 4 | def chaseToPoint(nav): 5 | pass 6 | 7 | def approachTargetWide(self, target): 8 | ''' 9 | will act similarily to current approachBallWithLoc 10 | ''' 11 | pass 12 | 13 | def approachTargetClose(self, target): 14 | ''' 15 | will act similarily to approachBallWalk 16 | ''' 17 | pass 18 | 19 | def positionForKick(self): 20 | ''' 21 | will position us to kick the ball 22 | ''' 23 | pass 24 | 25 | -------------------------------------------------------------------------------- /vision/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | import sys 3 | 4 | try: 5 | import naovision 6 | except ImportError, e: 7 | try: 8 | import aibovision 9 | except ImportError, e2: 10 | print >>sys.stderr, "Error importing C++ Vision extension" 11 | print >>sys.stderr, "For Nao:", e 12 | print >>sys.stderr, "For Aibo:", e2 13 | else: 14 | vision_instance = aibovision.aibo 15 | else: 16 | vision_instance = naovision.nao 17 | 18 | def Vision(): 19 | return vision_instance 20 | -------------------------------------------------------------------------------- /corpus/WBLights.h: -------------------------------------------------------------------------------- 1 | #ifndef WBLights_h_DEFINED 2 | #define WBLights_h_DEFINED 3 | 4 | #include "Lights.h" 5 | 6 | /** 7 | * Leds for Webots are not implemented yet. This class is simply a placeholder 8 | */ 9 | class WBLights : public Lights{ 10 | public: 11 | WBLights(){}; 12 | ~WBLights(){}; 13 | 14 | public: 15 | void setRGB(const std::string led_id, const int rdbHex){}; 16 | void setRGB(const unsigned int led_id, const int rdbHex){}; 17 | 18 | void sendLights(){}; 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /vision/Zlib.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ZLIB_H_NORTHERN_BITES 3 | #define ZLIB_H_NORTHERN_BITES 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "debug.h" 10 | #include "zlib/zlib.h" 11 | 12 | class Zlib { 13 | private: 14 | static void zerr(int ret); 15 | public: 16 | static unsigned char* readCompressedFile(FILE *in, int& outLength); 17 | static bool writeCompressedFile(FILE *out, const unsigned char *in, int inLength); 18 | }; 19 | 20 | #endif // ZLIB_H_NORTHERN_BITES 21 | -------------------------------------------------------------------------------- /include/WBNames.h: -------------------------------------------------------------------------------- 1 | #ifndef WBNames_h 2 | #define WB_Names_h 3 | 4 | 5 | namespace WBNames{ 6 | 7 | static const unsigned int NUM_FSR = 8; 8 | 9 | enum FSR_INDICES { 10 | LFSR_FL = 0, 11 | LFSR_FR, 12 | LFSR_RL, 13 | LFSR_RR, 14 | RFSR_FL, 15 | RFSR_FR, 16 | RFSR_RL, 17 | RFSR_RR, 18 | }; 19 | 20 | 21 | static const string FSR_CORE[NUM_FSR] = { 22 | "LFsrFL","LFsrFR","LFsrBL","LFsrBR", 23 | "RFsrFL","RFsrFR","RFsrBL","RFsrBR" 24 | }; 25 | 26 | } 27 | #endif 28 | -------------------------------------------------------------------------------- /noggin/players/NoneStates.py: -------------------------------------------------------------------------------- 1 | 2 | import math 3 | 4 | import man.motion as motion 5 | import man.motion.SweetMoves as SweetMoves 6 | import man.motion.MotionConstants as MotionConstants 7 | 8 | 9 | def gamePlaying(player): 10 | ''' Overwritting the gameInital State''' 11 | return player.stay() 12 | 13 | def gameReady(player): 14 | if player.firstFrame(): 15 | player.brain.tracker.switchTo('locPans') 16 | player.standup() 17 | 18 | if player.counter < 100: 19 | player.brain.sensors.saveFrame() 20 | 21 | return player.stay() 22 | -------------------------------------------------------------------------------- /noggin/players/PositionConstants.py: -------------------------------------------------------------------------------- 1 | import BrunswickSpeeds as speeds 2 | USE_SQUAT_DEFENDER = False 3 | 4 | BALL_SPIN_POSITION_THRESH = 10 5 | BALL_SPIN_BUFFER = 10 6 | BALL_OFF_SPIN_TIME = 30 7 | 8 | RELOC_UNCERT_XY_THRESH = 100 9 | RELOC_UNCERT_THETA_THRESH = 40 10 | WELL_LOCED_UNCERT_XY = 30 11 | WELL_LOCED_UNCERT_THRESH = 25 12 | 13 | RELOC_SPIN_FRAME_THRESH = 70 14 | SHOULD_RELOC_FRAME_THRESH = 6 15 | 16 | RELOC_SPIN_SPEED = speeds.MAX_SPIN_SPEED 17 | 18 | AT_POSITION_KICK_DIST = 25 19 | NOT_AT_POSITION_FRAMES_THRESH = 5 20 | CHANGE_OMNI_THRESH = 0 21 | GOTO_DEST_EPSILON = 10. 22 | -------------------------------------------------------------------------------- /corpus/ThreadedImageTranscriber.h: -------------------------------------------------------------------------------- 1 | #ifndef _ThreadedImageTranscriber_h 2 | #define _ThreadedImageTranscriber_h 3 | 4 | 5 | #include "ImageTranscriber.h" 6 | #include "synchro.h" 7 | 8 | class ThreadedImageTranscriber : public ImageTranscriber , public Thread{ 9 | public: 10 | ThreadedImageTranscriber(boost::shared_ptr sensors, 11 | boost::shared_ptr synchro, 12 | std::string name) 13 | : ImageTranscriber(sensors), Thread(synchro, name){}; 14 | virtual ~ThreadedImageTranscriber() { } 15 | 16 | }; 17 | 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /noggin/headTracking/TrackingConstants.py: -------------------------------------------------------------------------------- 1 | TRACKING = 'tracking' 2 | 3 | LOC_PANS = 'locPans' 4 | 5 | PAN_LEFT_ONCE = 'panLeftOnce' 6 | 7 | MAX_PAN_SPEED = 90 # deg/sec 8 | 9 | TRACKER_FRAMES_ON_TRACK_THRESH = 1 10 | TRACKER_FRAMES_OFF_REFIND_THRESH = 25 11 | ACTIVE_LOC_STARE_THRESH = 45 12 | ACTIVE_LOC_OFF_REFIND_THRESH = 40 13 | LOOK_TO_TIME_TO_FIND = 45 14 | 15 | NUM_ACTIVE_PANS = 2 16 | (PAN_LEFT, 17 | PAN_RIGHT) = range(NUM_ACTIVE_PANS) 18 | 19 | PAN_UP_PITCH_THRESH = 10 20 | 21 | NUM_LOOK_DIRS = 4 22 | (LOOK_LEFT, 23 | LOOK_UP, 24 | LOOK_RIGHT, 25 | LOOK_DOWN) = range(NUM_LOOK_DIRS) 26 | -------------------------------------------------------------------------------- /vision/cmake.vision/profileconfig.h.in: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _profileconfig_h 3 | #define _profileconfig_h 4 | 5 | 6 | // Turn on/off profiling function calls 7 | #define USE_TIME_PROFILING_${USE_TIME_PROFILING} 8 | #ifdef USE_TIME_PROFILING_ON 9 | # define USE_TIME_PROFILING 10 | #else 11 | # undef USE_TIME_PROFILING 12 | #endif 13 | 14 | // Turn on/off automatic profiling summary printing 15 | #define USE_PROFILER_AUTO_PRINT_${USE_PROFILER_AUTO_PRINT} 16 | #ifdef USE_PROFILER_AUTO_PRINT_ON 17 | # define USE_PROFILER_AUTO_PRINT 18 | #else 19 | # undef USE_PROFILER_AUTO_PRINT 20 | #endif 21 | 22 | 23 | #endif // !_profileconfig_h 24 | -------------------------------------------------------------------------------- /vision/ConcreteLandmark.h: -------------------------------------------------------------------------------- 1 | #ifndef ConcreteLandmark_h_defined__ 2 | #define ConcreteLandmark_h_defined__ 3 | 4 | #include 5 | 6 | class ConcreteLandmark { 7 | public: 8 | ConcreteLandmark(const float _fieldX, const float _fieldY); 9 | ConcreteLandmark(const ConcreteLandmark& other); 10 | virtual ~ConcreteLandmark(); 11 | 12 | virtual const std::string toString() const = 0; 13 | 14 | const float getFieldX() const { return fieldX; } 15 | const float getFieldY() const { return fieldY; } 16 | 17 | private: 18 | // point fieldLocation; 19 | const float fieldX, fieldY; 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /motion/BaseFreezeCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "BaseFreezeCommand.h" 2 | 3 | 4 | 5 | BaseFreezeCommand::BaseFreezeCommand(float stiffness) 6 | :MotionCommand(MotionConstants::FREEZE) 7 | { 8 | setChainList(); 9 | targetStiffness = stiffness; 10 | } 11 | 12 | void BaseFreezeCommand::setChainList() { 13 | chainList.insert(chainList.end(), 14 | MotionConstants::FREEZE_CHAINS, 15 | MotionConstants::FREEZE_CHAINS + 16 | MotionConstants::FREEZE_NUM_CHAINS); 17 | } 18 | 19 | BaseFreezeCommand::~BaseFreezeCommand(){ 20 | 21 | } 22 | 23 | 24 | float BaseFreezeCommand::getStiffness(){ 25 | return targetStiffness; 26 | } 27 | -------------------------------------------------------------------------------- /corpus/ImageTranscriber.h: -------------------------------------------------------------------------------- 1 | #ifndef IMAGE_TRANSCRIBER_H 2 | #define IMAGE_TRANSCRIBER_H 3 | 4 | #include 5 | 6 | #include "Sensors.h" 7 | #include "ImageSubscriber.h" 8 | 9 | class ImageTranscriber { 10 | public: 11 | ImageTranscriber(boost::shared_ptr s) 12 | : sensors(s) { } 13 | virtual ~ImageTranscriber() { } 14 | 15 | virtual void setSubscriber(ImageSubscriber *_subscriber) { 16 | subscriber = _subscriber; 17 | } 18 | 19 | virtual void releaseImage() = 0; 20 | 21 | protected: 22 | boost::shared_ptr sensors; 23 | //void(ImageSubscriber::*imageCallback)(); 24 | ImageSubscriber *subscriber; 25 | }; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /cmake/FindWEBOTS.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | SET(WEBOTS_DIR $ENV{WEBOTS_HOME}) 4 | SET(WEBOTS_INCLUDE_DIR "${WEBOTS_DIR}/include/controller/c" 5 | "${WEBOTS_DIR}/include/") 6 | 7 | 8 | IF( "${WEBOTS_DIR}" STREQUAL "") 9 | MESSAGE(ERROR "Unable to set WEBOTS DIR. Make sure to set WEBOTS_HOME in .bashrc or .profile") 10 | ENDIF( "${WEBOTS_DIR}" STREQUAL "") 11 | 12 | 13 | SET(WEBOTS_DEFINITIONS -DWEBOTS_BACKEND) 14 | 15 | IF( APPLE ) 16 | SET(WEBOTS_LIBRARIES "${WEBOTS_DIR}/lib/libController.dylib") 17 | ELSE ( APPLE ) 18 | #This needs to get set for other platforms besides Linux, eventually 19 | SET(WEBOTS_LIBRARIES "${WEBOTS_DIR}/lib/libController.so") 20 | ENDIF ( APPLE ) 21 | MARK_AS_ADVANCED( WEBOTS_INCLUDE_DIR ) -------------------------------------------------------------------------------- /noggin/players/pKicker.py: -------------------------------------------------------------------------------- 1 | # 2 | # A behavior to test kicking. States are defined as methods in Kicking States 3 | # Note that it is crucial to implement the appropriate game controller states 4 | # that you wish to override. (By default they do nothing.) 5 | # By inheriting from the SoccerFSA, we only need to set the name of the player 6 | # and add any additional gourps of states. (GameControlerStates are added in the 7 | # super class.) 8 | # 9 | 10 | from . import SoccerFSA 11 | from . import KickerStates 12 | 13 | class SoccerPlayer(SoccerFSA.SoccerFSA): 14 | def __init__(self, brain): 15 | SoccerFSA.SoccerFSA.__init__(self,brain) 16 | self.addStates(KickerStates) 17 | self.setName('pKicker') 18 | 19 | -------------------------------------------------------------------------------- /corpus/ktest/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MAN_DIR=../man 5 | 6 | CXX_INCLUDES=-I../../include -I../../corpus -I../../motion -I/sw/include 7 | CXX_FLAGS=-Wall -Wno-unused -DNDEBUG -O3 8 | CXX=g++ 9 | 10 | 11 | 12 | oldik : OldInverseKinematics.cpp 13 | $(CXX) $(CXX_FLAGS) $(CXX_INCLUDES) -c ../OldInverseKinematics.cpp 14 | 15 | newik : ../InverseKinematics.cpp 16 | $(CXX) $(CXX_FLAGS) $(CXX_INCLUDES) -c ../InverseKinematics.cpp 17 | 18 | oldmain : oldik 19 | $(CXX) $(CXX_FLAGS) $(CXX_INCLUDES) -o oldiktest main.cpp OldInverseKinematics.o 20 | 21 | newmain : newik 22 | $(CXX) $(CXX_FLAGS) $(CXX_INCLUDES) -o newiktest main.cpp InverseKinematics.o 23 | 24 | com : newik COM.cpp 25 | $(CXX) $(CXX_FLAGS) $(CXX_INCLUDES) -o comtest COM.cpp InverseKinematics.o 26 | 27 | all: com -------------------------------------------------------------------------------- /vision/VisionStructs.h: -------------------------------------------------------------------------------- 1 | #ifndef VisionStructs_h_defined 2 | #define VisionStructs_h_defined 3 | 4 | #include "Structs.h" 5 | 6 | // a blob structure that holds information about its own location, and 7 | // information involving its larger blob structure 8 | struct blob { 9 | // bounding coordinates of the blob 10 | point leftTop; 11 | point rightTop; 12 | point leftBottom; 13 | point rightBottom; 14 | int pixels; // the total number of correctly colored pixels in our blob 15 | int area; 16 | }; 17 | 18 | struct run { 19 | int x; 20 | int y; 21 | int h; 22 | }; 23 | 24 | struct stop { 25 | int x; 26 | int y; 27 | int bad; 28 | int good; 29 | int span; 30 | }; 31 | 32 | #endif // VisionStructs_h_defined 33 | -------------------------------------------------------------------------------- /frames/grab: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #Script to sync frames between robot and your computer 4 | ROBOT=$1 5 | 6 | LOCAL_DEST=$2 7 | LOCAL_DEST=$LOCAL_DEST-$ROBOT 8 | 9 | USAGE="./grab \nExample: $> ./grab zaphod graz/falseBalls" 10 | 11 | if [ "$1" = "" ]; then 12 | echo "No robot specified" 13 | echo $USAGE 14 | exit 1 15 | fi 16 | 17 | if [ "$2" = "" ]; then 18 | echo "No local destination specified" 19 | echo $USAGE 20 | exit 1 21 | fi 22 | 23 | echo "mkdir -p $LOCAL_DEST" 24 | mkdir -p $LOCAL_DEST 25 | 26 | # set directory to be world-writable so we can add learning files etc. 27 | 28 | chmod a+w $LOCAL_DEST 29 | 30 | echo "scp -r nao@$ROBOT:/home/nao/naoqi/frames/* $LOCAL_DEST/" 31 | scp -r nao@$ROBOT:/home/nao/naoqi/frames/* $LOCAL_DEST/ 32 | -------------------------------------------------------------------------------- /noggin/cmake.noggin/nogginconfig.in: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _nogginconfig_h 3 | #define _nogginconfig_h 4 | 5 | 6 | // Print about the initialization of the Man class 7 | #define DEBUG_NOGGIN_INITIALIZATION_${DEBUG_NOGGIN_INITIALIZATION} 8 | #ifdef DEBUG_NOGGIN_INITIALIZATION_ON 9 | # define DEBUG_NOGGIN_INITIALIZATION 10 | #else 11 | # undef DEBUG_NOGGIN_INITIALIZATION 12 | #endif 13 | 14 | // When defined, Noggin will not run behaviors after a Python error 15 | // until it is reloaded, via either reload(...) or reloadAll(). 16 | // This is to reduce/eliminate excess error output. 17 | #define USE_NOGGIN_AUTO_HALT_${USE_NOGGIN_AUTO_HALT} 18 | #ifdef USE_NOGGIN_AUTO_HALT_ON 19 | # define USE_NOGGIN_AUTO_HALT 20 | #else 21 | # undef USE_NOGGIN_AUTO_HALT 22 | #endif 23 | 24 | 25 | #endif // !_nogginconfig_h 26 | -------------------------------------------------------------------------------- /include/debug.h: -------------------------------------------------------------------------------- 1 | #ifndef DEBUG_H_DEFINED 2 | #define DEBUG_H_DEFINED 3 | 4 | #include "Common.h" 5 | 6 | #if !defined(OFFLINE) && ROBOT(AIBO) 7 | 8 | //#include 9 | 10 | /* 11 | * If you define DEBUG in a module, use DEBUG_PRINT(whatever) to print out 12 | * values. You may give DEBUG_PRINT as many arguments as you'd like. 13 | */ 14 | #ifdef DEBUG 15 | //#include // for OSYSPRINT 16 | ///#define DEBUG_PRINT(...) (OSYSPRINT((__VA_ARGS__)) & OSYSPRINT(("\n"))) 17 | #else 18 | //#define DEBUG_PRINT(...) 19 | #endif 20 | #endif //OFFLINE 21 | 22 | #if ROBOT(NAO) || defined(OFFLINE) 23 | #define print(...) (printf(__VA_ARGS__) & printf("\n")) 24 | #else 25 | //#define print(...) (OSYSPRINT((__VA_ARGS__)) & OSYSPRINT(("\n"))) 26 | #endif 27 | 28 | #endif // DEBUG_H_DEFINED 29 | -------------------------------------------------------------------------------- /motion/debug/accel/Makefile: -------------------------------------------------------------------------------- 1 | 2 | LDLIBS = 3 | #GLDLIBS = -framework AGL -framework OpenGL -framework GLUT -framework Foundation 4 | LDFLAGS = $(LDLIBS) $(GLDLIBS) -lm 5 | MAN_DIR = ../../.. 6 | INCLUDE = -I$(MAN_DIR)/include -I$(MAN_DIR)/motion -I$(MAN_DIR)/noggin -I$(MAN_DIR)/corpus -I$(MAN_DIR)/vision 7 | 8 | CC = g++ -g -Wall -Wno-unused 9 | 10 | PROGS = simple1 11 | OBJS = test.o AccEKF.o ZmpEKF.o ZmpAccEKF.o 12 | 13 | #LOG_FILE = ../../../../Desktop/accels.csv 14 | LOG_FILE = /tmp/com_log.xls 15 | 16 | default: accel 17 | 18 | accel: $(OBJS) 19 | $(CC) -o $@ $(OBJS) $(LDFLAGS) 20 | 21 | run: accel 22 | ./accel $(LOG_FILE) && R --no-save < zmp_log.R 23 | 24 | clean:: 25 | rm -f $(OBJS) 26 | rm -f accel 27 | rm -f accel_log-*.pdf 28 | 29 | 30 | %.o:: %.cpp 31 | $(CC) $(INCLUDE) -c $< -o $@ 32 | -------------------------------------------------------------------------------- /motion/debug/gains_log.R: -------------------------------------------------------------------------------- 1 | # R file to read in a debug walking output and generate pdf reports 2 | # Instructions: Install the R language (package 'r-base' in debian) 3 | # run 'make' in the terminal 4 | # Author: Johannes Strom 5 | # Date: Decemeber 2008 6 | 7 | 8 | name = "gains_log" 9 | PDF = ".pdf" 10 | 11 | file = paste("/tmp/",name,".xls",sep="") 12 | if(!file.exists(file)) 13 | quit("no") 14 | dat = read.table(file,header=T,na.strings=c("-")) 15 | 16 | pdf(paste(name,PDF,sep="")) 17 | names = c("gain") 18 | cols = c("2") 19 | plot(dat$time,dat$gain,type="l", 20 | main="G_d(j) function: the preview gain for a ZMP 21 | reference value 'index' frames in the future", 22 | xlab="index",ylab="value",col=cols) 23 | legend("top",lwd=2,legend=names,col=cols) 24 | dev.off() 25 | -------------------------------------------------------------------------------- /vision/cmake.vision/visionconfig.h.in: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- Tell editors this is a C++ file (despite it's .in extension) */ 2 | /* This is an auto generated file. Please do not edit it.*/ 3 | 4 | 5 | #ifndef _visionconfig_h_DEFINED 6 | #define _visionconfig_h_DEFINED 7 | 8 | 9 | 10 | 11 | // :::::::::::::::::::::::::::::::::::::::::::::::::::::: Options variables :::.. 12 | 13 | // Insert a 'fake' Vision object into the Python module 14 | #define USE_PYVISION_FAKE_BACKEND_${USE_PYVISION_FAKE_BACKEND} 15 | #ifdef USE_PYVISION_FAKE_BACKEND_ON 16 | # define USE_PYVISION_FAKE_BACKEND 17 | #else 18 | # undef USE_PYVISION_FAKE_BACKEND 19 | #endif 20 | 21 | #define OFFLINE_${OFFLINE} 22 | #ifdef OFFLINE_ON 23 | # define OFFLINE 24 | #else 25 | # undef OFFLINE 26 | #endif 27 | 28 | #endif // !_visionconfig_h_DEFINED 29 | 30 | -------------------------------------------------------------------------------- /comm/cmake.comm/commconfig.in: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- Tell editors this is a C++ file (despite it's .in extension) */ 2 | /* This is an auto generated file. Please do not edit it.*/ 3 | 4 | 5 | #ifndef _commconfig_h 6 | #define _commconfig_h 7 | 8 | 9 | 10 | 11 | // :::::::::::::::::::::::::::::::::::::::::::::::::::::: Options variables :::.. 12 | 13 | 14 | // Insert a 'fake' Comm object into the Python module 15 | #define USE_PYCOMM_FAKE_BACKEND_${USE_PYCOMM_FAKE_BACKEND} 16 | #ifdef USE_PYCOMM_FAKE_BACKEND_ON 17 | # define USE_PYCOMM_FAKE_BACKEND 18 | #else 19 | # undef USE_PYCOMM_FAKE_BACKEND 20 | #endif 21 | 22 | // Build with the Python GameController interface 23 | #define USE_PYTHON_GC_${USE_PYTHON_GC} 24 | #ifdef USE_PYTHON_GC_ON 25 | # define USE_PYTHON_GC 26 | #else 27 | # undef USE_PYTHON_GC 28 | #endif 29 | 30 | #endif // !_commconfig_h 31 | 32 | -------------------------------------------------------------------------------- /noggin/offline/NavStructs.h: -------------------------------------------------------------------------------- 1 | #ifndef NavStructs_h_DEFINED 2 | #define NavStructs_h_DEFINED 3 | 4 | #include "EKFStructs.h" 5 | #include "NogginStructs.h" 6 | /** 7 | * Class to hold a constant robot path vector over a given number of frames 8 | */ 9 | class NavMove 10 | { 11 | public: 12 | MotionModel move; 13 | BallPose ballVel; 14 | int time; // Number of frames over which to continue on the move vector 15 | NavMove(MotionModel _m, BallPose _b, int _t) : move(_m), ballVel(_b), 16 | time(_t) {} 17 | }; 18 | 19 | class NavPath 20 | { 21 | public: 22 | PoseEst startPos; // Real start position of the robot 23 | BallPose ballStart; // Real start position of the ball 24 | std::vector myMoves; // direction of movement per itteration 25 | }; 26 | 27 | #endif // NavStructs_h_DEFINED 28 | -------------------------------------------------------------------------------- /vision/VisualDetection.cpp: -------------------------------------------------------------------------------- 1 | // VisualDetection.cpp 2 | #include "VisualDetection.h" 3 | 4 | VisualDetection::VisualDetection(int _x, int _y, float _distance, 5 | float _bearing) : x(_x), y(_y), 6 | distance(_distance), 7 | bearing(_bearing) 8 | { 9 | } 10 | VisualDetection::VisualDetection(const VisualDetection& other) 11 | : x(other.x), y(other.y), width(other.width), height(other.height), 12 | centerX(other.centerX), centerY(other.centerY), angleX(other.angleX), 13 | angleY(other.angleY), focDist(other.focDist), distance(other.distance), 14 | bearing(other.bearing), elevation(other.elevation), 15 | distanceSD(other.distanceSD), bearingSD(other.bearingSD) {} 16 | 17 | VisualDetection::~VisualDetection() {} 18 | -------------------------------------------------------------------------------- /noggin/playbook/PBInterface.py: -------------------------------------------------------------------------------- 1 | from . import GoTeam 2 | 3 | class PBInterface: 4 | ''' 5 | This is the class that provides access to information about the playbook 6 | to any outside class 7 | ''' 8 | def __init__(self, brain): 9 | ''' 10 | Initializes the playbook 11 | ''' 12 | self.pb = GoTeam.GoTeam(brain) 13 | self.subRole = None 14 | self.lastSubRole = None 15 | 16 | def update(self): 17 | ''' 18 | Runs the playbook (calls the run method of GoTeam) 19 | ''' 20 | self.pb.run() 21 | self.storeUsedValues() 22 | return self.pb.play 23 | 24 | def subRoleChanged(self): 25 | return (self.subRole != self.lastSubRole) 26 | 27 | def storeUsedValues(self): 28 | self.lastSubRole = self.subRole 29 | self.subRole = self.pb.play.subRole 30 | -------------------------------------------------------------------------------- /noggin/players/SweetStates.py: -------------------------------------------------------------------------------- 1 | # 2 | # Defines states for SweetMove testing 3 | # 4 | 5 | import man.motion.SweetMoves as SweetMoves 6 | 7 | def gameInitial(player): 8 | player.gainsOn() 9 | return player.stay() 10 | 11 | def gameReady(player): 12 | return player.goLater('doMove') 13 | def gameSet(player): 14 | return player.goLater('doMove') 15 | def gamePlaying(player): 16 | return player.goLater('doMove') 17 | def gamePenalized(player): 18 | return player.goLater('doMove') 19 | 20 | def doMove(player): 21 | if player.firstFrame(): 22 | player.gainsOn() 23 | player.executeMove(SweetMoves.ZERO_POS) 24 | 25 | if player.counter == 1: 26 | return player.goLater('done') 27 | return player.stay() 28 | 29 | def done(player): 30 | if player.firstFrame(): 31 | return player.stay() 32 | return player.stay() 33 | -------------------------------------------------------------------------------- /corpus/WBEnactor.h: -------------------------------------------------------------------------------- 1 | #ifndef WBEnactor_h 2 | #define WBEnactor_h 3 | 4 | #include "Sensors.h" 5 | #include "Transcriber.h" 6 | #include "ThreadedMotionEnactor.h" 7 | 8 | #include 9 | 10 | class WBEnactor : public MotionEnactor { 11 | public: 12 | WBEnactor(boost::shared_ptr _sensors, 13 | boost::shared_ptr transcriber); 14 | virtual ~WBEnactor(); 15 | 16 | void postSensors(); 17 | void sendCommands(); 18 | 19 | protected: 20 | boost::shared_ptr sensors; 21 | boost::shared_ptr transcriber; 22 | 23 | static const int MOTION_FRAME_RATE; 24 | static const float MOTION_FRAME_LENGTH_uS; // in microseconds 25 | static const float MOTION_FRAME_LENGTH_S; // in seconds 26 | 27 | private: 28 | std::vector motionValues; 29 | std::vector jointDevices; 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build* 2 | install/* 3 | *config.h 4 | *.pyc 5 | *.ekf 6 | *.mcl 7 | *.obs 8 | upload.sh 9 | noggin/players/Switch.py 10 | noggin/WebotsConfig.py 11 | noggin/TeamConfig.py 12 | noggin/util/fakeData/* 13 | /noggin/util/navToObs 14 | /noggin/util/obsToLoc 15 | /noggin/offline/obsToLoc 16 | /noggin/offline/navToObs 17 | /TAGS 18 | /man 19 | /noggin/offline/noiseVaccuracy 20 | /noggin/offline/.Rhistory 21 | /noggin/offline/.RData 22 | /comm/TAGS 23 | /motion/TAGS 24 | /vision/TAGS 25 | /updateTags.sh 26 | /corpus/TAGS 27 | /noggin/TAGS 28 | /noggin/offline/TAGS 29 | /noggin/offline/*.o 30 | /noggin/playbook/TAGS 31 | /noggin/players/TAGS 32 | /noggin/util/TAGS 33 | /noggin/offline/convertRobotLog 34 | /motion/README.dvi 35 | /motion/README.out 36 | /motion/README.aux 37 | /motion/README.log 38 | /motion/README.toc 39 | /motion/README.pdf 40 | docs* 41 | /noggin/offline/c++filt 42 | /noggin/offline/faker 43 | -------------------------------------------------------------------------------- /corpus/Lights.h: -------------------------------------------------------------------------------- 1 | #ifndef Lights_h_DEFINED 2 | #define Lights_h_DEFINED 3 | 4 | #include 5 | #include 6 | 7 | /** 8 | * This class serves as an abstract, purely-virtual class to implement LED 9 | * access on various platforms. Interested parties should make subclasses 10 | * of this which connect with the approriate low level LED API on the robot. 11 | * For an example, see NaoLights. 12 | * 13 | * @author Johannes Strom 14 | * @date June 2009 15 | */ 16 | class Lights{ 17 | public: 18 | Lights(); 19 | virtual ~Lights(); 20 | 21 | public: 22 | virtual void setRGB(const std::string led_id, const int newRgbHex){}; 23 | virtual void setRGB(const unsigned int led_id, const int newRgbHex){}; 24 | virtual void sendLights(){}; 25 | 26 | static const unsigned int NUM_LED_NAMES = 7; 27 | static const std::string LED_NAMES[NUM_LED_NAMES]; 28 | 29 | }; 30 | #endif 31 | -------------------------------------------------------------------------------- /TMan.h: -------------------------------------------------------------------------------- 1 | #ifndef _TMan_h 2 | #define _TMan_h 3 | 4 | /** 5 | * This class represents the single extra thread variant of the TMan/TTMan pair. 6 | * It only manages one thread, which is the imageThread. See also TTMan 7 | */ 8 | 9 | #include "Man.h" 10 | 11 | #include "ThreadedImageTranscriber.h" 12 | 13 | 14 | class TMan : public Man { 15 | public: 16 | 17 | TMan(boost::shared_ptr _sensors, 18 | boost::shared_ptr _transcriber, 19 | boost::shared_ptr _imageTranscriber, 20 | boost::shared_ptr _enactor, 21 | boost::shared_ptr synchro, 22 | boost::shared_ptr _lights); 23 | 24 | virtual ~TMan(); 25 | 26 | virtual void startSubThreads(); 27 | 28 | virtual void stopSubThreads(); 29 | 30 | private: 31 | boost::shared_ptr threadedImageTranscriber; 32 | 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /cmake/geode.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | ############################ ALDEBARAN DIRECTORY 4 | # Ensure the AL_DIR variable is set 5 | 6 | IF( "x$ENV{AL_DIR}x" STREQUAL "xx") 7 | SET( AL_DIR "/usr/local/nao-1.6" ) 8 | SET( ENV{AL_DIR} ${AL_DIR} ) 9 | ELSE( "x$ENV{AL_DIR}x" STREQUAL "xx") 10 | SET( AL_DIR $ENV{AL_DIR} ) 11 | ENDIF( "x$ENV{AL_DIR}x" STREQUAL "xx") 12 | 13 | IF( NOT EXISTS ${AL_DIR} ) 14 | MESSAGE( FATAL_ERROR 15 | "Cannot find the path to Nao directory, configuration halted." 16 | ) 17 | ENDIF( NOT EXISTS ${AL_DIR} ) 18 | 19 | ############################# CROSS-COMPILATION VARIABLES 20 | # Set the variable for the cross-compilation directory, cmake variables 21 | 22 | SET( OE_CROSS_DIR "${AL_DIR}/crosstoolchain" ) 23 | 24 | SET( CMAKE_CROSSCOMPILING TRUE ) 25 | SET( CMAKE_SYSTEM_NAME Linux ) 26 | SET( CMAKE_SYSTEM_VERSION 1 ) 27 | SET( CMAKE_SYSTEM_PROCESSOR geode ) 28 | 29 | INCLUDE("${AL_DIR}/crosstoolchain/toolchain-geode.cmake") -------------------------------------------------------------------------------- /vision/VisionHelpers.h: -------------------------------------------------------------------------------- 1 | #ifndef VisionHelpers_h_defined 2 | #include 3 | inline int ROUND2(float x) { 4 | return static_cast( std::floor(x + 0.5f) ); 5 | } 6 | 7 | /* Calculate the euclidian distance between two points. 8 | * @param x x value of point 1 9 | * @param y y value of point 1 10 | * @param x1 x value of point 2 11 | * @param y1 y value of point 2 12 | * @return the distance between the objects 13 | */ 14 | inline float dist(int x, int y, int x1, int y1) { 15 | return std::sqrt(static_cast(std::abs(x - x1) * std::abs(x - x1) + 16 | std::abs(y - y1) * std::abs(y - y1) )); 17 | } 18 | 19 | /* Finds and returns the midpoint of two numbers. 20 | * @param a one number 21 | * @param b the other 22 | * @return the number halfway between (as int) 23 | */ 24 | inline int midPoint(int a, int b) { 25 | return a + (b - a) / 2; 26 | } 27 | 28 | #define VisionHelpers_h_defined 29 | #endif // VisionHelpers_h_defined 30 | -------------------------------------------------------------------------------- /TTMan.h: -------------------------------------------------------------------------------- 1 | #ifndef TTMan_h 2 | #define TTMan_h 3 | 4 | /** 5 | * This file is the double threaded (TT) version of man, 6 | * which runs a thread for both the enactor and the image transcriber 7 | */ 8 | 9 | #include "Man.h" 10 | #include "ThreadedMotionEnactor.h" 11 | #include "ThreadedImageTranscriber.h" 12 | 13 | class TTMan : public Man { 14 | public: 15 | TTMan(boost::shared_ptr _sensors, 16 | boost::shared_ptr _transcriber, 17 | boost::shared_ptr _imageTranscriber, 18 | boost::shared_ptr _enactor, 19 | boost::shared_ptr synchro, 20 | boost::shared_ptr _lights); 21 | ~TTMan(); 22 | 23 | void startSubThreads(); 24 | void stopSubThreads(); 25 | 26 | private: 27 | boost::shared_ptr threadedImageTranscriber; 28 | boost::shared_ptr threadedEnactor; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /noggin/players/GoalieConstants.py: -------------------------------------------------------------------------------- 1 | from .. import NogginConstants as Constants 2 | 3 | BALL_SAVE_LIMIT_TIME = 2.5 4 | MOVE_TO_SAVE_DIST_THRESH = 200. 5 | CENTER_SAVE_THRESH = 15. 6 | ORTHO_GOTO_THRESH = Constants.CENTER_FIELD_X * 0.5 7 | STRAFE_ONLY = True 8 | STRAFE_SPEED = 6 9 | STRAFE_STEPS = 3 10 | MAX_FRAMES_OFF_CENTER = 360 11 | MAX_STEPS_OFF_CENTER = 50 12 | BUFFER = 50 13 | STRAFE_THRESH_ONE = 10 14 | STRAFE_THRESH_TWO = 15 15 | STRAFE_THRESH_THREE = 25 16 | STRAFE_THRESH_FOUR = 35 17 | STRAFE_THRESH_FIVE = 45 18 | STRAFE_THRESH_SIX = 55 19 | STRAFE_THESH_SEVEN = 65 20 | 21 | AGGRESSIVENESS_OFFSET = 10 22 | GOALBOX_Y_REDUCTION = 20 23 | END_CLEAR_BUFFER = 10 24 | 25 | # Distance at which we use active localization 26 | ACTIVE_LOC_THRESH = 150. 27 | 28 | # Difference to goto a different point 29 | SHOULD_POSITION_DIFF = 5.0 30 | 31 | CHASE_FROM_SQUAT_DIST = 55.0 32 | CHASE_FROM_SQUAT_BEARING = 70.0 33 | CHASE_FROM_SQUAT_VEL = 4.0 34 | 35 | START_CHASE_BUFFER = 3 36 | STOP_CHASE_BUFFER = 3 37 | -------------------------------------------------------------------------------- /comm/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | .PHONY: all clean install noconfig 4 | 5 | CUR_DIR = $(shell pwd) 6 | BUILD_DIR = build 7 | CMAKE_DIR = cmake.comm 8 | CMAKE_CACHE = $(BUILD_DIR)/CMakeCache.txt 9 | CMAKE_SRCS = \ 10 | CMakeLists.txt \ 11 | buildconfig.cmake \ 12 | commconfig.h 13 | CMAKE_SRC := $(addprefix $(CMAKE_DIR),$(CMAKE_SRC)) 14 | CONFIG_FILE = commconfig.h 15 | 16 | TRUNK_REVISION = r0 #$(shell svn info | grep Revision | awk 'FS=" " {print $$2}') 17 | export TRUNK_REVISION 18 | 19 | CD=cd 20 | CMAKE=cmake 21 | CCMAKE=ccmake 22 | MKDIR=mkdir 23 | 24 | .SILENT: 25 | 26 | all: $(CMAKE_CACHE) 27 | @$(MAKE) -C $(BUILD_DIR) 28 | 29 | config: $(CMAKE_CACHE) 30 | @set -e; \ 31 | $(CD) $(BUILD_DIR); \ 32 | $(CCMAKE) .; \ 33 | 34 | install: $(CMAKE_CACHE) 35 | @$(MAKE) -C $(BUILD_DIR) install 36 | 37 | clean: 38 | $(RM) -r $(BUILD_DIR) $(CONFIG_FILE) 39 | 40 | $(CMAKE_CACHE): 41 | @set -e; \ 42 | $(MKDIR) -p $(BUILD_DIR); \ 43 | $(CD) $(BUILD_DIR); \ 44 | $(CMAKE) $(CUR_DIR)/$(CMAKE_DIR) 45 | 46 | -------------------------------------------------------------------------------- /comm/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | try: 3 | from ._comm import (Comm, 4 | GameController, 5 | inst, 6 | PENALTY_BALL_HOLDING, 7 | PENALTY_DAMAGE, 8 | PENALTY_GOALIE_PUSHING, 9 | PENALTY_ILLEGAL_DEFENDER, 10 | PENALTY_ILLEGAL_DEFENSE, 11 | PENALTY_LEAVING, 12 | PENALTY_MANUAL, 13 | PENALTY_NONE, 14 | PENALTY_OBSTRUCTION, 15 | STATE_FINISHED, 16 | STATE_INITIAL, 17 | STATE_PLAYING, 18 | STATE_READY, 19 | STATE_SET, 20 | STATE2_NORMAL, 21 | STATE2_PENALTYSHOOT) 22 | except ImportError: 23 | import sys 24 | print >>sys.stderr, "**** WARNING - No backend _comm module located ****" 25 | inst = None 26 | 27 | -------------------------------------------------------------------------------- /corpus/synchro.py: -------------------------------------------------------------------------------- 1 | 2 | ## WARNING, this file was automatically generated using the Northern 3 | ## Bites' Python wrapper extension module generator. Subsequent 4 | ## form-completion was done by hand. 5 | 6 | 7 | ## This program is free software: you can redistribute it and/or modify 8 | ## it under the terms of the GNU General Public License as published by 9 | ## the Free Software Foundation, either version 3 of the License, or 10 | ## (at your option) any later version. 11 | ## 12 | ## This program is distributed in the hope that it will be useful, 13 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ## GNU General Public License for more details. 16 | ## 17 | ## You should have received a copy of the GNU General Public License 18 | ## along with this program. If not, see . 19 | 20 | 21 | from ._synchro import (Event, 22 | Synchro, 23 | ) 24 | 25 | -------------------------------------------------------------------------------- /noggin/offline/convertRobotLog.cpp: -------------------------------------------------------------------------------- 1 | /* obsToNac.cpp */ 2 | #include "fakerIO.h" 3 | 4 | using namespace std; 5 | 6 | int main(int argc, char** argv) 7 | { 8 | // Information needed for the main method 9 | // IO Variables 10 | fstream robotFile; 11 | fstream toolFile; 12 | 13 | /* Test for the correct number of CLI arguments */ 14 | if(argc != 3) { 15 | cerr << "usage: " << argv[0] << " input-file output-file" << endl; 16 | return 1; 17 | } 18 | try { 19 | robotFile.open(argv[1], ios::in); 20 | 21 | } catch (const exception& e) { 22 | cout << "Failed to open input file" << argv[1] << endl; 23 | return 1; 24 | } 25 | 26 | try { 27 | toolFile.open(argv[2], ios::out); 28 | } catch (const exception& e) { 29 | cout << "Failed to open input file" << argv[1] << endl; 30 | return 1; 31 | } 32 | 33 | readRobotLogFile(&robotFile, &toolFile); 34 | robotFile.close(); 35 | toolFile.close(); 36 | 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /vision/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | .PHONY: all config clean install noconfig 4 | 5 | CUR_DIR = $(shell pwd) 6 | BUILD_DIR = build 7 | CMAKE_DIR = cmake.vision 8 | CMAKE_CACHE = $(BUILD_DIR)/CMakeCache.txt 9 | CMAKE_SRCS = \ 10 | CMakeLists.txt \ 11 | buildconfig.cmake \ 12 | profileconfig.h 13 | CMAKE_SRC := $(addprefix $(CMAKE_DIR),$(CMAKE_SRC)) 14 | CONFIG_FILES = visionconfig.h profileconfig.h 15 | 16 | TRUNK_REVISION = r0 #$(shell svn info | grep Revision | awk 'FS=" " {print $$2}') 17 | export TRUNK_REVISION 18 | 19 | CD=cd 20 | CMAKE=cmake 21 | CCMAKE=ccmake 22 | MKDIR=mkdir 23 | 24 | .SILENT: 25 | 26 | all: $(CMAKE_CACHE) 27 | @$(MAKE) -C $(BUILD_DIR) 28 | 29 | config: $(CMAKE_CACHE) 30 | @set -e; \ 31 | $(CD) $(BUILD_DIR); \ 32 | $(CCMAKE) .; \ 33 | 34 | install: $(CMAKE_CACHE) 35 | @$(MAKE) -C $(BUILD_DIR) install 36 | 37 | clean: 38 | $(RM) -r $(BUILD_DIR) $(CONFIG_FILES) 39 | 40 | $(CMAKE_CACHE): 41 | @set -e; \ 42 | $(MKDIR) -p $(BUILD_DIR); \ 43 | $(CD) $(BUILD_DIR); \ 44 | $(CMAKE) $(CUR_DIR)/$(CMAKE_DIR) 45 | 46 | -------------------------------------------------------------------------------- /motion/MetaGait.h: -------------------------------------------------------------------------------- 1 | #ifndef MetaGait_h_DEFINED 2 | #define MetaGait_h_DEFINED 3 | 4 | /** 5 | * The Meta Gait brokers between two gaits, the 'cur' and the 'next'. 6 | * Every frame, it reinterpolates between the two gaits based on 7 | * a total transition time which is specified in the gaits. 8 | * 9 | * TODO (Maybe): 10 | * - Use a cycloid to transition instead of a linear function 11 | * - Clip the maxTime to the length of a step. 12 | */ 13 | 14 | #include "AbstractGait.h" 15 | #include "Gait.h" 16 | class MetaGait : public AbstractGait { 17 | public: 18 | MetaGait(); 19 | ~MetaGait(); 20 | 21 | void tick_gait(); 22 | void setNewGaitTarget(Gait &nextTarget); 23 | void setStartGait(Gait &newCurGait); 24 | private: 25 | bool updateGaits(); 26 | float getPercentComplete(); 27 | void resetTransitioning(); 28 | 29 | private: 30 | Gait curGait, nextGait, newGait; 31 | bool newGaitSent; 32 | unsigned int transitionCounter; 33 | unsigned int transitionFrames; 34 | 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /corpus/WBTranscriber.h: -------------------------------------------------------------------------------- 1 | #ifndef WBTranscriber_h 2 | #define WBTranscriber_H 3 | 4 | 5 | #include 6 | #include 7 | 8 | #include "Transcriber.h" 9 | #include "AccEKF.h" 10 | #include "AngleEKF.h" 11 | 12 | class WBTranscriber : public Transcriber{ 13 | public: 14 | WBTranscriber(boost::shared_ptr s); 15 | virtual ~WBTranscriber(); 16 | 17 | void postMotionSensors(); 18 | void postVisionSensors(); 19 | 20 | private: 21 | const boost::tuple 22 | angleWrapper(const float accX, const float accY, 23 | const float gyroX,const float gyroY); 24 | private: 25 | AccEKF accEKF; 26 | std::vector jointValues; 27 | std::vector jointDevices; 28 | std::vector fsrValues; 29 | std::vector fsrDevices; 30 | WbDeviceTag acc; 31 | WbDeviceTag gyro; 32 | WbDeviceTag us1,us2,us3,us4; 33 | float prevAngleX, prevAngleY; 34 | AngleEKF angleEKF; 35 | 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /noggin/offline/mclTest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | #include "Observation.h" 6 | #include "MCL.h" 7 | 8 | int main() 9 | { 10 | // Testing the observation class stuff 11 | vector obs; 12 | VisualLine* vl1 = new VisualLine(); 13 | VisualLine* vl2 = new VisualLine(); 14 | VisualCorner vc(100, 200, 200.0f, 15 | 50.0f, *vl1, *vl2, 200.1f, 300.0f); 16 | FieldObjects* fo = new FieldObjects(YELLOW_GOAL_RIGHT_POST); 17 | (*fo).setX(1000); 18 | (*fo).setY(200); 19 | obs.push_back(*(new Observation(vc))); 20 | obs.push_back(*(new Observation(*vl1))); 21 | obs.push_back(*(new Observation(*vl2))); 22 | obs.push_back(*(new Observation(*fo))); 23 | 24 | 25 | MCL* myLoc = new MCL(); 26 | 27 | for(unsigned short i = 0; i < obs.size(); ++i) { 28 | cout << "(" << obs[i].getVisDist() << ", " << obs[i].getVisBearing() << ")" 29 | << endl; 30 | } 31 | 32 | // // Clean everything up 33 | delete vl1, vl2, fo; 34 | } 35 | -------------------------------------------------------------------------------- /include/SensorDef.h: -------------------------------------------------------------------------------- 1 | /* Contains the Most basic common information/types/defs */ 2 | 3 | #ifndef SensorDef_h_DEFINED 4 | #define SensorDef_h_DEFINED 5 | 6 | #include "Common.h" 7 | 8 | // Sensor locators for the sensor array returned from the robot. 9 | const int NUM_ERS7_SENSORS = 16; 10 | const int NUM_ERS220_SENSORS = 16; 11 | // 8 FSR, 4 foot bumpers, 7 Inertial, 2 Sonar, 1 - which support foot 12 | const int NUM_NAO_SENSORS = 22; 13 | const int NUM_LED_LIGHTS = 20; 14 | const int NUM_SENSOR_IDS = 34; 15 | 16 | const int NUM_SENSORS = NUM_NAO_SENSORS; 17 | const int NUM_INERTIAL_SENSORS = 7; 18 | 19 | static const int NUM_PY_SENSORS = 19; 20 | 21 | #define ACCELOMETER_Y 0 22 | #define ACCELOMETER_X 1 23 | #define ACCELOMETER_Z 2 24 | #define BODY_PSD 3 25 | #define BACK_REAR_SENSOR 4 26 | #define BACK_MIDDLE_SENSOR 5 27 | #define BACK_FRONT_SENSOR 6 28 | #define WLAN_SWITCH 7 29 | #define HEAD_SENSOR 8 30 | #define CHIN_SENSOR 9 31 | #define HEAD_PSD_NEAR 10 32 | #define HEAD_PSD_FAR 11 33 | #define LF_PAW 12 34 | #define LR_PAW 13 35 | #define RF_PAW 14 36 | #define RR_PAW 15 37 | 38 | #endif // Sensors_h_DEFINED 39 | 40 | -------------------------------------------------------------------------------- /motion/octave/setupobserver.m: -------------------------------------------------------------------------------- 1 | dt = 0.01; 2 | R = 1*10^(-6); 3 | N = 120; 4 | numPreviewFrames = N; 5 | Qx = 0.25; Qe = 0.3; 6 | Ql = [1,0,0;0,1,0;0,0,1]; 7 | 8 | g = 9800; 9 | z_h = 260; 10 | 11 | A0 = [1, dt, 0; g/z_h*dt, 1, -g/z_h*dt; 0, 0, 1]; 12 | b0 = [0; 0; dt]; 13 | c0 = [0, 0, 1]; 14 | 15 | Bt(1,1)=c0*b0; 16 | Bt(2:4,1)=b0(1:3); 17 | It(1,1)=1; 18 | It(2:4,1)=0; 19 | Ft(1,1:3)=c0*A0; 20 | Ft(2:4,1:3)=A0(1:3,1:3); 21 | Qt(1:4, 1:4)=0; 22 | Qt(1,1)=Qe; 23 | Qt(2:4,2:4)=c0' *Qx*c0; 24 | At(1:4,1)=It; 25 | At(1:4,2:4)=Ft; 26 | 27 | 28 | Pt=dare(At, Bt, Qt, R); 29 | 30 | Gx = (1/(R+Bt'*Pt*Bt)) * Bt'*Pt*Ft; 31 | Gi = (1/(R+Bt'*Pt*Bt)) * Bt'*Pt*It; 32 | 33 | Ac = At - Bt*(1/(R + Bt'*Pt*Bt)) * Bt'*Pt*At; 34 | X = -Ac'*Pt*It; 35 | Gd(1) = -Gi; 36 | for i=2:N, 37 | Gd(i) = (1/(R + Bt'*Pt*Bt))*Bt'*X; 38 | X = Ac'*X; 39 | end 40 | 41 | A = A0-b0*Gx; 42 | 43 | L = dlqr(A', c0', Ql , R)'; 44 | 45 | endTime = 10; 46 | for time=[0:dt:endTime], 47 | preview_frames = []; 48 | 49 | for j=[1:numPreviewFrames], 50 | preview_frames(j) = real( Gd(j)*(time + j*dt) ); 51 | end; 52 | end; 53 | -------------------------------------------------------------------------------- /comm/GameControllerConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2002,2003 Sony Corporation 3 | // 4 | // Permission to use, copy, modify, and redistribute this software for 5 | // non-commercial use is hereby granted. 6 | // 7 | // This software is provided "as is" without warranty of any kind, 8 | // either expressed or implied, including but not limited to the 9 | // implied warranties of fitness for a particular purpose. 10 | // 11 | #ifndef _GameControllerConfig_h_DEFINED 12 | #define _GameControllerConfig_h_DEFINED 13 | 14 | #define GAMECONTROLLER_CONNECTION_MAX 1 15 | 16 | // low battery warning; when the battery is lower than 17 | // this %, the Game Controller will turn on red LEDs 18 | // on the face during INITIAL, READY, and SET 19 | #define GAMECONTROLLER_BATTERY_WARNING 40 20 | 21 | // make buffer as big as the data structure 22 | // in RoboCupGameControlData.h 23 | #define GAMECONTROLLER_BUFFER_SIZE sizeof(RoboCupGameControlData) 24 | 25 | #define GAMECONTROLLER_RETURN_BUFFER_SIZE sizeof(RoboCupGameControlReturnData) 26 | 27 | // the file with the team number to load 28 | #define GAMECONTROLLER_TEAM_CFG "/MS/team.cfg" 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /motion/SensorAngles.h: -------------------------------------------------------------------------------- 1 | #ifndef SensorAngles_h_DEFINED 2 | #define SensorAngles_h_DEFINED 3 | 4 | #include 5 | #include 6 | #include "Sensors.h" 7 | #include "MetaGait.h" 8 | #include "SpringSensor.h" 9 | 10 | class SensorAngles{ 11 | public: 12 | SensorAngles(boost::shared_ptr s, const MetaGait * _gait); 13 | ~SensorAngles(); 14 | 15 | 16 | void tick_sensors(); 17 | void reset(); 18 | 19 | //tuple indices 20 | enum SensorAxis{ 21 | X = 0, 22 | Y 23 | }; 24 | 25 | const boost::tuple 26 | getAngles(const float scale = 1.0f) const ; 27 | 28 | private: 29 | void basic_sensor_feedback(); 30 | void spring_sensor_feedback(); 31 | 32 | private: 33 | boost::shared_ptr sensors; 34 | const MetaGait * gait; 35 | 36 | //store what will be returned by getAngles 37 | float sensorAngleX, sensorAngleY; 38 | 39 | SpringSensor springX,springY; 40 | 41 | //OLD 42 | //State info 43 | //sensor feedback stuff 44 | float lastSensorAngleX,lastSensorAngleY; 45 | 46 | }; 47 | 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /corpus/ThreadedMotionEnactor.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This class is an abstraction of the connection between the Switchboard and 3 | * the lower level access to robot hardware. Since this connection may change 4 | * often, and is different for the simulator and the robot, this class provides 5 | * a contract to fulfill to provide that connection. 6 | * 7 | * Each MotionEnactor is in charge of passing joint commands to the low-level. 8 | * Typically, this will be done by starting a high-priority thread which recurs 9 | * close to the timestep (20 ms) as possible. 10 | * Each enactor must call getNextJoints on the switchboard, and relay that 11 | * information correctly. 12 | */ 13 | 14 | #ifndef _ThreadedMotionEnactor_h_DEFINED 15 | #define _ThreadedMotionEnactor_h_DEFINED 16 | 17 | #include "MotionEnactor.h" 18 | #include "synchro.h" 19 | 20 | class ThreadedMotionEnactor : public MotionEnactor , public Thread{ 21 | public: 22 | ThreadedMotionEnactor(boost::shared_ptr synchro, 23 | std::string name) 24 | : MotionEnactor(), Thread(synchro, name){}; 25 | virtual ~ThreadedMotionEnactor() { } 26 | 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /vision/Blobs.h: -------------------------------------------------------------------------------- 1 | #ifndef Blobs_h_defined 2 | #define Blobs_h_defined 3 | 4 | #include "Common.h" 5 | #include "VisionStructs.h" 6 | #include "VisionHelpers.h" 7 | #include "Blob.h" 8 | 9 | using namespace std; 10 | 11 | static const int BADONE = -10000; 12 | 13 | class Blobs { 14 | public: 15 | Blobs(int howMany); 16 | virtual ~Blobs() {} 17 | 18 | void init(); 19 | void init(int which) {blobs[which].init();} 20 | void blobIt(int x, int y, int h); 21 | void setLeft(int which, int a); 22 | void setRight(int which, int a); 23 | void setTop(int which, int a); 24 | void setBottom(int which, int a); 25 | Blob* getTopAndMerge(int maxY); 26 | Blob* getWidest(); 27 | void zeroTheBlob(int which); 28 | void mergeBlobs(int first, int second); 29 | 30 | // getters 31 | int number() {return numBlobs;} 32 | Blob get(int which) {return blobs[which];} 33 | 34 | private: 35 | int total; 36 | int runsize; 37 | int biggestRun; 38 | int maxHeight; 39 | int maxOfBiggestRun; 40 | int numberOfRuns; 41 | int indexOfBiggestRun; 42 | int numBlobs; 43 | //blob checker, obj, pole, leftBox, rightBox; 44 | Blob* blobs; 45 | }; 46 | #endif 47 | -------------------------------------------------------------------------------- /vision/VisualBall.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Vision Ball class 3 | */ 4 | 5 | #include "VisualBall.h" 6 | #include "math.h" 7 | 8 | VisualBall::VisualBall() 9 | { 10 | init(); 11 | } 12 | 13 | /* Initializes Variables every frame. Make sure before using any of these 14 | * variables, to check to see if the ball is in frame by checking distance 15 | * first (if it's > 0) 16 | */ 17 | void VisualBall::init() { 18 | // Main Variables 19 | width = 0; 20 | height = 0; 21 | radius = 0; 22 | centerX = 0; 23 | centerY = 0; 24 | angleX = 0; 25 | angleY = 0; 26 | focDist = 0; 27 | distance = 0; 28 | bearing = 0; 29 | elevation = 0; 30 | } 31 | 32 | void VisualBall::setDistanceEst(estimate ball_est) 33 | { 34 | setBearingWithSD(ball_est.bearing); 35 | setElevation(ball_est.elevation); 36 | setDistanceWithSD(ball_est.dist); 37 | } 38 | 39 | void VisualBall::setDistanceWithSD(float _dist) 40 | { 41 | distance = _dist; 42 | setDistanceSD(ballDistanceToSD(distance)); 43 | } 44 | 45 | 46 | void VisualBall::setBearingWithSD(float _bearing) 47 | { 48 | bearing = _bearing; 49 | setBearingSD(ballBearingToSD(_bearing)); 50 | } 51 | -------------------------------------------------------------------------------- /motion/StepCommand.h: -------------------------------------------------------------------------------- 1 | #ifndef StepCommand_h 2 | #define StepCommand_h 3 | 4 | class StepCommand : public MotionCommand { 5 | public: 6 | StepCommand(float _x_mms, float _y_mms, float _theta_rads, int nSteps = 1) 7 | : MotionCommand(MotionConstants::WALK), 8 | x_mms(_x_mms),y_mms(_y_mms),theta_rads(_theta_rads), numSteps(nSteps) 9 | { setChainList(); } 10 | ~StepCommand(){} 11 | public: 12 | // velocities 13 | const float x_mms; //mm/second 14 | const float y_mms; //mm/second 15 | const float theta_rads; //rad/second 16 | const int numSteps; 17 | 18 | protected: 19 | virtual void setChainList() { 20 | chainList.assign(MotionConstants::STEP_CHAINS, 21 | MotionConstants::STEP_CHAINS + 22 | MotionConstants::STEP_NUM_CHAINS); 23 | } 24 | 25 | public: 26 | friend std::ostream& operator<< (std::ostream &o, const StepCommand &w) 27 | { 28 | return o << "StepCommand(" 29 | << w.x_mms << "," << w.y_mms << "," 30 | << w.theta_rads << ",nSteps=" < 10 | #include 11 | 12 | 13 | typedef boost::tuple, 14 | std::vector > ArmJointStiffTuple; 15 | 16 | class WalkingArm{ 17 | public: 18 | WalkingArm(const MetaGait * _gait,Kinematics::ChainID id); 19 | ~WalkingArm(); 20 | 21 | ArmJointStiffTuple tick(boost::shared_ptr ); 22 | 23 | void startLeft(); 24 | void startRight(); 25 | 26 | private: 27 | bool shouldSwitchStates(); 28 | void switchToNextState(); 29 | SupportMode nextState(); 30 | void setState(SupportMode newState); 31 | 32 | const float getShoulderPitchAddition(boost::shared_ptr supportStep); 33 | 34 | private: 35 | SupportMode state; 36 | Kinematics::ChainID chainID; 37 | const MetaGait *gait; 38 | 39 | unsigned int frameCounter; 40 | unsigned int singleSupportFrames; 41 | unsigned int doubleSupportFrames; 42 | bool startStep; 43 | StepType lastStepType; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /corpus/WBImageTranscriber.h: -------------------------------------------------------------------------------- 1 | #ifndef WBImageTranscriber_h 2 | #define WBImageTranscriber_h 3 | 4 | #include "ThreadedImageTranscriber.h" 5 | 6 | #include 7 | #include 8 | 9 | struct YUV { 10 | unsigned char Y; 11 | unsigned char U; 12 | unsigned char V; 13 | }; 14 | 15 | 16 | class WBImageTranscriber : public ImageTranscriber{ 17 | public: 18 | WBImageTranscriber(boost::shared_ptr s); 19 | ~WBImageTranscriber(); 20 | 21 | void releaseImage(); 22 | 23 | public: 24 | void waitForImage(); 25 | 26 | private: 27 | void setTwoYUV(unsigned char *image, const int baseIndex, 28 | const YUV yuv1, const YUV yuv2); 29 | const YUV getWBYUVFromRGB(const unsigned char image[], const int baseIndex); 30 | 31 | private: //members 32 | WbDeviceTag camera; 33 | unsigned char *image; 34 | 35 | static const int WEBOTS_IMAGE_HEIGHT; 36 | static const int WEBOTS_IMAGE_WIDTH; 37 | static const int HEIGHT_SCALE; 38 | static const int WIDTH_SCALE; 39 | static const int Y1_OFFSET; 40 | static const int U_OFFSET; 41 | static const int V_OFFSET; 42 | static const int Y2_OFFSET; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /include/CortexDef.h: -------------------------------------------------------------------------------- 1 | /* 2 | Constants for saving .FRMs used in Cortex 1.0 3 | */ 4 | 5 | #ifndef CortexDef_h_DEFINED 6 | #define CortexDef_h_DEFINED 7 | 8 | #include "VisionDef.h" 9 | 10 | // joints + accelorometers + psds + body_tilt 11 | #if ROBOT(AIBO) 12 | static const int NUM_RAW_DATA = 22; 13 | static const int RAW_DATA_SIZE = (2*NUM_RAW_DATA)*sizeof(double); 14 | static const int RAW_HEADER_SIZE = 100; 15 | static const int RAW_IMAGE_SIZE = IMAGE_BYTE_SIZE; 16 | #else 17 | static const int NUM_RAW_DATA = 22; 18 | static const int RAW_DATA_SIZE = 150*1024; 19 | static const int RAW_HEADER_SIZE = 0; 20 | static const int RAW_IMAGE_SIZE = IMAGE_BYTE_SIZE; 21 | #endif 22 | 23 | static const int SAVED_FRAME_SIZE = RAW_IMAGE_SIZE+RAW_HEADER_SIZE+RAW_DATA_SIZE; 24 | static const int SAVED_FRAME_BUFFER_FRAMES = 60; 25 | static const int SAVED_FRAME_BUFFER_SIZE = SAVED_FRAME_SIZE* 26 | SAVED_FRAME_BUFFER_FRAMES; // roughly 10mb 27 | 28 | #if ROBOT(AIBO) 29 | # define FRM_FILE_EXT ".FRM" 30 | #elif ROBOT(NAO_RL) 31 | # define FRM_FILE_EXT ".NFRM" 32 | #elif ROBOT(NAO_SIM) 33 | # define FRM_FILE_EXT ".NSFRM" 34 | #else 35 | # error Undefined robot type 36 | #endif 37 | 38 | 39 | #endif // CortexDef_h_DEFINED 40 | 41 | -------------------------------------------------------------------------------- /motion/SpringSensor.h: -------------------------------------------------------------------------------- 1 | #ifndef SpringSensor_h_DEFINED 2 | #define SpringSensor_h_DEFINED 3 | //WORK IN PROGRESS: 4 | //IDEA IS TO USE A SPRING MODEL TO RESTORE SENSORANGLE BACK TO ZERO over time 5 | #include "MetaGait.h" 6 | #include "CoordFrame.h" 7 | 8 | class SpringSensor { 9 | public: 10 | //tuple indices 11 | enum SensorAxis{ 12 | X = 0, 13 | Y 14 | }; 15 | 16 | SpringSensor(const MetaGait * _gait, const SensorAxis _axis); 17 | ~SpringSensor(); 18 | 19 | //Takes input the sensed angle of the robot MINUS the expected rotation 20 | void tick_sensor(const float sensorAngle); 21 | 22 | //returns a compensation to body Rot X or Y to keep robot level 23 | const float getSensorAngle(); 24 | void reset(); 25 | 26 | private: 27 | void updateMatrices(); 28 | 29 | private: 30 | const MetaGait * gait; 31 | const SensorAxis axis; 32 | const unsigned int K_INDEX; 33 | const unsigned int GAMMA_INDEX; 34 | const unsigned int MAX_INDEX; 35 | 36 | NBMath::ufvector3 x_k; 37 | NBMath::ufmatrix3 A; 38 | NBMath::ufvector3 b; 39 | NBMath::ufrowVector3 c; 40 | 41 | std::string name; 42 | 43 | float lastSensorAngle; 44 | }; 45 | #endif 46 | -------------------------------------------------------------------------------- /noggin/players/MakeKickStates.py: -------------------------------------------------------------------------------- 1 | from man.motion import SweetMoves 2 | from man.motion import StiffnessModes 3 | 4 | def gameInitial(player): 5 | return player.goLater('standup') 6 | 7 | def standup(player): 8 | if player.firstFrame(): 9 | player.executeMove(SweetMoves.STAND_FOR_KICK_LEFT) 10 | 11 | if player.counter == 30: 12 | return player.goLater('printKick') 13 | return player.stay() 14 | 15 | 16 | def printKick(player): 17 | angles = player.brain.sensors.angles 18 | if not player.counter%70: 19 | print "((%.2f,%.2f,%.2f,%.2f),"%(angles[2],angles[3],angles[4],angles[5]) 20 | print "(%.2f,%.2f,%.2f,%.2f,%.2f,%.2f),"%(angles[6],angles[7],angles[8], \ 21 | angles[9],angles[10], \ 22 | angles[11]) 23 | print "(%.2f,%.2f,%.2f,%.2f,%.2f,%.2f),"%(angles[12],angles[13],angles[14], \ 24 | angles[15],angles[16], \ 25 | angles[17]) 26 | print "(%.2f,%.2f,%.2f,%.2f), ),"%(angles[18],angles[19],angles[20],angles[21]) 27 | print " " 28 | print " " 29 | 30 | return player.stay() 31 | -------------------------------------------------------------------------------- /corpus/NaoRGBLight.h: -------------------------------------------------------------------------------- 1 | #ifndef NaoRGBLight_h_DEFINED 2 | #define NaoRGBLight_h_DEFINED 3 | 4 | #include 5 | #include "alvalue.h" 6 | #include "ALLedNames.h" 7 | 8 | class NaoRGBLight{ 9 | public: 10 | NaoRGBLight(const std::string _NBLedName, 11 | const unsigned int _NBLedID, 12 | const unsigned int numSubLeds, 13 | const unsigned int _startColor = 0, 14 | const unsigned int _endColor = ALNames::NUM_LED_COLORS); 15 | 16 | virtual ~NaoRGBLight(); 17 | 18 | bool updateCommand(const int newRgbHex); 19 | 20 | AL::ALValue * getAlias(){return &alias;} 21 | AL::ALValue * getCommand(){return &command;} 22 | 23 | private: 24 | void makeAlias(); 25 | void makeCommand(); 26 | const float getColor(const ALNames::LedColor c, const int rgbHex); 27 | 28 | private: 29 | AL::ALValue command; 30 | AL::ALValue alias; 31 | bool newValue; 32 | int rgbHex; 33 | 34 | const std::string NBLedName; 35 | const unsigned int NBLedID; 36 | const unsigned int numRGBSubLeds; 37 | const unsigned int startColor; 38 | const unsigned int endColor; 39 | 40 | public: 41 | static const float LED_ON; 42 | static const float LED_OFF; 43 | 44 | }; 45 | #endif 46 | -------------------------------------------------------------------------------- /motion/ChainQueue.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | #include "ChainQueue.h" 22 | using namespace std; 23 | 24 | using namespace Kinematics; 25 | 26 | ChainQueue::ChainQueue (ChainID id) 27 | : queue >(), 28 | chainID(id) 29 | { 30 | 31 | } 32 | 33 | // Removes all values from the queue 34 | void ChainQueue::clear(){ 35 | while ( !empty() ){ 36 | pop(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /motion/PyMotion.h: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | #ifndef PYMOTION_H_DEFINED 22 | #define PYMOTION_H_DEFINED 23 | 24 | void c_init_motion(); 25 | // C++ backend insertion (must be set before import) 26 | // steals a reference to the supplied MotionInterface 27 | // can only be called once (subsequent calls ignored) 28 | void set_motion_interface (MotionInterface *_interface); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /motion/NullProvider.h: -------------------------------------------------------------------------------- 1 | #ifndef NullProvider_h 2 | #define NullProvider_h 3 | 4 | #include 5 | 6 | #include "MotionProvider.h" 7 | #include "FreezeCommand.h" 8 | #include "UnfreezeCommand.h" 9 | 10 | #include "Sensors.h" 11 | #include "Kinematics.h" 12 | 13 | class NullProvider : public MotionProvider { 14 | public: 15 | NullProvider(boost::shared_ptr s, 16 | boost::shared_ptr p, 17 | const bool chain_mask[Kinematics::NUM_CHAINS]); 18 | virtual ~NullProvider(); 19 | 20 | void calculateNextJointsAndStiffnesses(); 21 | void hardReset(){} //Not implemented 22 | 23 | void setCommand(const boost::shared_ptr command); 24 | void setCommand(const boost::shared_ptr command); 25 | 26 | protected: 27 | void setActive(); 28 | void requestStopFirstInstance(){} //Not implemented 29 | private: 30 | void readNewStiffness(); 31 | private: 32 | boost::shared_ptr sensors; 33 | std::vector nextStiffness,lastStiffness; 34 | bool chainMask[Kinematics::NUM_CHAINS]; 35 | mutable pthread_mutex_t null_provider_mutex; 36 | bool frozen, freezingOn, freezingOff, newCommand; 37 | bool doOnce; 38 | boost::shared_ptr nextCommand; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /motion/cmake.man.motion/motionconfig.in: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- Tell editors this is a C++ file (despite it's .in extension) */ 2 | /* This is an auto generated file. Please do not edit it.*/ 3 | 4 | 5 | #ifndef _motionconfig_h 6 | #define _motionconfig_h 7 | 8 | 9 | 10 | // :::::::::::::::::::::::::::::::::::::::::::::::::::::: Options variables :::.. 11 | 12 | 13 | // Compile man/motion as a shared library for Python dynamic loading 14 | #define PYTHON_SHARED_MOTION_${PYTHON_SHARED_MOTION} 15 | #ifdef PYTHON_SHARED_MOTION_ON 16 | # define PYTHON_SHARED_MOTION 17 | #else 18 | # undef PYTHON_SHARED_MOTION 19 | #endif 20 | 21 | // Turn on/off the actual backend C++ calls to MotionInterface 22 | // in the Python _motion module 23 | #define USE_PYMOTION_CXX_BACKEND_${USE_PYMOTION_CXX_BACKEND} 24 | #ifdef USE_PYMOTION_CXX_BACKEND_ON 25 | # define USE_PYMOTION_CXX_BACKEND 26 | #else 27 | # undef USE_PYMOTION_CXX_BACKEND 28 | #endif 29 | 30 | #define DEBUG_MOTION_${DEBUG_MOTION} 31 | #ifdef DEBUG_MOTION_ON 32 | # define DEBUG_MOTION 33 | #else 34 | # undef DEBUG_MOTION 35 | #endif 36 | 37 | #define USE_MOTION_ACTUATORS_${USE_MOTION_ACTUATORS} 38 | #ifdef USE_MOTION_ACTUATORS_OFF 39 | # define NO_ACTUAL_MOTION 40 | #else 41 | # undef NO_ACTUAL_MOTION 42 | #endif 43 | 44 | 45 | #endif // !_motionconfig_h 46 | 47 | -------------------------------------------------------------------------------- /noggin/players/KickerStates.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file defines the states necessary for kick testing. Each method 3 | # defines a state. 4 | # 5 | 6 | import man.motion as motion 7 | import man.motion.SweetMoves as SweetMoves 8 | 9 | def gameInitial(player): 10 | player.gainsOn() 11 | return player.stay() 12 | 13 | def gameReady(player): 14 | return player.goLater('standup') 15 | def gameSet(player): 16 | return player.goLater('standup') 17 | def gamePlaying(player): 18 | return player.goLater('standup') 19 | def gamePenalized(player): 20 | return player.goLater('standup') 21 | 22 | def standup(player): 23 | if player.firstFrame(): 24 | player.gainsOn() 25 | walkCommand = motion.WalkCommand(x=0,y=0,theta=0) 26 | player.motion.setNextWalkCommand(walkCommand) 27 | 28 | if player.counter == 1: 29 | return player.goLater('kickStraight') 30 | return player.stay() 31 | 32 | def kickStraight(player): 33 | if player.firstFrame(): 34 | 35 | player.executeMove(SweetMoves.SHORT_QUICK_LEFT_KICK) 36 | 37 | if player.counter == 50: 38 | return player.goLater('done') 39 | return player.stay() 40 | 41 | def done(player): 42 | if player.firstFrame(): 43 | player.walkPose() 44 | return player.stay() 45 | return player.stay() 46 | -------------------------------------------------------------------------------- /comm/CommTimer.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _CommTimer_h_DEFINED 3 | #define _CommTimer_h_DEFINED 4 | 5 | #include 6 | 7 | #include "CommDef.h" 8 | 9 | 10 | class CommTimer 11 | { 12 | public: 13 | CommTimer(llong (*f)()); 14 | virtual ~CommTimer() { } 15 | 16 | inline llong timestamp(void) { 17 | return time() - epoch; 18 | } 19 | inline bool time_for_packet(void) { 20 | return timestamp() - packet_timer > MICROS_PER_PACKET; 21 | } 22 | inline void sent_packet(void) { 23 | packet_timer = timestamp(); 24 | } 25 | inline void mark(void) { 26 | mark_time = timestamp(); 27 | } 28 | inline llong elapsed(void) { 29 | return timestamp() - mark_time; 30 | } 31 | inline llong elapsed_seconds(void) { 32 | return timestamp() - mark_time; 33 | } 34 | 35 | bool check_packet(const CommPacketHeader &packet); 36 | void get_time_from_others(); 37 | void reset(); 38 | 39 | 40 | private: 41 | llong (*time)(); 42 | llong epoch; 43 | 44 | llong packet_timer; 45 | llong mark_time; 46 | std::vector team_times; 47 | unsigned int packets_checked; 48 | bool need_to_update; 49 | //float point_fps; 50 | //float fps; 51 | //std::vector fps_list; 52 | 53 | }; 54 | 55 | #endif // _CommTimer_h_DEFINED 56 | -------------------------------------------------------------------------------- /corpus/PyLights.h: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | #ifndef PyLights_h_DEFINED 22 | #define PyLights_h_DEFINED 23 | 24 | #include 25 | 26 | #include "Lights.h" 27 | 28 | void c_init_lights(); 29 | // C++ backend insertion (must be set before import) 30 | // steals a reference to the supplied Lights instance 31 | void set_lights_pointer (boost::shared_ptr lights_ptr); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /comm/cmake.comm/buildconfig.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | ##################################### 4 | ## Build configurations for Comm. ## 5 | ##################################### 6 | 7 | # .:: General configurations for the Northern Bites Comm cmake package ::::: 8 | 9 | IF( NOT DEFINED ROBOT_TYPE ) 10 | SET( ROBOT_TYPE NAO_RL ) 11 | ENDIF( NOT DEFINED ROBOT_TYPE ) 12 | 13 | 14 | ############################ Configure Options 15 | # Definitions for the CMake configurable build options. Defined here, they 16 | # are set at build/configure time. Corresponding C/C++ MACRO definitions 17 | # should reside in the [module]config.in files. The [module]config.h headers 18 | # will be auto-generated my cmake and dependant file recompiled after a 19 | # build change. Some re-configurat bugs may still need to be worked out. 20 | # 21 | # IF all else fails, just `make clean` and `make cross` or straight, configure 22 | # again, and you should be set. 23 | # 24 | 25 | # See documentation strings for descriptions 26 | OPTION( 27 | PYTHON_SHARED_COMM 28 | "Compile comm as a shared library for Python dynamic loading" 29 | OFF 30 | ) 31 | OPTION( 32 | USE_PYCOMM_FAKE_BACKEND 33 | "Insert a 'fake' Comm object into the Python module" 34 | OFF 35 | ) 36 | OPTION( 37 | USE_PYTHON_GC 38 | "Build with the Python GameController interface" 39 | ON 40 | ) 41 | 42 | -------------------------------------------------------------------------------- /corpus/PySensors.h: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | #ifndef PYSENSORS_H_DEFINED 22 | #define PYSENSORS_H_DEFINED 23 | 24 | #include 25 | 26 | #include "Sensors.h" 27 | 28 | void c_init_sensors(); 29 | // C++ backend insertion (must be set before import) 30 | // steals a reference to the supplied Sensors 31 | void set_sensors_pointer (boost::shared_ptr sensors_ptr); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /noggin/headTracking/BasicStates.py: -------------------------------------------------------------------------------- 1 | from man.motion import HeadMoves 2 | 3 | def stopped(tracker): 4 | '''default state where the tracker does nothing''' 5 | tracker.activeLocOn = False 6 | return tracker.stay() 7 | 8 | def stop(tracker): 9 | ''' stop all head moves ''' 10 | if tracker.firstFrame(): 11 | tracker.activeLocOn = False 12 | tracker.brain.motion.stopHeadMoves() 13 | 14 | if not tracker.brain.motion.isHeadActive(): 15 | return tracker.goNow('stopped') 16 | 17 | return tracker.stay() 18 | 19 | def neutralHead(tracker): 20 | '''move head to neutral position''' 21 | if tracker.firstFrame(): 22 | tracker.activeLocOn = False 23 | tracker.brain.motion.stopHeadMoves() 24 | tracker.helper.executeHeadMove(HeadMoves.NEUT_HEADS) 25 | 26 | if not tracker.brain.motion.isHeadActive(): 27 | return tracker.goLater('stopped') 28 | 29 | return tracker.stay() 30 | 31 | def doHeadMove(tracker): 32 | '''executes the currently set headMove''' 33 | if tracker.firstFrame(): 34 | tracker.activeLocOn = False 35 | tracker.brain.motion.stopHeadMoves() 36 | tracker.helper.executeHeadMove(tracker.headMove) 37 | 38 | if not tracker.brain.motion.isHeadActive(): 39 | return tracker.goLater('stopped') 40 | 41 | return tracker.stay() 42 | -------------------------------------------------------------------------------- /corpus/PyRoboGuardian.h: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | #ifndef PYROBOGAURDIAN_H_DEFINED 22 | #define PYROBOGAURDIAN_H_DEFINED 23 | 24 | #include 25 | 26 | #include "RoboGuardian.h" 27 | 28 | void c_init_roboguardian(); 29 | // C++ backend insertion (must be set before import) 30 | // steals a reference to the supplied RoboGuardian 31 | void set_guardian_pointer (boost::shared_ptr guardian_ptr); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /TMan.cpp: -------------------------------------------------------------------------------- 1 | #include "TMan.h" 2 | 3 | using namespace std; 4 | 5 | TMan::TMan(boost::shared_ptr _sensors, 6 | boost::shared_ptr _transcriber, 7 | boost::shared_ptr _imageTranscriber, 8 | boost::shared_ptr _enactor, 9 | boost::shared_ptr synchro, 10 | boost::shared_ptr _lights) 11 | :Man(_sensors,_transcriber,_imageTranscriber,_enactor,synchro,_lights), 12 | threadedImageTranscriber(_imageTranscriber) 13 | { 14 | 15 | } 16 | 17 | TMan::~TMan(){ 18 | 19 | } 20 | 21 | 22 | 23 | void TMan::startSubThreads(){ 24 | 25 | Man::startSubThreads(); 26 | 27 | // Start Image transcriber thread (it handles its own threading 28 | if (threadedImageTranscriber->start() != 0) { 29 | cerr << "Image transcriber failed to start" << endl; 30 | } 31 | else 32 | threadedImageTranscriber->getTrigger()->await_on(); 33 | 34 | } 35 | 36 | void TMan::stopSubThreads(){ 37 | #ifdef DEBUG_MAN_THREADING 38 | cout << " TMan stoping:" << endl; 39 | #endif 40 | 41 | threadedImageTranscriber->stop(); 42 | threadedImageTranscriber->getTrigger()->await_off(); 43 | #ifdef DEBUG_MAN_THREADING 44 | cout << " Image Transcriber thread is stopped" << endl; 45 | #endif 46 | 47 | Man::stopSubThreads(); 48 | } 49 | -------------------------------------------------------------------------------- /noggin/offline/navToObs.cpp: -------------------------------------------------------------------------------- 1 | /* navToObs.cpp */ 2 | #include "fakerIterators.h" 3 | #include "fakerIO.h" 4 | #include "NBMath.h" 5 | 6 | using namespace std; 7 | using namespace boost; 8 | using namespace NBMath; 9 | 10 | int main(int argc, char** argv) 11 | { 12 | // Information needed for the main method 13 | // Make navPath 14 | NavPath letsGo; 15 | // IO Variables 16 | fstream inputFile; 17 | fstream obsFile; 18 | 19 | /* Test for the correct number of CLI arguments */ 20 | if(argc != 2) { 21 | cerr << "usage: " << argv[0] << " input-file" << endl; 22 | return 1; 23 | } 24 | try { 25 | inputFile.open(argv[1], ios::in); 26 | 27 | } catch (const exception& e) { 28 | cout << "Failed to open input file" << argv[1] << endl; 29 | return 1; 30 | } 31 | 32 | // Get the info from the input file 33 | readNavInputFile(&inputFile, &letsGo); 34 | 35 | // Clost the input file 36 | inputFile.close(); 37 | 38 | // Open output files 39 | string obsFileName(argv[1]); 40 | obsFileName.replace(obsFileName.end()-3, obsFileName.end(), "obs"); 41 | obsFile.open(obsFileName.c_str(), ios::out); 42 | 43 | // Iterate through the path 44 | iterateNavPath(&obsFile, &letsGo); 45 | 46 | // Close the output files 47 | obsFile.close(); 48 | 49 | return 0; 50 | } 51 | -------------------------------------------------------------------------------- /corpus/NaoLights.h: -------------------------------------------------------------------------------- 1 | #ifndef NaoLights_h_DEFINED 2 | #define NaoLights_h_DEFINED 3 | 4 | #include 5 | 6 | #include "Lights.h" 7 | #include "dcmproxy.h" 8 | #include "ALLedNames.h" 9 | #include "NaoRGBLight.h" 10 | /** 11 | * This class implements LED capability on the Nao robot using the DCM in Naoqi 12 | * 13 | * The basic design is to make a NaoRGBLight for each LED group. That instance 14 | * handles the creation of the appropropriatly formatted ALValue to send to 15 | * the DCM low level. 16 | * 17 | * Led groups can be referenced either by ID or by string name, through 18 | * the latter is currently not as fast as it could be (TODO: fix that) 19 | * 20 | * @author Johannes Strom 21 | * @date June 2009 22 | */ 23 | 24 | 25 | 26 | class NaoLights : public Lights{ 27 | public: 28 | NaoLights(AL::ALPtr broker); 29 | virtual ~NaoLights(); 30 | 31 | public: 32 | void setRGB(const std::string led_id, const int newRgbHex); 33 | void setRGB(const unsigned int led_id, const int newRgbHex); 34 | 35 | void sendLights(); 36 | private: 37 | void generateLeds(); 38 | void sendLightCommand(AL::ALValue &command); 39 | private: 40 | AL::ALPtr dcmProxy; 41 | AL::ALValue leftFaceLedCommand; 42 | std::vector ledList; 43 | std::vector hexList; 44 | 45 | mutable pthread_mutex_t lights_mutex; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /motion/Gait.h: -------------------------------------------------------------------------------- 1 | #ifndef _Gait_h_DEFINED 2 | #define _Gait_h_DEFINED 3 | 4 | #include 5 | #include 6 | #include "AbstractGait.h" 7 | #include "GaitConstants.h" 8 | 9 | class Gait : public AbstractGait { 10 | public: 11 | Gait(const Gait & other); 12 | Gait(const AbstractGait & other); 13 | Gait(const float _stance_config[WP::LEN_STANCE_CONFIG], 14 | const float _step_config[WP::LEN_STEP_CONFIG], 15 | const float _zmp_config[WP::LEN_ZMP_CONFIG], 16 | const float _joint_hack_config[WP::LEN_HACK_CONFIG], 17 | const float _sensor_config[WP::LEN_SENSOR_CONFIG], 18 | const float _stiffness_config[WP::LEN_STIFF_CONFIG], 19 | const float _odo_config[WP::LEN_ODO_CONFIG], 20 | const float _arm_config[WP::LEN_ARM_CONFIG]); 21 | 22 | protected: 23 | Gait(); 24 | 25 | }; 26 | 27 | 28 | static const Gait DEFAULT_GAIT = Gait(WP::STANCE_DEFAULT, 29 | WP::STEP_DEFAULT, 30 | WP::ZMP_DEFAULT, 31 | WP::HACK_DEFAULT, 32 | WP::SENSOR_DEFAULT, 33 | WP::STIFF_DEFAULT, 34 | WP::ODO_DEFAULT, 35 | WP::ARM_DEFAULT); 36 | #endif 37 | -------------------------------------------------------------------------------- /motion/RobotGaits.py: -------------------------------------------------------------------------------- 1 | import man.motion as motion 2 | 3 | """ 4 | Gaits loaded from the gaits/ directory 5 | Each *Gait.py file should be self-sufficient (no cross-dependencies) 6 | """ 7 | 8 | from .gaits.FastGait import FAST_GAIT 9 | from .gaits.LabGait import LAB_GAIT 10 | from .gaits.DuckGait import DUCK_GAIT 11 | from .gaits.SlowGait import SLOW_GAIT 12 | from .gaits.ZaphodSlowGait import ZAPHOD_SLOW_GAIT 13 | from .gaits.WebotsGait import WEBOTS_GAIT, WEBOTS_GAIT2 14 | 15 | # disabled / unused gaits 16 | #from .gaits.ComGait import COM_GAIT 17 | #from .gaits.MedGait import MEDIUM_GAIT, MARVIN_MEDIUM_GATE 18 | 19 | 20 | ############# DEFAULT GAIT ASSIGNMENTS ################## 21 | 22 | CUR_GAIT = SLOW_GAIT 23 | CUR_DRIBBLE_GAIT = DUCK_GAIT 24 | CUR_SLOW_GAIT = SLOW_GAIT 25 | 26 | MARVIN_CUR_GAIT = SLOW_GAIT 27 | MARVIN_CUR_SLOW_GAIT = SLOW_GAIT 28 | 29 | ZAPHOD_CUR_GAIT = ZAPHOD_SLOW_GAIT 30 | ZAPHOD_CUR_SLOW_GAIT = ZAPHOD_SLOW_GAIT 31 | 32 | TRILLIAN_GAIT = CUR_GAIT 33 | ZAPHOD_GAIT = ZAPHOD_CUR_GAIT 34 | SLARTI_GAIT = CUR_GAIT 35 | MARVIN_GAIT = CUR_GAIT 36 | 37 | TRILLIAN_DRIBBLE_GAIT = CUR_DRIBBLE_GAIT 38 | ZAPHOD_DRIBBLE_GAIT = CUR_DRIBBLE_GAIT 39 | SLARTI_DRIBBLE_GAIT = CUR_DRIBBLE_GAIT 40 | MARVIN_DRIBBLE_GAIT = CUR_DRIBBLE_GAIT 41 | 42 | TRILLIAN_SLOW_GAIT = CUR_SLOW_GAIT 43 | ZAPHOD_SLOW_GAIT = ZAPHOD_CUR_SLOW_GAIT 44 | SLARTI_SLOW_GAIT = CUR_SLOW_GAIT 45 | MARVIN_SLOW_GAIT = CUR_SLOW_GAIT 46 | 47 | 48 | -------------------------------------------------------------------------------- /noggin/cmake.noggin/buildconfig.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | ####################################### 4 | ## Build configurations for Noggin. ## 5 | ####################################### 6 | 7 | ############################ Configure Options 8 | # Definitions for the CMake configurable build options. Defined here, they 9 | # are set at build/configure time. Corresponding C/C++ MACRO definitions 10 | # should reside in the [module]config.in files. The [module]config.h headers 11 | # will be auto-generated my cmake and dependant file recompiled after a 12 | # build change. Some re-configurat bugs may still need to be worked out. 13 | # 14 | # IF all else fails, just `make clean` and `make cross` or straight, configure 15 | # again, and you should be set. 16 | # 17 | 18 | # See documentation strings for descriptions 19 | SET( 20 | @PYTHON_PLAYER@ pNone 21 | CACHE STRING 22 | "Choose the player to be imported in Switch.py" 23 | ) 24 | # DO NOT add any cache settings or documentation to this variable 25 | # It is included directly in source files and such things will come 26 | # along with it 27 | SET( 28 | PYTHON_PLAYER ${@PYTHON_PLAYER@} 29 | ) 30 | OPTION( 31 | DEBUG_NOGGIN_INITIALIZATION 32 | "Print about the initialization of the Man class" 33 | ON 34 | ) 35 | OPTION( 36 | USE_NOGGIN_AUTO_HALT 37 | "Make noggin halt brain run() calls until a reload after an error" 38 | ON 39 | ) 40 | 41 | 42 | -------------------------------------------------------------------------------- /scripts/setup-autologin: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ############################################################################### 3 | # This script will setup auto-login into a remote machine. Specifically, 4 | # this is is useful for seting up auto-login for the Naos. 5 | # Instructions filtched from http://linuxproblem.org/art_9.html 6 | # 7 | # NOTE: If you run this script twice on the same robot, your hostname will 8 | # appear twice in .ssh/authorized_keys. Login will still work, but you will 9 | # bloat the file 10 | # 11 | # jstrom, June 2008 12 | # 13 | ############################################################################## 14 | 15 | REMOTE_USERNAME=root 16 | SSH=~/.ssh 17 | ID_RSA_FILE=$SSH/id_rsa 18 | RSA_PUBLIC_KEY_FILE=$SSH/id_rsa.pub 19 | 20 | if [ "$1" == "" ]; then 21 | echo "Usage: ./setup-autologin " 22 | exit 1 23 | fi 24 | 25 | echo "Configuring auto login. Only run this once per robot " 26 | 27 | 28 | if [ ! -e $RSA_PUBLIC_KEY_FILE ] || [ ! -e $ID_RSA_FILE ]; then 29 | echo "Generating a public key" 30 | ssh-keygen -t rsa -N "" -f $ID_RSA_FILE 31 | else 32 | echo "Detected an exisiting public key, so won't generate a new one" 33 | fi 34 | 35 | echo "Configuring remote robot with your public key." 36 | echo "Please enter the password for the robot when promted:" 37 | cat $RSA_PUBLIC_KEY_FILE | ssh $REMOTE_USERNAME@$1 'mkdir -p .ssh && cat >> .ssh/authorized_keys' 38 | 39 | echo "setup complete" 40 | -------------------------------------------------------------------------------- /corpus/cmake.man.corpus/corpusconfig.h.in: -------------------------------------------------------------------------------- 1 | /* This is an auto generated file. Please do not edit it.*/ 2 | 3 | 4 | #ifndef _corpusconfig_h 5 | #define _corpusconfig_h 6 | 7 | 8 | 9 | // :::::::::::::::::::::::::::::::::::::::::::::: Options variables :::.. 10 | 11 | 12 | // Compile Python sensors and _leds module 13 | // as a shared library for dynamic loading 14 | #define PYTHON_SHARED_CORPUS_${PYTHON_SHARED_CORPUS} 15 | #ifdef PYTHON_SHARED_CORPUS_ON 16 | # define PYTHON_SHARED_SENSORS 17 | # define PYTHON_SHARED_LEDS 18 | #else 19 | # undef PYTHON_SHARED_SENSORS 20 | # undef PYTHON_SHARED_LEDS 21 | #endif 22 | 23 | // Insert a 'fake' Sensors object into the Python module 24 | #define USE_PYSENSORS_FAKE_BACKEND_${USE_PYSENSORS_FAKE_BACKEND} 25 | #ifdef USE_PYSENSORS_FAKE_BACKEND_ON 26 | # define USE_PYSENSORS_FAKE_BACKEND 27 | #else 28 | # undef USE_PYSENSORS_FAKE_BACKEND 29 | #endif 30 | 31 | // Turn on/off the actual backend proxy calls to the ALLeds module 32 | #define USE_PYLEDS_CXX_BACKEND_${USE_PYLEDS_CXX_BACKEND} 33 | #ifdef USE_PYLEDS_CXX_BACKEND_ON 34 | # define USE_PYLEDS_CXX_BACKEND 35 | #else 36 | # undef USE_PYLEDS_CXX_BACKEND 37 | #endif 38 | 39 | //Turn on/off debugging information for the Thread class. 40 | #define DEBUG_THREAD_${USE_PYLEDS_CXX_BACKEND} 41 | #ifdef DEBUG_THREAD_ON 42 | # define DEBUG_THREAD 43 | #else 44 | # undef DEBUG_THREAD 45 | #endif 46 | 47 | 48 | #endif // !_corpusconfig_h 49 | 50 | -------------------------------------------------------------------------------- /motion/Gait.cpp: -------------------------------------------------------------------------------- 1 | #include "Gait.h" 2 | #include 3 | using namespace std; 4 | 5 | Gait::Gait(const Gait & other){ 6 | setGaitFromGait(other); 7 | //cout << "from Gait: "<. 20 | 21 | #ifndef _ChainQueue_h_DEFINED 22 | #define _ChainQueue_h_DEFINED 23 | 24 | #include "Sensors.h" 25 | #include "Kinematics.h" 26 | 27 | #include 28 | #include 29 | 30 | class ChainQueue : public std::queue > { 31 | public: 32 | ChainQueue(Kinematics::ChainID newChainID); 33 | void add(std::vector > nextJoints); 34 | Kinematics::ChainID getChainID() {return chainID;}; 35 | void clear(); 36 | 37 | private: 38 | Kinematics::ChainID chainID; 39 | 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /manmodule.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @author NorthernBites 3 | * 4 | * Version : $ 5 | * 6 | * This file was generated by Aldebaran Robotics ModuleGenerator 7 | */ 8 | 9 | #ifndef MANMODULE_H 10 | #define MANMODULE_H 11 | 12 | // ..::: Headers :: 13 | // Add it here to be sure every file includes it 14 | #include "alxplatform.h" 15 | #include "manconfig.h" 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | // ..::: Version Information :: 23 | /** Major release version */ 24 | #define MANMODULE_VERSION_MAJOR "0" 25 | 26 | /** Minor release version */ 27 | #define MANMODULE_VERSION_MINOR "1" 28 | 29 | /** Revision release version */ 30 | #define MANMODULE_VERSION_REVISION MANMODULE_REVISION 31 | 32 | /** Full string version: (ex. 0.1-r2) */ 33 | #define MANMODULE_VERSION MANMODULE_VERSION_MAJOR"."MANMODULE_VERSION_MINOR"-r"MANMODULE_VERSION_REVISION 34 | 35 | /** Internal version name */ 36 | #define MANMODULE_VERSION_CODENAME "internal" 37 | 38 | /** Release date */ 39 | //#define MANMODULE_VERSION_DATE "20071113" 40 | 41 | #define ALVALUE_STRING( val ) ((val.getType() == ALValue::TypeString) ? std::string(val) : std::string("") ) 42 | #define ALVALUE_DOUBLE( val ) ((val.getType() == ALValue::TypeDouble || val.getType() == ALValue::TypeInt) ? double(val) : 0.0 ) 43 | #define ALVALUE_INT( val ) ((val.getType() == ALValue::TypeInt || val.getType() == ALValue::TypeDouble) ? int(val) : 0) 44 | 45 | #endif // MANMODULE_H 46 | -------------------------------------------------------------------------------- /corpus/NaoEnactor.h: -------------------------------------------------------------------------------- 1 | #ifndef _NaoEnactor_h_DEFINED 2 | #define _NaoEnactor_h_DEFINED 3 | 4 | #include "dcmproxy.h" 5 | #include "almemoryproxy.h" 6 | #include "almemoryfastaccess.h" 7 | #include "MotionEnactor.h" 8 | #include "albroker.h" 9 | #include "alptr.h" 10 | #include "almemoryfastaccess.h" 11 | #include "Sensors.h" 12 | #include "NaoDef.h" 13 | #include 14 | #include "Transcriber.h" 15 | #include "Common.h" 16 | 17 | class NaoEnactor : public MotionEnactor { 18 | 19 | public: 20 | NaoEnactor(boost::shared_ptr s, 21 | boost::shared_ptr transcriber, 22 | AL::ALPtr broker); 23 | virtual ~NaoEnactor() { }; 24 | void sendCommands(); 25 | void postSensors(); 26 | 27 | private: // Members 28 | AL::ALPtr broker; 29 | AL::ALPtr alfastaccessJoints; 30 | AL::ALPtr alfastaccessSensors; 31 | AL::ALPtr dcmProxy; 32 | boost::shared_ptr sensors; 33 | boost::shared_ptr transcriber; 34 | std::vector motionValues; 35 | std::vector motionHardness; 36 | std::vector lastMotionHardness; 37 | AL::ALValue hardness_command; 38 | AL::ALValue joint_command; 39 | AL::ALValue us_command; 40 | 41 | 42 | 43 | private: // Helper methods 44 | void sendHardness(); 45 | void sendJoints(); 46 | void sendUltraSound(); 47 | 48 | void initDCMAliases(); 49 | void initDCMCommands(); 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /noggin/players/pData.py: -------------------------------------------------------------------------------- 1 | import os 2 | from . import SoccerFSA 3 | from . import DataStates 4 | 5 | class SoccerPlayer(SoccerFSA.SoccerFSA): 6 | def __init__(self, brain): 7 | SoccerFSA.SoccerFSA.__init__(self,brain) 8 | self.addStates(DataStates) 9 | self.setName('pData') 10 | self.postDistance = 50 11 | self.lastDistance = 0 12 | 13 | # Specify which object is being studied 14 | self.objects = (self.brain.ygrp, self.brain.yglp) 15 | 16 | def savePostInfo(self): 17 | both_zero = True 18 | for obj in self.objects: 19 | if obj.dist != 0.0: 20 | both_zero = False 21 | break 22 | 23 | if both_zero: 24 | return 25 | 26 | filename = "/home/root/postDistData" + str(self.postDistance) + ".csv" 27 | 28 | # need to remove it if it exists already and make way 29 | # for new data 30 | if self.lastDistance != self.postDistance and \ 31 | os.path.exists(filename): 32 | self.lastDistance = self.postDistance 33 | os.remove(filename) 34 | csv = open(filename,'a+') 35 | csv.write("dist,bearing\n") 36 | else : 37 | csv = open(filename,'a+') 38 | 39 | for obj in self.objects: 40 | if obj.dist !=0.0 and abs(obj.dist - self.postDistance) < 100: 41 | csv.write(str(obj.dist) + "," + str(obj.bearing) + '\n') 42 | print obj.dist, obj.bearing 43 | csv.close() 44 | -------------------------------------------------------------------------------- /corpus/cmake.man.corpus/buildconfig.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | ####################################### 4 | ## Build configurations for Corpus. ## 5 | ####################################### 6 | 7 | # .:: General configurations for the Northern Bites Corpus cmake package ::::: 8 | 9 | IF( NOT DEFINED ROBOT_TYPE ) 10 | SET( ROBOT_TYPE NAO_RL ) 11 | ENDIF( NOT DEFINED ROBOT_TYPE ) 12 | 13 | 14 | ############################ Configure Options 15 | # Definitions for the CMake configurable build options. Defined here, they 16 | # are set at build/configure time. Corresponding C/C++ MACRO definitions 17 | # should reside in the [module]config.in files. The [module]config.h headers 18 | # will be auto-generated my cmake and dependant file recompiled after a 19 | # build change. Some re-configurat bugs may still need to be worked out. 20 | # 21 | # IF all else fails, just `make clean` and `make cross` or straight, configure 22 | # again, and you should be set. 23 | # 24 | 25 | # See documentation strings for descriptions 26 | OPTION( 27 | PYTHON_SHARED_CORPUS 28 | "Compile Python sensors and _leds module as a shared library for dynamic loading" 29 | OFF 30 | ) 31 | OPTION( 32 | USE_PYSENSORS_FAKE_BACKEND 33 | "Insert a 'fake' Sensors object into the Python module" 34 | OFF 35 | ) 36 | OPTION( 37 | USE_PYLEDS_CXX_BACKEND 38 | "Turn on/off the actual backend proxy calls to the ALLeds module" 39 | ON 40 | ) 41 | 42 | OPTION( 43 | DEBUG_THREAD 44 | "Turn on/off debugging information for the Thread class." 45 | ON 46 | ) -------------------------------------------------------------------------------- /motion/LinearChoppedCommand.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef __LinearChoppedCommand_h 4 | #define __LinearChoppedCommand_h 5 | 6 | #include 7 | #include "Kinematics.h" 8 | #include "JointCommand.h" 9 | #include "ChoppedCommand.h" 10 | 11 | 12 | // At the moment, this only works for Linear Interpolation. 13 | // Will later extended to apply to Smooth Interpolation 14 | class LinearChoppedCommand : public ChoppedCommand 15 | { 16 | public: 17 | LinearChoppedCommand( const JointCommand *command, 18 | std::vector currentJoints, 19 | int chops ); 20 | 21 | virtual ~LinearChoppedCommand(void) { }; 22 | 23 | virtual std::vector getNextJoints(int id); 24 | 25 | private: 26 | // Current Joint Chains 27 | std::vector currentHead; 28 | std::vector currentLArm; 29 | std::vector currentLLeg; 30 | std::vector currentRLeg; 31 | std::vector currentRArm; 32 | // Diff chains 33 | std::vector diffHead; 34 | std::vector diffLArm; 35 | std::vector diffLLeg; 36 | std::vector diffRLeg; 37 | std::vector diffRArm; 38 | 39 | void incrCurrChain(int id); 40 | 41 | std::vector getDiffPerChop( std::vector current, 42 | std::vector final, 43 | int numChops ); 44 | 45 | // Helper methods 46 | std::vector* getCurrentChain(int id); 47 | std::vector* getDiffChain(int id); 48 | void buildCurrentChains( std::vector currentJoints ); 49 | void buildDiffChains( std::vector diffPerChop ); 50 | 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /motion/cmake.man.motion/buildconfig.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | ####################################### 4 | ## Build configurations for Motoin. ## 5 | ####################################### 6 | 7 | # .:: General configurations for the Northern Bites Motion cmake package ::::: 8 | 9 | IF( NOT DEFINED ROBOT_TYPE ) 10 | SET( ROBOT_TYPE NAO_RL ) 11 | ENDIF( NOT DEFINED ROBOT_TYPE ) 12 | 13 | 14 | ############################ Configure Options 15 | # Definitions for the CMake configurable build options. Defined here, they 16 | # are set at build/configure time. Corresponding C/C++ MACRO definitions 17 | # should reside in the [module]config.in files. The [module]config.h headers 18 | # will be auto-generated my cmake and dependant file recompiled after a 19 | # build change. Some re-configurat bugs may still need to be worked out. 20 | # 21 | # IF all else fails, just `make clean` and `make cross` or straight, configure 22 | # again, and you should be set. 23 | # 24 | 25 | # See documentation strings for descriptions 26 | OPTION( 27 | PYTHON_SHARED_MOTION 28 | "Compile man/motion as a shared library for Python dynamic loading" 29 | OFF 30 | ) 31 | OPTION( 32 | USE_PYMOTION_CXX_BACKEND 33 | "Turn on/off the actual backend C++ calls to MotionInterface in the Python _motion module" 34 | ON 35 | ) 36 | 37 | 38 | OPTION( 39 | DEBUG_MOTION 40 | "Turn on/off a variety of motion-specific debugging. (Like logging trajectories to files)" 41 | OFF 42 | ) 43 | 44 | OPTION( 45 | USE_MOTION_ACTUATORS 46 | "Turn on/off commands being sent from motion to the actuators" 47 | ON 48 | ) 49 | -------------------------------------------------------------------------------- /corpus/messaging.h: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | #include 22 | #include "synchro.h" 23 | 24 | 25 | template 26 | class MessagePost : public Lock 27 | { 28 | public: 29 | T data; 30 | 31 | public: 32 | MessagePost() : data() { } 33 | MessagePost(T ©) : data(copy) { } 34 | 35 | public: 36 | void post(T ©); 37 | T retrieve(); 38 | }; 39 | 40 | template 41 | class MessageQueue : public Lock 42 | { 43 | public: 44 | std::list data; 45 | 46 | public: 47 | MessageQueue() : data() { }; 48 | 49 | public: 50 | void append(T ©); 51 | T* retrieve(); 52 | std::list retrieveAll(); 53 | }; 54 | 55 | 56 | -------------------------------------------------------------------------------- /vision/cmake.vision/buildconfig.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | ####################################### 4 | ## Build configurations for Vision. ## 5 | ####################################### 6 | 7 | 8 | ############################ Configure Options 9 | # Definitions for the CMake configurable build options. Defined here, they 10 | # are set at build/configure time. Corresponding C/C++ MACRO definitions 11 | # should reside in the [module]config.in files. The [module]config.h headers 12 | # will be auto-generated my cmake and dependant file recompiled after a 13 | # build change. Some re-configurat bugs may still need to be worked out. 14 | # 15 | # IF all else fails, just `make clean` and `make cross` or straight, configure 16 | # again, and you should be set. 17 | # 18 | 19 | # See documentation strings for descriptions 20 | OPTION( 21 | PYTHON_SHARED_VISION 22 | "Compile VISION as a shared library for Python dynamic loading" 23 | OFF 24 | ) 25 | OPTION( 26 | USE_PYVISION_FAKE_BACKEND 27 | "Insert a 'fake' Vision object into the Python module" 28 | OFF 29 | ) 30 | OPTION( 31 | USE_TIME_PROFILING 32 | "Turn on/off profiling function calls" 33 | OFF 34 | ) 35 | OPTION( 36 | USE_PROFILER_AUTO_PRINT 37 | "Turn on/off automatic profiling summary printing" 38 | ON 39 | ) 40 | 41 | # Options pertaining to running the vision code OFFLINE 42 | OPTION( OFFLINE 43 | "Debug flag for vision when we are running offline" 44 | OFF 45 | ) 46 | 47 | # Use the smaller calibration tables 48 | OPTION( SMALL_TABLES 49 | "Turn on/off the use of small color tables." 50 | OFF 51 | ) 52 | 53 | -------------------------------------------------------------------------------- /frames/sync: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Script to sync frames between robocup and your local frames folder 4 | 5 | 6 | USAGE="./sync [up-down] \nExample: $> ./sync down watson" 7 | 8 | UP_OR_DOWN=$1 9 | REMOTE_FOLDER=${2%/} #Strip the trailing slash if any 10 | 11 | RSYNC=rsync 12 | RSYNC_OPTS=-rvz 13 | 14 | if [ "$1" = "" ]; then 15 | echo "No push direction specified" 16 | echo $USAGE 17 | exit 1 18 | fi 19 | 20 | # if [ "$REMOTE_FOLDER" = "" ]; then 21 | # echo "No remote folder specified" 22 | # echo $USAGE 23 | # exit 1 24 | # fi 25 | 26 | echo "Type username for RoboCup server, followed by [ENTER]" 27 | read username 28 | 29 | SERVER=$username@robocup.bowdoin.edu: 30 | ROBOCUP_DIR=/mnt/research/robocup 31 | FRAMES_DIR=frames 32 | 33 | SYNC_UP="$RSYNC $RSYNC_OPTS $REMOTE_FOLDER $SERVER/$ROBOCUP_DIR/$FRAMES_DIR" 34 | SYNC_DOWN="$RSYNC $RSYNC_OPTS $SERVER/$ROBOCUP_DIR/$FRAMES_DIR/$REMOTE_FOLDER/* ./$FRAMES_DIR/$REMOTE_FOLDER" 35 | DIFF="$RSYNC $RSYNC_OPTS -n ./* $SERVER/$ROBOCUP_DIR/$TABLES_DIR/" 36 | 37 | if [ "$UP_OR_DOWN" = "up" ]; then 38 | 39 | echo "Syncing FROM `pwd`/$REMOTE_FOLDER TO $SERVER/$ROBOCUP_DIR/$FRAMES_DIR/$REMOTE_FOLDER" 40 | echo $SYNC_UP 41 | $SYNC_UP 42 | 43 | elif [ "$UP_OR_DOWN" = "down" ]; then 44 | 45 | echo "Syncing FROM $SERVER/$ROBOCUP_DIR/$FRAMES_DIR/$REMOTE_FOLDER TO `pwd`/$REMOTE_FOLDER " 46 | echo $SYNC_DOWN 47 | cd ../ 48 | $SYNC_DOWN 49 | 50 | elif [ "$UP_OR_DOWN"="diff" ]; then 51 | echo "Getting diff" 52 | echo $DIFF 53 | $DIFF 54 | else 55 | echo "Invalid parameters" 56 | echo $USAGE 57 | exit 1 58 | fi -------------------------------------------------------------------------------- /motion/mathematica/README: -------------------------------------------------------------------------------- 1 | This directory contains the files which are necessary for generating 2 | the forward and inverse kinematics code using in man. 3 | 4 | 5 | newKinematics.nb contains the code to read in mDH parameters and generate 6 | expressions for x,y,z (forward kinematics), as well as the 7 | code for the search jacobians. 8 | Read this file carefully. The different heel/ankle 9 | versions must be generated carefully by generating `transform` 10 | correctly. 11 | 12 | leftLegIKResults.nb 13 | rightLegIKResults.nb these files contain the complete calculations for the 14 | expressions. If an error is found, these should be updated 15 | and they can also be used to compare later revisions 16 | 17 | completeKinematics.nb this is the old kinematics file. It is less general, but 18 | included for reference. 19 | 20 | convert-to-cxx.el this file contains an emacs macro to convert a 21 | mathematica expression copied using C-Shift-C to 22 | something resembling the CXX code we need for kinematics. 23 | It should be used only on a file with just mathematica code 24 | in it (i.e. all spaces will get replaced with *, etc) 25 | It will require some small after cleanup: 26 | -removing stray * 27 | -removing stray ! 28 | -adding ; to the end of every line 29 | - splitting the jacobian expressions with new lines for each tab 30 | 31 | COMKinematics.nb this file currently relies on other files in this directory 32 | also, the outputs don't work correctly. See COM.cpp in 33 | corpus/ktest/COM.cpp for more comments -------------------------------------------------------------------------------- /noggin/Makefile: -------------------------------------------------------------------------------- 1 | 2 | .PHONY: all config clean install noconfig 3 | .PHONY: visionall visionconfig visionclean visioninstall 4 | 5 | CUR_DIR = $(shell pwd) 6 | BUILD_DIR = build 7 | CMAKE_DIR = cmake.noggin 8 | CMAKE_CACHE = $(BUILD_DIR)/CMakeCache.txt 9 | CMAKE_SRCS = \ 10 | CMakeLists.txt \ 11 | buildconfig.cmake \ 12 | nogginconfig.h 13 | CMAKE_SRC := $(addprefix $(CMAKE_DIR),$(CMAKE_SRC)) 14 | CONFIG_FILE = nogginconfig.h 15 | SWITCH_FILE = players/Switch.py 16 | TEAMCONFIG_FILE = TeamConfig.py 17 | VISION_DIR = $(abspath $(CUR_DIR)/../vision) 18 | 19 | TRUNK_REVISION = r0 #$(shell svn info | grep Revision | awk 'FS=" " {print $$2}') 20 | export TRUNK_REVISION 21 | 22 | CD=cd 23 | CMAKE=cmake 24 | CCMAKE=ccmake 25 | MKDIR=mkdir 26 | 27 | .SILENT: 28 | 29 | all: $(CMAKE_CACHE) visionall 30 | @$(MAKE) -C $(BUILD_DIR) 31 | 32 | visionall: 33 | @$(MAKE) -C $(VISION_DIR) all 34 | 35 | config: $(CMAKE_CACHE) visionconfig 36 | @set -e; \ 37 | $(CD) $(BUILD_DIR); \ 38 | $(CCMAKE) .; \ 39 | 40 | visionconfig: $(VISION_DIR)/$(CMAKE_CACHE) 41 | @$(MAKE) -C $(VISION_DIR) config 42 | 43 | install: $(CMAKE_CACHE) visioninstall 44 | @$(MAKE) -C $(BUILD_DIR) install 45 | 46 | visioninstall: 47 | @$(MAKE) -C $(VISION_DIR) install 48 | 49 | clean: visionclean 50 | $(RM) -r $(BUILD_DIR) $(CONFIG_FILE) $(SWITCH_FILE) $(TEAMCONFIG_FILE) 51 | 52 | visionclean: 53 | @$(MAKE) -C $(VISION_DIR) clean 54 | 55 | $(CMAKE_CACHE): 56 | @set -e; \ 57 | $(MKDIR) -p $(BUILD_DIR); \ 58 | $(CD) $(BUILD_DIR); \ 59 | $(CMAKE) $(CUR_DIR)/$(CMAKE_DIR) 60 | 61 | $(VISION_DIR)/$(CMAKE_CACHE): 62 | @$(MAKE) -C $(VISION_DIR) $(CMAKE_CACHE) 63 | -------------------------------------------------------------------------------- /motion/ChoppedCommand.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef __ChoppedCommand_h 4 | #define __ChoppedCommand_h 5 | 6 | #include 7 | #include "JointCommand.h" 8 | #include "Kinematics.h" 9 | 10 | // At the moment, this only works for Linear Interpolation. 11 | // Will later extended to apply to Smooth Interpolation 12 | class ChoppedCommand 13 | { 14 | public: 15 | 16 | // HACK: Empty constructor. Will initialize a finished 17 | // body joint command with no values. Don't use! 18 | // ***SHOULD NOT BE USED*** 19 | ChoppedCommand() : finished(true) { } 20 | 21 | virtual ~ChoppedCommand(void) { } 22 | 23 | ChoppedCommand ( const JointCommand *command, int chops ); 24 | 25 | virtual std::vector getNextJoints(int id) { 26 | return std::vector(0); 27 | } 28 | 29 | const std::vector getStiffness( Kinematics::ChainID chaindID) const; 30 | bool isDone() { return finished; } 31 | 32 | protected: 33 | void checkDone(); 34 | 35 | std::vector getFinalJoints(const JointCommand *command, 36 | std::vector currentJoints); 37 | 38 | private: 39 | void constructStiffness( const JointCommand *command); 40 | void constructChainStiffness(Kinematics::ChainID id, 41 | const JointCommand *command); 42 | std::vector* getStiffnessRef( Kinematics::ChainID chainID); 43 | 44 | 45 | protected: 46 | int numChops; 47 | std::vector numChopped; 48 | int motionType; 49 | int interpolationType; 50 | bool finished; 51 | 52 | private: 53 | std::vector head_stiff, larm_stiff, rarm_stiff; 54 | std::vector lleg_stiff, rleg_stiff; 55 | 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /vision/Field.h: -------------------------------------------------------------------------------- 1 | #ifndef Field_h_DEFINED 2 | #define Field_h_DEFINED 3 | 4 | #include 5 | 6 | class Field; // forward reference 7 | 8 | #include "Threshold.h" 9 | #ifndef NO_ZLIB 10 | #include "Zlib.h" 11 | #endif 12 | #include "Profiler.h" 13 | #include "NaoPose.h" 14 | class Field 15 | { 16 | friend class Vision; 17 | public: 18 | Field(Vision* vis, Threshold* thr); 19 | virtual ~Field() {} 20 | 21 | // main methods 22 | int findGreenHorizon(int pH, float sl); 23 | void findFieldEdges(int poseHorizon); 24 | void findConvexHull(int pH); 25 | int horizonAt(int x); 26 | int ccw(point p1, point p2, point p3); 27 | 28 | // scan operations 29 | int yProject(int startx, int starty, int newy); 30 | int yProject(point point, int newy); 31 | int xProject(int startx, int starty, int newx); 32 | int xProject(point point, int newx); 33 | 34 | // shooting 35 | void setShot(VisualCrossbar * one, int color); 36 | void bestShot(VisualFieldObject * left, VisualFieldObject * right, 37 | VisualCrossbar * mid, int color); 38 | void openDirection(int h, NaoPose *p); 39 | void drawLess(int x, int y, int c); 40 | void drawMore(int x, int y, int c); 41 | 42 | private: 43 | 44 | // class pointers 45 | Vision* vision; 46 | Threshold* thresh; 47 | 48 | // the field horizon 49 | int horizon; 50 | bool debugHorizon; 51 | bool debugFieldEdge; 52 | bool debugShot; 53 | bool openField; 54 | 55 | float slope; 56 | 57 | bool shoot[IMAGE_WIDTH]; 58 | int topEdge[IMAGE_WIDTH+1]; 59 | }; 60 | 61 | #endif // Field_h_DEFINED 62 | -------------------------------------------------------------------------------- /motion/WalkController.h: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | /** 22 | * TODO: Put in some docs =) 23 | */ 24 | 25 | #ifndef _WalkController_h_DEFINED 26 | #define _WalkController_h_DEFINED 27 | 28 | #include 29 | 30 | #include "Sensors.h" 31 | 32 | class WalkController { 33 | public: 34 | //WalkController(Sensors *s) : sensors(s) { } 35 | virtual ~WalkController(){}; 36 | virtual const float tick(const std::list *zmp_ref, 37 | const float cur_zmp_ref, 38 | const float sensor_zmp) = 0; 39 | virtual const float getPosition() const = 0; 40 | virtual const float getZMP() const = 0; 41 | virtual void initState(float x, float v, float p) = 0; 42 | 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /noggin/players/pMakeKick.py: -------------------------------------------------------------------------------- 1 | 2 | from ..util import FSA 3 | from . import MakeKickStates 4 | from man import motion 5 | 6 | class SoccerPlayer(FSA.FSA): 7 | def __init__(self, brain): 8 | FSA.FSA.__init__(self,brain) 9 | self.brain = brain 10 | self.addStates(MakeKickStates) 11 | self.setName('pBrunswick') 12 | self.currentState = 'standup' 13 | 14 | def executeMove(self,sweetMove): 15 | """ 16 | Method to enqueue a SweetMove 17 | Can either take in a head move or a body command 18 | (see SweetMove files for descriptions of command tuples) 19 | """ 20 | for position in sweetMove: 21 | if len(position) == 6: 22 | move = motion.BodyJointCommand(position[4], #time 23 | position[0], #larm 24 | position[1], #lleg 25 | position[2], #rleg 26 | position[3], #rarm 27 | position[5], #interpolation type 28 | ) 29 | self.brain.motion.enqueue(move) 30 | 31 | elif len(position) == 3: 32 | move = motion.HeadJointCommand(position[1],#time 33 | position[0],#head pos 34 | position[2],#interpolation type 35 | ) 36 | self.brain.motion.enqueue(move) 37 | 38 | else: 39 | self.printf("What kind of sweet ass-Move is this?") 40 | -------------------------------------------------------------------------------- /TTMan.cpp: -------------------------------------------------------------------------------- 1 | #include "TTMan.h" 2 | 3 | using boost::shared_ptr; 4 | using namespace std; 5 | 6 | 7 | TTMan::TTMan(shared_ptr _sensors, 8 | shared_ptr _transcriber, 9 | shared_ptr _imageTranscriber, 10 | shared_ptr _enactor, 11 | shared_ptr synchro, 12 | shared_ptr _lights) 13 | :Man(_sensors,_transcriber,_imageTranscriber,_enactor,synchro,_lights), 14 | threadedImageTranscriber(_imageTranscriber), 15 | threadedEnactor(_enactor){} 16 | 17 | TTMan::~TTMan(){} 18 | 19 | 20 | void TTMan::startSubThreads(){ 21 | if(threadedEnactor->start()!=0) 22 | cout << "Failed to start enactor" <getTrigger()->await_on(); 25 | 26 | Man::startSubThreads(); 27 | 28 | // Start Image transcriber thread (it handles its own threading 29 | if (threadedImageTranscriber->start() != 0) { 30 | cerr << "Image transcriber failed to start" << endl; 31 | } 32 | else 33 | threadedImageTranscriber->getTrigger()->await_on(); 34 | } 35 | void TTMan::stopSubThreads(){ 36 | #ifdef DEBUG_MAN_THREADING 37 | cout << " TTMan stoping:" << endl; 38 | #endif 39 | 40 | threadedImageTranscriber->stop(); 41 | threadedImageTranscriber->getTrigger()->await_off(); 42 | #ifdef DEBUG_MAN_THREADING 43 | cout << " Image Transcriber thread is stopped" << endl; 44 | #endif 45 | 46 | Man::stopSubThreads(); 47 | 48 | threadedEnactor->stop(); 49 | threadedEnactor->getTrigger()->await_off(); 50 | #ifdef DEBUG_MAN_THREADING 51 | cout << " Enactor thread is stopped" << endl; 52 | #endif 53 | } 54 | 55 | -------------------------------------------------------------------------------- /motion/SmoothChoppedCommand.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef __SmoothChoppedCommand_h 4 | #define __SmoothChoppedCommand_h 5 | 6 | #include 7 | #include "Kinematics.h" 8 | #include "JointCommand.h" 9 | #include "ChoppedCommand.h" 10 | 11 | 12 | // At the moment, this only works for Smooth Interpolation. 13 | // Will later extended to apply to Smooth Interpolation 14 | class SmoothChoppedCommand : public ChoppedCommand 15 | { 16 | public: 17 | SmoothChoppedCommand( const JointCommand *command, 18 | std::vector startJoints, 19 | int chops ); 20 | 21 | virtual ~SmoothChoppedCommand(void) { }; 22 | 23 | virtual std::vector getNextJoints(int id); 24 | 25 | private: 26 | std::vector startHead; 27 | std::vector startLArm; 28 | std::vector startLLeg; 29 | std::vector startRLeg; 30 | std::vector startRArm; 31 | 32 | std::vector totalDiffHead; 33 | std::vector totalDiffLArm; 34 | std::vector totalDiffLLeg; 35 | std::vector totalDiffRLeg; 36 | std::vector totalDiffRArm; 37 | 38 | // Helper methods 39 | std::vector* getStartChain(int id); 40 | std::vector* getDiffChain(int id); 41 | void buildStartChains( const std::vector &startJoints ); 42 | void buildDiffChains( const std::vector &finalJoints ); 43 | 44 | void setDiffChainsToFinalJoints(const std::vector &finalJoints ); 45 | void subtractBodyStartFromFinalAngles(); 46 | void subtractChainStartFromFinalAngles(int chain); 47 | 48 | bool isChainFinished(int id); 49 | std::vector getNextChainFromCycloid(int id); 50 | float getCycloidStep(int id); 51 | float getCycloidAngle(float d_theta, float t); 52 | 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /noggin/players/SnapshotStates.py: -------------------------------------------------------------------------------- 1 | import man.motion.SweetMoves as SweetMoves 2 | import man.motion.HeadMoves as HeadMoves 3 | 4 | ####Change these for picture taking#### 5 | FRAME_SAVE_RATE = 1 6 | NUM_FRAMES_TO_SAVE = 150 7 | 8 | def gameReady(player): 9 | player.brain.resetLocalization() 10 | return player.goNow('saveFrames') 11 | 12 | def gameSet(player): 13 | player.brain.resetLocalization() 14 | return player.goNow('saveFrames') 15 | 16 | def gamePlaying(player): 17 | player.brain.resetLocalization() 18 | return player.goNow('saveFrames') 19 | 20 | def saveFrames(player): 21 | if player.firstFrame(): 22 | player.brain.tracker.startScan(HeadMoves.FORWARD_COMB_PAN) 23 | ##replace with any PHOTO PAN in 24 | ## man/motion/HeadMoves.py 25 | player.standup() 26 | player.savedFrames = 0 27 | if player.brain.ball.on or player.brain.yglp.on or player.brain.ygrp.on or \ 28 | player.brain.ygCrossbar.on or player.brain.bglp.on or \ 29 | player.brain.bgrp.on or player.brain.bgCrossbar.on: 30 | player.brain.sensors.saveFrame() 31 | player.savedFrames += 1 32 | if player.savedFrames == NUM_FRAMES_TO_SAVE: 33 | return player.goNow('doneState') 34 | 35 | return player.stay() 36 | 37 | def doneState(player): 38 | if player.firstFrame(): 39 | player.executeMove(SweetMoves.SIT_POS) 40 | player.brain.tracker.stopHeadMoves() 41 | player.brain.sensors.resetSaveFrame() 42 | 43 | # if player.stateTime > 8.0: 44 | # shutoff = motion.StiffnessCommand(0.0) 45 | # player.brain.motion.sendStiffness(shutoff) 46 | 47 | return player.stay() 48 | 49 | #gameInitial = gameReady 50 | -------------------------------------------------------------------------------- /motion/debug/sensor_log.R: -------------------------------------------------------------------------------- 1 | # R file to read in a debug walking output and generate pdf reports 2 | # Instructions: Install the R language (package 'r-base' in debian) 3 | # run 'make' in the terminal 4 | # Author: Johannes Strom 5 | # Date: Decemeber 2008 6 | 7 | 8 | 9 | foot_locus = function(foot){ 10 | 11 | name = paste(foot,"_sensor_log",sep="") 12 | PDF = ".pdf" 13 | 14 | file = paste("/tmp/",name,".xls",sep="") 15 | if(!file.exists(file)) 16 | quit("no") 17 | dat = read.table(file,header=T,na.strings=c("-")) 18 | 19 | 20 | velY = diff(dat$angleY,lag=1,differences=1) 21 | 22 | dat$range = dat$angleX 23 | dat$range[1] = .6 24 | dat$range[2] = -.6 25 | 26 | pdf(paste(name,PDF,sep="")) 27 | plot(dat$time,dat$range,pch="",main=paste(foot,"leg","x"),xlab="s",ylab="rads") 28 | names = c("bodyAngleX","angleX","sensorAngleX", 29 | "bodyAngleY","angleY","sensorAngleY") 30 | cols = c(2,3,4, 31 | 5,6,1) 32 | i =1 33 | points(dat$time,dat$bodyAngleX,type="l",col=cols[i]); i = i +1; 34 | points(dat$time,dat$angleX,type="l",col=cols[i]); i = i +1; 35 | points(dat$time,dat$sensorAngleX,type="l",col=cols[i]); i = i +1; 36 | 37 | points(dat$time,dat$bodyAngleY,type="l",col=cols[i]); i = i +1; 38 | points(dat$time,dat$angleY,type="l",col=cols[i]); i = i +1; 39 | points(dat$time,dat$sensorAngleY,type="l",col=cols[i]); i = i +1; 40 | 41 | legend("top",lwd=2,legend=names,col=cols) 42 | 43 | zeros = rep(-1.0,length(dat$time)) 44 | points(dat$time,zeros,pch=1,col=dat$state+2) 45 | names = c("Supporting","Swinging","Dbl Sup", "P. Dbl Sup") 46 | legend("topleft",lwd=2,legend=names,col=c(2:5)) 47 | dev.off() 48 | 49 | pdf(paste(name,"-vel",PDF,sep="")) 50 | plot(velY,type="l") 51 | dev.off() 52 | 53 | } 54 | 55 | 56 | foot_locus("left") 57 | foot_locus("right") -------------------------------------------------------------------------------- /vision/Cross.h: -------------------------------------------------------------------------------- 1 | // This file is part of Man, a robotic perception, locomotion, and 2 | // team strategy application created by the Northern Bites RoboCup 3 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 4 | // Nao robot. 5 | // 6 | // Man is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Lesser Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // Man is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Lesser Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // and the GNU Lesser Public License along with Man. If not, see 18 | // . 19 | 20 | 21 | #ifndef Cross_h_DEFINED 22 | #define Cross_h_DEFINED 23 | 24 | #include 25 | 26 | class Cross; // forward reference 27 | #include "Threshold.h" 28 | #include "VisionStructs.h" 29 | #include "VisualLine.h" 30 | #include "Blob.h" 31 | #include "Blobs.h" 32 | 33 | static const int NOISE = 4; 34 | 35 | class Cross { 36 | public: 37 | Cross(Vision* vis, Threshold* thr, Field* fie); 38 | virtual ~Cross() {} 39 | 40 | void init(); 41 | void createObject(); 42 | void checkForX(Blob b); 43 | void newRun(int x, int y, int h); 44 | void allocateColorRuns(); 45 | bool rightBlobColor(Blob b, float perc); 46 | 47 | private: 48 | // class pointers 49 | Vision* vision; 50 | Threshold* thresh; 51 | Field* field; 52 | 53 | Blobs* blobs; 54 | int numberOfRuns, runsize; 55 | run* runs; 56 | }; 57 | #endif 58 | -------------------------------------------------------------------------------- /motion/debug/accel/accel.R: -------------------------------------------------------------------------------- 1 | # R file to read in a debug walking output and generate pdf reports 2 | # Instructions: Install the R language (package 'r-base' in debian) 3 | # run 'make' in the terminal 4 | # Author: Johannes Strom 5 | # Date: March 2009 6 | 7 | 8 | name = "accel_log" 9 | PDF = ".pdf" 10 | 11 | file = paste("/tmp/",name,".xls",sep="") 12 | if(!file.exists(file)) 13 | quit("no") 14 | dat = read.table(file,header=T,na.strings=c("-")) 15 | 16 | pdf(paste(name,"-x",PDF,sep=""),width=50,height=30) 17 | plot(dat$time,dat$accX,pch="",main="",xlab="s",ylab="mm") 18 | names = c("acc_x","filteredX","uncertX") 19 | cols = c("2","3", "4") 20 | 21 | points(dat$time,dat$accX,type="l",col=cols[1]) 22 | points(dat$time,dat$filteredAccX,type="l",col=cols[2]) 23 | points(dat$time,dat$filteredAccXUnc,type="l",col=cols[3]) 24 | 25 | 26 | legend("top",lwd=2,legend=names,col=cols) 27 | dev.off() 28 | 29 | pdf(paste(name,"-y",PDF,sep=""),width=50,height=30) 30 | plot(dat$time,dat$accY,pch="",main="",xlab="s",ylab="mm") 31 | names = c("acc_y","filteredY","uncertY") 32 | cols = c("2","3", "4") 33 | 34 | points(dat$time,dat$accY,type="l",col=cols[1]) 35 | points(dat$time,dat$filteredAccY,type="l",col=cols[2]) 36 | points(dat$time,dat$filteredAccYUnc,type="l",col=cols[3]) 37 | 38 | 39 | legend("top",lwd=2,legend=names,col=cols) 40 | dev.off() 41 | 42 | pdf(paste(name,"-z",PDF,sep=""),width=50,height=30) 43 | plot(dat$time,dat$accZ,pch="",main="",xlab="s",ylab="mm") 44 | names = c("acc_z","filteredZ","uncertZ") 45 | cols = c("2","3", "4") 46 | 47 | points(dat$time,dat$accZ,type="l",col=cols[1]) 48 | points(dat$time,dat$filteredAccZ,type="l",col=cols[2]) 49 | points(dat$time,dat$filteredAccZUnc,type="l",col=cols[3]) 50 | 51 | 52 | legend("top",lwd=2,legend=names,col=cols) 53 | dev.off() -------------------------------------------------------------------------------- /motion/debug/accel/zmpaccel.R: -------------------------------------------------------------------------------- 1 | # R file to read in a debug walking output and generate pdf reports 2 | # Instructions: Install the R language (package 'r-base' in debian) 3 | # run 'make' in the terminal 4 | # Author: Johannes Strom 5 | # Date: March 2009 6 | 7 | 8 | name = "zmpacc_log" 9 | PDF = ".pdf" 10 | 11 | file = paste("/tmp/",name,".xls",sep="") 12 | if(!file.exists(file)) 13 | quit("no") 14 | dat = read.table(file,header=T,na.strings=c("-")) 15 | 16 | pdf(paste(name,"-x",PDF,sep=""),width=50,height=30) 17 | plot(dat$time,dat$accX,pch="",main="",xlab="s",ylab="mm") 18 | names = c("acc_x","filteredX","uncertX") 19 | cols = c("2","3", "4") 20 | 21 | points(dat$time,dat$accX,type="l",col=cols[1]) 22 | points(dat$time,dat$filteredAccX,type="l",col=cols[2]) 23 | points(dat$time,dat$filteredAccXUnc,type="l",col=cols[3]) 24 | 25 | 26 | legend("top",lwd=2,legend=names,col=cols) 27 | dev.off() 28 | 29 | pdf(paste(name,"-y",PDF,sep=""),width=50,height=30) 30 | plot(dat$time,dat$accY,pch="",main="",xlab="s",ylab="mm") 31 | names = c("acc_y","filteredY","uncertY") 32 | cols = c("2","3", "4") 33 | 34 | points(dat$time,dat$accY,type="l",col=cols[1]) 35 | points(dat$time,dat$filteredAccY,type="l",col=cols[2]) 36 | points(dat$time,dat$filteredAccYUnc,type="l",col=cols[3]) 37 | 38 | 39 | legend("top",lwd=2,legend=names,col=cols) 40 | dev.off() 41 | 42 | pdf(paste(name,"-z",PDF,sep=""),width=50,height=30) 43 | plot(dat$time,dat$accZ,pch="",main="",xlab="s",ylab="mm") 44 | names = c("acc_z","filteredZ","uncertZ") 45 | cols = c("2","3", "4") 46 | 47 | points(dat$time,dat$accZ,type="l",col=cols[1]) 48 | points(dat$time,dat$filteredAccZ,type="l",col=cols[2]) 49 | points(dat$time,dat$filteredAccZUnc,type="l",col=cols[3]) 50 | 51 | 52 | legend("top",lwd=2,legend=names,col=cols) 53 | dev.off() -------------------------------------------------------------------------------- /motion/debug/accel/zmp_log.R: -------------------------------------------------------------------------------- 1 | # R file to read in a debug walking output and generate pdf reports 2 | # Instructions: Install the R language (package 'r-base' in debian) 3 | # run 'make' in the terminal 4 | # Author: Johannes Strom 5 | # Date: Decemeber 2008 6 | 7 | 8 | name = "zmpekf_log" 9 | PDF = ".pdf" 10 | 11 | file = paste("/tmp/",name,".xls",sep="") 12 | if(!file.exists(file)) 13 | quit("no") 14 | dat = read.table(file,header=T,na.strings=c("-")) 15 | 16 | pdf(paste(name,"-x",PDF,sep=""),width=80, height=20) 17 | plot(dat$time,dat$pre_x,pch="",main="",xlab="s",ylab="mm") 18 | names = c("com_x","pre_x","zmp_x","sensor_zmp_x","raw_sensor_zmp_x") 19 | cols = c("2","3","4","5","6","1") 20 | 21 | points(dat$time,dat$com_x,type="l",col=2) 22 | points(dat$time,dat$pre_x,type="l",col=3) 23 | points(dat$time,dat$com_px,type="l",col=4) 24 | points(dat$time,dat$sensor_px,type="l",col=5) 25 | points(dat$time,dat$sensor_px_unf,type="l",col=6) 26 | points(dat$time,dat$sensor_px_unff,type="l",col=1) 27 | points(dat$time,dat$angleY*180/3.14,type="l",col=2) 28 | 29 | legend("top",lwd=2,legend=names,col=cols) 30 | dev.off() 31 | 32 | 33 | 34 | pdf(paste(name,"-y",PDF,sep=""),width=80, height=20) 35 | plot(dat$time,dat$pre_y,pch="",main="",xlab="s",ylab="mm") 36 | names = c("com_y","pre_y","zmp_y","sensor_zmp_y","raw_sensor_zmp_y") 37 | cols = c("2","3","4","5","6","1") 38 | 39 | points(dat$time,dat$com_y,type="l",col=2) 40 | points(dat$time,dat$pre_y,type="l",col=3) 41 | points(dat$time,dat$com_py,type="l",col=4) 42 | points(dat$time,dat$sensor_py,type="l",col=5) 43 | points(dat$time,dat$sensor_py_unf,type="l",col=6) 44 | points(dat$time,dat$sensor_py_unff,type="l",col=1) 45 | points(dat$time,dat$angleX*180/3.14,type="l",col=2) 46 | 47 | legend("top",lwd=2,legend=names,col=cols) 48 | dev.off() 49 | 50 | -------------------------------------------------------------------------------- /motion/debug/dest_log.R: -------------------------------------------------------------------------------- 1 | # R file to read in a debug walking output and generate pdf reports 2 | # Instructions: Install the R language (package 'r-base' in debian) 3 | # run 'make' in the terminal 4 | # Author: Johannes Strom 5 | # Date: Decemeber 2008 6 | 7 | 8 | 9 | foot_dest = function(foot){ 10 | 11 | name = paste(foot,"_dest_log",sep="") 12 | PDF = ".pdf" 13 | 14 | file = paste("/tmp/",name,".xls",sep="") 15 | if(!file.exists(file)) 16 | quit("no") 17 | dat = read.table(file,header=T,na.strings=c("-")) 18 | 19 | pdf(paste(name,"-x",PDF,sep="")) 20 | miny = min(min(dat$dest_x),min(dat$src_x)) 21 | maxy = max(max(dat$dest_x),max(dat$src_x)) 22 | #plot(dat$time,dat$dest_x,ylim=c(miny,maxy),pch="",main="",xlab="s",ylab="mm") 23 | plot(dat$time,dat$dest_x,pch="",main="",xlab="s",ylab="mm") 24 | names = c("dest_x") 25 | cols = c("2") 26 | points(dat$time,dat$dest_x,type="l",col=2) 27 | #points(dat$time,dat$src_x,type="l",col=3) 28 | legend("top",lwd=2,legend=names,col=cols) 29 | zeros = dat$time 30 | zeros[zeros > -100] = mean(dat$dest_x,na.rm=T) +10 31 | points(dat$time,zeros,pch=1,col=dat$state+2) 32 | names = c("Supporting","Swinging","Dbl Sup", "P. Dbl Sup") 33 | legend("topleft",lwd=2,legend=names,col=c(2:5)) 34 | dev.off() 35 | 36 | pdf(paste(name,"-y",PDF,sep="")) 37 | plot(dat$time,dat$dest_y,pch="",main="",xlab="s",ylab="mm") 38 | names = c("dest_y") 39 | cols = c("2") 40 | points(dat$time,dat$dest_y,type="l",col=2) 41 | legend("top",lwd=2,legend=names,col=cols) 42 | zeros = dat$time 43 | zeros[zeros > -100] = mean(dat$dest_y,na.rm=T) +10 44 | points(dat$time,zeros,pch=1,col=dat$state+2) 45 | names = c("Supporting","Swinging","Dbl Sup", "P. Dbl Sup") 46 | legend("topleft",lwd=2,legend=names,col=c(2:5)) 47 | dev.off() 48 | 49 | } 50 | 51 | 52 | foot_dest("left") 53 | foot_dest("right") -------------------------------------------------------------------------------- /noggin/typeDefs/Sonar.py: -------------------------------------------------------------------------------- 1 | 2 | class Sonar: 3 | """ 4 | Holds the data from the ultrasound sonar sensors 5 | """ 6 | def __init__(self): 7 | # Class constants 8 | self.UNKNOWN_VALUE = "unknown distance" 9 | self.MIN_DIST = 0.0 # minimum readable distance in cm 10 | self.MAX_DIST = 255.0 # maximum readable distance in cm 11 | 12 | self.lastDist = self.UNKNOWN_VALUE 13 | self.lastMode = None 14 | 15 | self.LLdist = self.UNKNOWN_VALUE 16 | self.RRdist = self.UNKNOWN_VALUE 17 | self.LRdist = self.UNKNOWN_VALUE 18 | self.RLdist = self.UNKNOWN_VALUE 19 | 20 | def updateSensors(self, sensors, modes): 21 | """ 22 | Update the sonar info from the most recent sensors 23 | """ 24 | self.lastDist = sensors.ultraSoundDistance 25 | self.lastMode = sensors.ultraSoundMode 26 | 27 | if (self.lastDist <= self.MIN_DIST or 28 | self.lastDist >= self.MAX_DIST): 29 | self.lastDist = self.UNKNOWN_VALUE 30 | if self.lastMode == modes.LL: 31 | self.LLdist = self.lastDist 32 | elif self.lastMode == modes.RR: 33 | self.RRdist = self.lastDist 34 | elif self.lastMode == modes.LR: 35 | self.LRdist = self.lastDist 36 | elif self.lastMode == modes.RL: 37 | self.RLdist = self.lastDist 38 | 39 | def __str__(self): 40 | return ("Last reading of " + str(self.lastMode) + 41 | " has distance of " + str(self.lastDist) + 42 | " \n" + 43 | "LL dist: " + str(self.LLdist) + "\n" + 44 | "RR dist: " + str(self.RRdist) + "\n" + 45 | "LR dist: " + str(self.LRdist) + "\n" + 46 | "RL dist: " + str(self.RLdist)) 47 | -------------------------------------------------------------------------------- /motion/debug/joints_log.R: -------------------------------------------------------------------------------- 1 | # R file to read in a debug walking output and generate pdf reports 2 | # Instructions: Install the R language (package 'r-base' in debian) 3 | # run 'make' in the terminal 4 | # Author: Johannes Strom 5 | # Date: February 2008 6 | 7 | name = "joints_log" 8 | PDF = ".pdf" 9 | 10 | file = paste("/tmp/",name,".xls",sep="") 11 | if(!file.exists(file)) 12 | quit("no") 13 | dat = read.table(file,header=T,na.strings=c("-")) 14 | 15 | #labels = dat[0,] 16 | dummy = dat[,2] #for setting limits 17 | dummy[1] = pi 18 | dummy[2] = -pi 19 | 20 | #note, time occupies slot 1, so the indices are shifted by one 21 | chain_lengths = function(chainID){ 22 | if(chainID ==1){ 23 | return(c(2:3)) 24 | } 25 | if(chainID ==2){ 26 | return(c(4:7)) 27 | } 28 | if(chainID ==3){ 29 | return(c(8:13)) 30 | } 31 | if(chainID ==4){ 32 | return(c(14:19)) 33 | } 34 | if(chainID ==5){ 35 | return(c(20:23)) 36 | } 37 | return(c()) 38 | } 39 | 40 | c_names = c("head","larm","lleg","rleg","rarm") 41 | for(chn in c(1:5)){ 42 | pdf(paste(c_names[chn],"_",name,PDF,sep="")) 43 | indices=chain_lengths(chn) 44 | 45 | #find the range of the graph 46 | mind = min(dat[,indices]) 47 | maxd = max(dat[,indices]) 48 | dummy = dat[,2] #for setting limits 49 | dummy[1] = mind 50 | dummy[2] = maxd 51 | plot(dat$time,dummy,pch="",main=c_names[chn],xlab="s",ylab="rad") 52 | 53 | color_list = c() 54 | color = 1 55 | for(i in indices){ 56 | color = color +1 57 | color_list = append(color_list,c(color)) 58 | points(dat$time,dat[,i],type="l",col=color) 59 | } 60 | legend("top",lwd=2,legend=labels(dat)[[2]][indices],col=color_list) 61 | dev.off() 62 | } -------------------------------------------------------------------------------- /motion/MotionCommand.h: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | #ifndef _MotionCommand_h_DEFINED 22 | #define _MotionCommand_h_DEFINED 23 | 24 | /** 25 | * Overarching MotionCommand class for motion. 26 | * 27 | * It's only ability is to keep track of what kind of motion 28 | * it implements. 29 | * 30 | * Must be DELETED when passed to a provider!!! 31 | */ 32 | #include 33 | #include "MotionConstants.h" 34 | 35 | class MotionCommand 36 | { 37 | public: 38 | MotionCommand(MotionConstants::MotionType type) 39 | : chainList(), motionType(type) { } 40 | virtual ~MotionCommand() { } 41 | const MotionConstants::MotionType getType() const { return motionType; } 42 | const std::list* getChainList() const { return &chainList; } 43 | 44 | protected: 45 | std::list chainList; 46 | private: 47 | virtual void setChainList() = 0; 48 | const MotionConstants::MotionType motionType; 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /motion/debug/effector_log.R: -------------------------------------------------------------------------------- 1 | # R file to read in a debug walking output and generate pdf reports 2 | # Instructions: Install the R language (package 'r-base' in debian) 3 | # run 'make' in the terminal 4 | # Author: Johannes Strom 5 | # Date: February 2008 6 | 7 | 8 | name = "effector_log" 9 | PDF = ".pdf" 10 | lw = 1 11 | 12 | file = paste("/tmp/",name,".xls",sep="") 13 | if(!file.exists(file)) 14 | quit("no") 15 | dat = read.table(file,header=T,na.strings=c("-")) 16 | 17 | 18 | #labels = dat[0,] 19 | dummy = dat[,2] #for setting limits 20 | dummy[1] = pi 21 | dummy[2] = -pi 22 | 23 | #note, time occupies slot 1, so the indices are shifted by one 24 | chain_indices = function(chainID){ 25 | start = chainID*3 -1 26 | end = start +2 27 | return(c(start:end)) 28 | } 29 | 30 | c_names = c("head","larm","lleg","rleg","rarm") 31 | for(chn in c(1:5)){ 32 | indices=chain_indices(chn) 33 | dim="_x" 34 | pdf(paste(c_names[chn],"_",name,dim,PDF,sep="")) 35 | plot(dat$time,dat[,indices[1]],type="l", 36 | main=paste(c_names[chn],dim,sep=""),xlab="s",ylab="mm",col=3) 37 | legend("top",lwd=lw,legend=labels(dat)[[2]][indices[1]],col=3) 38 | dev.off() 39 | 40 | dim="_y" 41 | pdf(paste(c_names[chn],"_",name,dim,PDF,sep="")) 42 | plot(dat$time,dat[,indices[2]],type="l", 43 | main=paste(c_names[chn],dim,sep=""),xlab="s",ylab="mm",col=4) 44 | legend("top",lwd=lw,legend=labels(dat)[[2]][indices[2]],col=4) 45 | dev.off() 46 | 47 | dim="_z" 48 | pdf(paste(c_names[chn],"_",name,dim,PDF,sep="")) 49 | plot(dat$time,dat[,indices[3]],type="l", 50 | main=paste(c_names[chn],dim,sep=""),xlab="s",ylab="mm",col=5) 51 | legend("top",lwd=lw,legend=labels(dat)[[2]][indices[3]],col=5) 52 | dev.off() 53 | 54 | } -------------------------------------------------------------------------------- /noggin/offline/README: -------------------------------------------------------------------------------- 1 | README noggin/offline 2 | 3 | The offline directory houses utilities for processing and creating localization logs. 4 | 5 | Run the command "make" in this directory will create a number of usefull localization 6 | utilities. 7 | 8 | Currently two different executables are created "convertRobotLog" and "faker". 9 | 10 | 11 | convertRobotLog input-file output-file 12 | 13 | This command takes as input a dot loc file saved on the robot and outputs a dot ekf file to 14 | that can be read by the World Controller module of the TOOL. 15 | 16 | faker input-file 17 | 18 | This command takes as input a dot nav file created by a human to represent a fake robot path 19 | which is then used to create noisy landmark observations which are processed by the localization 20 | system. It gives as output a dot ekf and a dot mcl file with the same name as the dot nav. 21 | 22 | Format of the navigation input file (*.nav), has one START POSITION LINE and as many 23 | NAVIGATION LINES as required: 24 | 25 | # START POSITION LINE 26 | x-value y-value heading-value ball-x ball-y 27 | 28 | # NAVIGATION LINES 29 | deltaForward deltaLateral deltaRotation ball-vel-x ball-vel-y numFrames 30 | 31 | When a dot ekf or dot mcl file is created from a dot nav file it has additional information 32 | reporting the ground truth (read human created) position of the robot at all points. 33 | 34 | When one of these files is processed by the TOOL in addition to the robot's estimated position 35 | a known position is displayed on the field so that the two may be compared. This ground truth 36 | could be extended when other robot logs are created either through a known position of a 37 | simulated robot extracted from a GPS moudle in the simulator or a known position of a real robot 38 | taken from an overhead camera of the field. 39 | 40 | -------------------------------------------------------------------------------- /noggin/players/PositionTransitions.py: -------------------------------------------------------------------------------- 1 | import PositionConstants as constants 2 | import ChaseBallTransitions 3 | 4 | ####### POSITIONING STUFF ############## 5 | 6 | def shouldTurnToBall_fromAtBallPosition(player): 7 | """ 8 | Should we spin towards the ball, if already at our position 9 | """ 10 | ball = player.brain.ball 11 | return (ball.on and 12 | abs(ball.bearing > (constants.BALL_SPIN_POSITION_THRESH + 13 | constants.BALL_SPIN_BUFFER))) 14 | 15 | def atSpinBallDir(player): 16 | """ 17 | Should we stop spinning because we are facing the ball 18 | """ 19 | ball = player.brain.ball 20 | return (ball.on and 21 | abs(ball.bearing < constants.BALL_SPIN_POSITION_THRESH)) 22 | 23 | def shouldSpinFindBallPosition(player): 24 | """ 25 | Should we spin to find the ball 26 | """ 27 | if player.stateTime >= constants.BALL_OFF_SPIN_TIME: 28 | return True 29 | return False 30 | 31 | def shouldKickAtPosition(player): 32 | """ 33 | Is the ball close enough that we should kick 34 | """ 35 | return (player.brain.ball.on and 36 | player.brain.ball.dist < constants.AT_POSITION_KICK_DIST) 37 | 38 | def shouldAvoidObstacle(player): 39 | return ChaseBallTransitions.shouldAvoidObstacle(player) and \ 40 | (player.brain.nav.currentState == 'omniWalkToPoint' or 41 | player.brain.nav.currentState == 'walkStraightToPoint') 42 | 43 | def shouldReposition(player, dest, position): 44 | """ 45 | are we enough out of position we should move? 46 | """ 47 | return (abs(dest.x - position.x) > constants.GOTO_DEST_EPSILON or 48 | abs(dest.y - position.y) > constants.GOTO_DEST_EPSILON or 49 | not player.atDestinationCloser() or 50 | not player.atHeading()) 51 | -------------------------------------------------------------------------------- /motion/debug/stiff_log.R: -------------------------------------------------------------------------------- 1 | # R file to read in a debug walking output and generate pdf reports 2 | # Instructions: Install the R language (package 'r-base' in debian) 3 | # run 'make' in the terminal 4 | # Author: Johannes Strom 5 | # Date: February 2008 6 | 7 | name = "stiff_log" 8 | PDF = ".pdf" 9 | 10 | file = paste("/tmp/",name,".xls",sep="") 11 | if(!file.exists(file)) 12 | quit("no") 13 | dat = read.table(file,header=T,na.strings=c("-")) 14 | 15 | #labels = dat[0,] 16 | dummy = dat[,2] #for setting limits 17 | dummy[1] = pi 18 | dummy[2] = -pi 19 | 20 | #note, time occupies slot 1, so the indices are shifted by one 21 | chain_lengths = function(chainID){ 22 | if(chainID ==1){ 23 | return(c(2:3)) 24 | } 25 | if(chainID ==2){ 26 | return(c(4:7)) 27 | } 28 | if(chainID ==3){ 29 | return(c(8:13)) 30 | } 31 | if(chainID ==4){ 32 | return(c(14:19)) 33 | } 34 | if(chainID ==5){ 35 | return(c(20:23)) 36 | } 37 | return(c()) 38 | } 39 | 40 | c_names = c("head","larm","lleg","rleg","rarm") 41 | for(chn in c(1:5)){ 42 | pdf(paste(c_names[chn],"_",name,PDF,sep=""),width=10, height=7) 43 | indices=chain_lengths(chn) 44 | 45 | #find the range of the graph 46 | mind = min(dat[,indices]) 47 | maxd = max(dat[,indices]) 48 | dummy = dat[,2] #for setting limits 49 | dummy[1] = mind 50 | dummy[2] = maxd 51 | plot(dat$time,dummy,pch="",main=c_names[chn],xlab="s",ylab="rad") 52 | 53 | color_list = c() 54 | color = 1 55 | for(i in indices){ 56 | color = color +1 57 | color_list = append(color_list,c(color)) 58 | points(dat$time,dat[,i],type="l",col=color) 59 | } 60 | legend("bottom",lwd=2,legend=labels(dat)[[2]][indices],col=color_list) 61 | dev.off() 62 | } -------------------------------------------------------------------------------- /include/AiboConnect.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | AIBOCONNECT CONSTANTS. 4 | AiboConnect mostly lives in: AiboConnect.cc and EchoServer.cc, as well 5 | as some initialization stuff in Vision.cc 6 | 7 | */ 8 | 9 | #ifndef AiboConnect_h_DEFINED 10 | #define AiboConnect_h_DEFINED 11 | 12 | /* 13 | # 14 | # VISION CONSTANTS 15 | # 16 | */ 17 | 18 | // These are constants for connectString, which keeps track of the current 19 | // type of request from the AiboConnect client 20 | #define AC_NONE 0 21 | #define AC_STRING 1 22 | #define AC_RAW 2 23 | #define AC_CORRECTED 3 24 | #define AC_THRESH 4 25 | #define AC_RLE 5 26 | #define AC_LOG_IMAGE 6 27 | #define AC_LOG_RFRAME 7 28 | #define AC_LOG_VFRAME 8 29 | #define AC_LOG_MFRAME 9 30 | 31 | /* for the deflate() function, we compress each byte to BIT_SHIFT_SIZE number of bits to save space when we send over the image array */ 32 | #define BIT_SHIFT_SIZE 4 33 | 34 | /* With Image Sizes defined in VisionDef.h included above, these are the sizes 35 | for the two types of image arrays we send over the wireless, one for FULL, 36 | UNSEGMENTED, UNPROCESSED images (minus chromatic distortion correction) and 37 | one for the THRESHOLDED images. 38 | */ 39 | #define THRESH_IMAGE_BYTE_SIZE 160*208*BIT_SHIFT_SIZE/8 40 | 41 | // Total number of passed values within the string command. 42 | #define NUM_ECHO_VALUES 20 43 | 44 | /* 45 | # 46 | # TCP INTERFACE 47 | # 48 | */ 49 | 50 | /* number of connections allowed per robot */ 51 | #define AC_CONNECTION_MAX 4 52 | 53 | /* TCP ports, we will take up ports from 54 | AIBOCONNECT_PORT to AIBOCONNECT_PORT+AIBOCONNECT_CONNECTION_MAX*/ 55 | #define AC_PORT 23000 56 | 57 | /* size of our TCP buffers for recv, send, and listen */ 58 | #define AC_LISTEN_BUFFER 200000 59 | #define AC_RECV_BUFFER 100000 60 | #define AC_SEND_BUFFER 100000 61 | 62 | #endif // AiboConnect_h_DEFINED 63 | -------------------------------------------------------------------------------- /noggin/players/PenaltyKickStates.py: -------------------------------------------------------------------------------- 1 | from .. import NogginConstants 2 | from ..playbook.PBConstants import GOALIE 3 | import ChaseBallStates 4 | import ChaseBallTransitions as transitions 5 | PENALTY_RELOCALIZE_FRAMES = 100 6 | 7 | def penaltyKick(player): 8 | player.penaltyKicking = True 9 | player.penaltyMadeFirstKick = True 10 | player.penaltyMadeSecondKick = False 11 | return player.goNow('approachBallWithLoc') 12 | 13 | def penaltyKickRelocalize(player): 14 | my = player.brain.my 15 | if player.firstFrame(): 16 | player.brain.tracker.locPans() 17 | if my.locScore == NogginConstants.BAD_LOC and \ 18 | player.counter < PENALTY_RELOCALIZE_FRAMES: 19 | return player.stay() 20 | return player.goNow('scanFindBall') 21 | 22 | def penaltyGoalie(player): 23 | player.penaltyKicking = True 24 | player.penaltyMadeFirstKick = True 25 | player.penaltyMadeSecondKick = False 26 | 27 | roleState = player.getRoleState(GOALIE) 28 | return player.goNow(roleState) 29 | 30 | def penaltyBallInOppGoalbox(player): 31 | if player.firstFrame(): 32 | player.stopWalking() 33 | player.brain.tracker.activeLoc() 34 | if not player.ballInOppGoalBox(): 35 | return player.goLater('chase') 36 | return player.stay() 37 | 38 | def penaltyKickShortDribble(player): 39 | if player.firstFrame(): 40 | player.penaltyMadeFirstKick = True 41 | if transitions.shouldStopPenaltyKickDribbling(player): 42 | 43 | if transitions.shouldKick(player): 44 | return player.goNow('waitBeforeKick') 45 | elif transitions.shouldPositionForKick(player): 46 | return player.goNow('positionForKick') 47 | elif transitions.shouldApproachBall(player): 48 | return player.goNow('approachBall') 49 | 50 | return ChaseBallStates.approachBallWalk(player) 51 | -------------------------------------------------------------------------------- /cmake/FindFINK.cmake: -------------------------------------------------------------------------------- 1 | # This file locates the fink distribution on a mac, which is where many 2 | # important headers are located (/sw) (for example, boost1.33) 3 | 4 | ## 5 | # Includes 6 | ## 7 | 8 | INCLUDE ( ${CMAKE_MODULE_PATH}/base_definitions.cmake ) 9 | 10 | 11 | ## 12 | # Clear variables/caches 13 | ## 14 | 15 | SET( FINK_DEFINITIONS "" ) 16 | SET( FINK_INCLUDE_DIR "FINK_INCLUDE_DIR-NOTFOUND" CACHE FILEPATH "Cleared." FORCE ) 17 | SET( FINK_LIBRARIES "FINK_LIBRARIES-NOTFOUND" CACHE FILEPATH "Cleared." FORCE ) 18 | 19 | ## 20 | # Defined package variable 21 | ## 22 | 23 | SET( FINK_INCLUDE_DIR "/sw/include" ) 24 | SET( FINK_LIB_DIR "/sw/lib" ) 25 | 26 | IF( EXISTS ${FINK_INCLUDE_DIR} ) 27 | SET( FINK_FOUND TRUE ) 28 | FOREACH( dir ${FINK_LIBRARIES} ) 29 | IF ( NOT EXISTS ${dir} ) 30 | SET( FINK_FOUND FALSE ) 31 | ENDIF ( NOT EXISTS ${dir} ) 32 | ENDFOREACH( dir ${FINK_LIBRARIES} ) 33 | ENDIF( EXISTS ${FINK_INCLUDE_DIR} ) 34 | 35 | IF( NOT FINK_FOUND AND FINK_FIND_REQUIRED ) 36 | IF( NOT FINK_INCLUDE_DIR ) 37 | MESSAGE( STATUS "Required include not found" ) 38 | MESSAGE( FATAL_ERROR "Could not find FINK include!" ) 39 | ENDIF( NOT FINK_INCLUDE_DIR ) 40 | IF( NOT FINK_LIBRARIES ) 41 | MESSAGE( STATUS "Required libraries not found" ) 42 | MESSAGE( FATAL_ERROR "Could not find FINK libraries!" ) 43 | ENDIF( NOT FINK_LIBRARIES ) 44 | ENDIF( NOT FINK_FOUND AND FINK_FIND_REQUIRED ) 45 | 46 | 47 | ## 48 | # Finally, display informations if not in quiet mode 49 | ## 50 | 51 | IF( NOT FINK_FIND_QUIETLY ) 52 | MESSAGE( STATUS "FINK found " ) 53 | MESSAGE( STATUS " robot name : ${ROBOT_PREFIX}" ) 54 | MESSAGE( STATUS " includes : ${FINK_INCLUDE_DIR}" ) 55 | MESSAGE( STATUS " libraries : ${FINK_LIBRARIES}" ) 56 | MESSAGE( STATUS " definitions: ${FINK_DEFINITIONS}" ) 57 | ENDIF( NOT FINK_FIND_QUIETLY ) 58 | 59 | 60 | 61 | MARK_AS_ADVANCED( 62 | FINK_INCLUDE_DIR 63 | FINK_LIBRARIES 64 | ) 65 | -------------------------------------------------------------------------------- /noggin/GameStates.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Game Controller States 4 | """ 5 | def gamePlaying(game): 6 | if game.firstFrame(): 7 | game.brain.player.switchTo('gamePlaying') 8 | 9 | return game.stay() 10 | 11 | def gamePenalized(game): 12 | if game.firstFrame(): 13 | game.brain.player.switchTo('gamePenalized') 14 | 15 | return game.stay() 16 | 17 | def gameInitial(game): 18 | if game.firstFrame(): 19 | game.brain.player.switchTo('gameInitial') 20 | 21 | return game.stay() 22 | 23 | def gameSet(game): 24 | if game.firstFrame(): 25 | game.brain.player.switchTo('gameSet') 26 | 27 | return game.stay() 28 | 29 | def gameReady(game): 30 | if game.firstFrame(): 31 | game.brain.player.switchTo('gameReady') 32 | 33 | return game.stay() 34 | 35 | def gameFinished(game): 36 | if game.firstFrame(): 37 | game.brain.player.switchTo('gameFinished') 38 | 39 | return game.stay() 40 | 41 | def penaltyShotsGameInitial(game): 42 | if game.firstFrame(): 43 | game.brain.player.switchTo('penaltyShotsGameInitial') 44 | return game.stay() 45 | 46 | def penaltyShotsGameReady(game): 47 | if game.firstFrame(): 48 | game.brain.player.switchTo('penaltyShotsGameReady') 49 | return game.stay() 50 | 51 | def penaltyShotsGameSet(game): 52 | if game.firstFrame(): 53 | game.brain.player.switchTo('penaltyShotsGameSet') 54 | return game.stay() 55 | 56 | def penaltyShotsGamePlaying(game): 57 | if game.firstFrame(): 58 | game.brain.player.switchTo('penaltyShotsGamePlaying') 59 | return game.stay() 60 | 61 | def penaltyShotsGameFinished(game): 62 | if game.firstFrame(): 63 | game.brain.player.switchTo('penaltyShotsGameFinished') 64 | return game.stay() 65 | 66 | def penaltyShotsGamePenalized(game): 67 | if game.firstFrame(): 68 | game.brain.player.switchTo('penaltyShotsGamePenalized') 69 | return game.stay() 70 | 71 | -------------------------------------------------------------------------------- /corpus/messaging.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | #include 22 | 23 | #include "messaging.h" 24 | 25 | template 26 | void MessagePost::post(T ©) 27 | { 28 | assert(dolock()); 29 | data = copy; 30 | assert(release()); 31 | } 32 | 33 | template 34 | T MessagePost::retrieve() 35 | { 36 | T copy; 37 | assert(dolock()); 38 | copy = data; 39 | assert(release()); 40 | return copy; 41 | } 42 | 43 | template 44 | void MessageQueue::append(T ©) 45 | { 46 | assert(dolock()); 47 | data.push_back(new T(copy)); 48 | assert(release()); 49 | } 50 | 51 | template 52 | T* MessageQueue::retrieve() 53 | { 54 | if (data.empty()) 55 | return NULL; 56 | 57 | T* copy; 58 | assert(dolock()); 59 | copy = data.pop_front(); 60 | assert(release()); 61 | return copy; 62 | } 63 | 64 | template 65 | std::list MessageQueue::retrieveAll() 66 | { 67 | std::list list; 68 | list.swap(data); 69 | return list; 70 | } 71 | -------------------------------------------------------------------------------- /corpus/Transcriber.h: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | #ifndef _Transcriber_h_DEFINED 22 | #define _Transcriber_h_DEFINED 23 | 24 | #include "boost/shared_ptr.hpp" 25 | 26 | #include "Sensors.h" 27 | 28 | /** 29 | * This abstract class serves to copy (transcribe) information from the 30 | * underlying robot platform to our codebase (e.g. copy into the Sensors class) 31 | * It has different methods which can be called 32 | * from different threads in order to update sensors at different 33 | * frequencies, depending on their need. 34 | * 35 | * The advantage of having the transcriber is that similar code does not need 36 | * to be duplicated accross Enactors, and we can pull more robot/platform 37 | * specific code out of Man 38 | */ 39 | 40 | 41 | class Transcriber{ 42 | public: 43 | Transcriber(boost::shared_ptr _sensors):sensors(_sensors){} 44 | virtual ~Transcriber(){} 45 | 46 | virtual void postMotionSensors() = 0; 47 | virtual void postVisionSensors() = 0; 48 | 49 | protected: 50 | boost::shared_ptr sensors; 51 | }; 52 | #endif 53 | -------------------------------------------------------------------------------- /motion/ChopShop.h: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | #ifndef _ChopShop_h_DEFINED 22 | #define _ChopShop_h_DEFINED 23 | 24 | #include 25 | #include 26 | 27 | #include "Sensors.h" 28 | #include "BodyJointCommand.h" 29 | 30 | #include "JointCommand.h" 31 | #include "ChoppedCommand.h" 32 | #include "LinearChoppedCommand.h" 33 | #include "SmoothChoppedCommand.h" 34 | #include "Common.h" 35 | 36 | class ChopShop 37 | { 38 | public: 39 | ChopShop(boost::shared_ptr s); 40 | 41 | boost::shared_ptr chopCommand(const JointCommand *command); 42 | 43 | private: 44 | boost::shared_ptr sensors; 45 | float FRAME_LENGTH_S; 46 | 47 | boost::shared_ptr chopLinear(const JointCommand *command, 48 | std::vector currentJoints, 49 | int numChops); 50 | 51 | boost::shared_ptr chopSmooth(const JointCommand *command, 52 | std::vector currentJoints, 53 | int numChops); 54 | 55 | 56 | std::vector getCurrentJoints(); 57 | 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /noggin/players/DataStates.py: -------------------------------------------------------------------------------- 1 | import man.motion.SweetMoves as SweetMoves 2 | import man.motion.HeadMoves as HeadMoves 3 | 4 | NUM_FRAMES_TO_SAVE = 500 5 | MAX_DIST_TO_MEASURE = 300 6 | DIST_INCREMENT = 50 7 | FRAMES_TO_WAIT = 400 8 | 9 | def gameReady(player): 10 | player.brain.resetLocalization() 11 | return player.goNow('standup') 12 | 13 | def gameSet(player): 14 | player.brain.resetLocalization() 15 | return player.goNow('standup') 16 | 17 | def gamePlaying(player): 18 | player.brain.resetLocalization() 19 | return player.goNow('standup') 20 | 21 | def standup(player): 22 | if player.firstFrame(): 23 | player.brain.tracker.stopHeadMoves() 24 | player.standup() 25 | 26 | elif not player.brain.motion.isBodyActive(): 27 | return player.goLater('saveFrames') 28 | 29 | return player.stay() 30 | 31 | def saveFrames(player): 32 | if player.firstFrame(): 33 | player.brain.tracker.startScan(HeadMoves.DATA_PAN) 34 | 35 | #player.brain.sensors.saveFrame() 36 | player.savePostInfo() 37 | 38 | if player.counter > NUM_FRAMES_TO_SAVE: 39 | player.postDistance += DIST_INCREMENT 40 | 41 | if player.postDistance > MAX_DIST_TO_MEASURE: 42 | return player.goLater('doneState') 43 | return player.goLater('waitBetweenDists') 44 | 45 | return player.stay() 46 | 47 | def waitBetweenDists(player): 48 | # if player.firstFrame(): 49 | # player.zeroHeads() 50 | if player.counter > FRAMES_TO_WAIT: 51 | return player.goLater('saveFrames') 52 | return player.stay() 53 | 54 | def doneState(player): 55 | if player.firstFrame(): 56 | player.executeMove(SweetMoves.SIT_POS) 57 | player.brain.tracker.stopHeadMoves() 58 | player.brain.sensors.resetSaveFrame() 59 | 60 | # if player.stateTime > 8.0: 61 | # shutoff = motion.StiffnessCommand(0.0) 62 | # player.brain.motion.sendStiffness(shutoff) 63 | 64 | return player.stay() 65 | 66 | #gameInitial = gameReady 67 | -------------------------------------------------------------------------------- /motion/Motion.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | #include 22 | using namespace boost; 23 | 24 | #include "synchro.h" 25 | #include "Motion.h" 26 | #include "PyMotion.h" 27 | //#include "NaoEnactor.h" 28 | 29 | Motion::Motion (shared_ptr _synchro, 30 | shared_ptr _enactor, 31 | shared_ptr s, shared_ptr p) 32 | : Thread(_synchro, "Motion"), 33 | switchboard(s,p), 34 | enactor(_enactor), 35 | interface(&switchboard), 36 | profiler(p) 37 | { 38 | set_motion_interface(&interface); 39 | } 40 | 41 | Motion::~Motion() { 42 | enactor->setSwitchboard(NULL); 43 | } 44 | int Motion::start() { 45 | switchboard.start(); 46 | 47 | return Thread::start(); 48 | } 49 | 50 | void Motion::stop() { 51 | switchboard.stop(); 52 | Thread::stop(); 53 | } 54 | 55 | void Motion::run(){ 56 | cout <<"Motion::run"<on(); 58 | 59 | //Setup the callback in the enactor so it knows to call the switchboard 60 | enactor->setSwitchboard(&switchboard); 61 | 62 | switchboard.run(); 63 | Thread::trigger->off(); 64 | } 65 | -------------------------------------------------------------------------------- /motion/HeadJointCommand.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | #include "HeadJointCommand.h" 22 | using namespace MotionConstants; 23 | using namespace Kinematics; 24 | 25 | HeadJointCommand::HeadJointCommand(const float time, 26 | const std::vector *joints, 27 | const std::vector *head_stiffness, 28 | const Kinematics::InterpolationType _type) 29 | : JointCommand(HEAD_JOINT, time, _type, head_stiffness), 30 | headJoints(joints), noJoints(0) 31 | { 32 | setChainList(); 33 | } 34 | 35 | HeadJointCommand::HeadJointCommand(const HeadJointCommand &other) 36 | : JointCommand(HEAD_JOINT, 37 | other.getDuration(), 38 | other.getInterpolation(), 39 | other.getStiffness()), 40 | noJoints(0) 41 | { 42 | setChainList(); 43 | 44 | if(other.headJoints) 45 | headJoints = new std::vector(*other.headJoints); 46 | } 47 | 48 | HeadJointCommand::~HeadJointCommand() { 49 | if (headJoints != NULL) 50 | delete headJoints; 51 | } 52 | 53 | void 54 | HeadJointCommand::setChainList() { 55 | chainList.insert(chainList.end(), 56 | HEAD_JOINT_CHAINS, 57 | HEAD_JOINT_CHAINS + HEAD_JOINT_NUM_CHAINS); 58 | } 59 | -------------------------------------------------------------------------------- /vision/Profiler.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _Profiler_h_DEFINED 3 | #define _Profiler_h_DEFINED 4 | 5 | #include "profileconfig.h" 6 | 7 | 8 | #ifdef USE_TIME_PROFILING 9 | # define PROF_NFRAME(p) ((p)->nextFrame()) 10 | # define PROF_ENTER(p,c) ((p)->profiling && (p)->enterComponent(c)) 11 | # define PROF_EXIT(p,c) ((p)->profiling && (p)->exitComponent(c)) 12 | #else 13 | # define PROF_NFRAME(p) 14 | # define PROF_ENTER(p,c) 15 | # define PROF_EXIT(p,c) 16 | #endif 17 | 18 | enum ProfiledComponent { 19 | P_GETIMAGE = 0, 20 | P_VISION, 21 | P_TRANSFORM, 22 | P_THRESHRUNS, 23 | P_THRESHOLD, 24 | P_FGHORIZON, 25 | P_RUNS, 26 | P_OBJECT, 27 | 28 | P_LINES, 29 | 30 | P_VERT_LINES, 31 | P_HOR_LINES, 32 | P_CREATE_LINES, 33 | P_JOIN_LINES, 34 | P_FIT_UNUSED, 35 | P_INTERSECT_LINES, 36 | 37 | P_PYTHON, 38 | P_PYUPDATE, 39 | P_PYRUN, 40 | P_SWITCHBOARD, 41 | P_SCRIPTED, 42 | P_CHOPPED, 43 | P_WALK, 44 | P_TICKLEGS, 45 | P_HEAD, 46 | P_ENACTOR, 47 | P_LOC, 48 | P_MCL, 49 | P_LOGGING, 50 | P_AIBOCONNECT, 51 | P_TOOLCONNECT, 52 | P_LIGHTS, 53 | P_FINAL, 54 | }; 55 | static const int NUM_PCOMPONENTS = P_FINAL + 1; 56 | 57 | class Profiler { 58 | public: 59 | 60 | Profiler(long long (*f)()); 61 | ~Profiler(); 62 | 63 | void profileFrames(int num_frames); 64 | void reset(); 65 | 66 | void printCurrent(); 67 | void printSummary(); 68 | 69 | bool nextFrame(); 70 | 71 | inline bool enterComponent(ProfiledComponent c) { 72 | enterTime[c] = timeFunction(); 73 | return profiling; 74 | } 75 | inline bool exitComponent(ProfiledComponent c) { 76 | lastTime[c] = timeFunction() - enterTime[c]; 77 | return profiling; 78 | } 79 | 80 | public: 81 | bool profiling; 82 | 83 | private: 84 | long long (*timeFunction) (); 85 | 86 | bool start_next_frame; 87 | int num_profile_frames; 88 | int current_frame; 89 | long long enterTime[NUM_PCOMPONENTS]; 90 | long long lastTime[NUM_PCOMPONENTS]; 91 | long long sumTime[NUM_PCOMPONENTS]; 92 | }; 93 | 94 | #endif 95 | 96 | -------------------------------------------------------------------------------- /cmake.man/upload.sh.in: -------------------------------------------------------------------------------- 1 | # This script installs the man code to where it needs to go. 2 | # It also copies the color table to the correct location 3 | # There are two modes: 4 | # 1) REMOTE_INSTALLATION to a robot 5 | # 2) SIMULATOR_INSTALLATION to a local naoqi folder 6 | 7 | # Exit on error 8 | set -e 9 | # No uninitialized variables 10 | set -o nounset 11 | 12 | #CMake configured options 13 | REMOTE="${REMOTE_INSTALL}" 14 | 15 | WEBOTS="${WEBOTS_BACKEND}" 16 | ROBOT=${REMOTE_ADDRESS} 17 | 18 | if [ "$WEBOTS" = "" ]; then 19 | WEBOTS="OFF" 20 | fi 21 | 22 | NAO_CONTROLLER=projects/contests/nao_robocup/controllers/nao_soccer_player_red 23 | 24 | if [ $WEBOTS = "ON" ]; then 25 | echo "Setting local install to WEBOT" 26 | LOCAL_DEST=$WEBOTS_HOME/$NAO_CONTROLLER 27 | else 28 | LOCAL_DEST={OFFLINE_NAOQI_PATH}/modules 29 | fi 30 | 31 | COLOR_TABLE_PATH=${COLOR_TABLE} 32 | COLOR_TABLE_DIR=install/etc 33 | TABLE_STD_NAME=table.mtb 34 | 35 | if [ $REMOTE = "ON" ] && [ $WEBOTS = "OFF" ] ; then 36 | 37 | echo "Installing remotely" 38 | SRC=install/lib/* 39 | DEST=/home/nao/naoqi/lib/naoqi 40 | 41 | if [ ! -n "$ROBOT" ]; then 42 | echo "[upload.sh] Error - no remote address specified" >&2 43 | exit 1 44 | fi 45 | DEST=nao@$ROBOT:$DEST 46 | 47 | else 48 | echo "Installing locally" 49 | SRC=install/* 50 | DEST=$LOCAL_DEST 51 | 52 | fi 53 | 54 | #if [ $REMOTE != "ON" ]; then 55 | # #echo "[upload.sh] Error - remote install not specified in configuration" >&2 56 | # #exit 1 57 | # echo "No remote install" 58 | # exit 0 59 | #fi 60 | 61 | mkdir -p $COLOR_TABLE_DIR #ensure the color table directory exists 62 | echo "echo $COLOR_TABLE_PATH > $COLOR_TABLE_DIR/whichtable.txt" 63 | echo $COLOR_TABLE_PATH > $COLOR_TABLE_DIR/whichtable.txt 64 | echo "cp $COLOR_TABLE_PATH $COLOR_TABLE_DIR/$TABLE_STD_NAME" 65 | cp $COLOR_TABLE_PATH $COLOR_TABLE_DIR/$TABLE_STD_NAME 66 | 67 | echo "rsync -rcLv $SRC $DEST/" 68 | rsync -rcLv $SRC $DEST/ 69 | 70 | ETC_SRC=install/etc/* 71 | ETC_DEST=$DEST/../../etc 72 | rsync -rcLv $ETC_SRC $ETC_DEST/ 73 | #echo "scp -rv $SRC $DEST/" 74 | #scp -r $SRC $DEST/ 75 | -------------------------------------------------------------------------------- /corpus/PyLights.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | #include 22 | #include 23 | using namespace boost::python; 24 | 25 | #include 26 | 27 | #include 28 | using boost::shared_ptr; 29 | 30 | #include "PyLights.h" 31 | 32 | 33 | shared_ptr lights_pointer; 34 | 35 | void (Lights::*setRGB1)(const std::string led_id, const int rgbHex) = 36 | &Lights::setRGB; 37 | void (Lights::*setRGB2)(const unsigned int led_id, const int rgbHex) = 38 | &Lights::setRGB; 39 | 40 | BOOST_PYTHON_MODULE(_lights) 41 | { 42 | class_ >("Lights", no_init) 43 | .def("setRGB", setRGB1) 44 | .def("setRGB", setRGB2) 45 | ; 46 | 47 | scope().attr("lights") = lights_pointer; 48 | scope().attr("NUM_LED_GROUPS") = static_cast(Lights::NUM_LED_NAMES); 49 | 50 | } 51 | 52 | void c_init_lights () { 53 | if (!Py_IsInitialized()) 54 | Py_Initialize(); 55 | 56 | try { 57 | init_lights(); 58 | } catch (error_already_set) { 59 | PyErr_Print(); 60 | } 61 | 62 | } 63 | 64 | void set_lights_pointer (shared_ptr _lights_ptr) { 65 | lights_pointer = _lights_ptr; 66 | } 67 | -------------------------------------------------------------------------------- /motion/WalkingConstants.h: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | #ifndef _WalkingConstants_h_DEFINED 22 | #define _WalkingConstants_h_DEFINED 23 | 24 | #include 25 | #include 26 | #include "Kinematics.h" 27 | #include "InverseKinematics.h" 28 | 29 | #include "motionconfig.h" // for cmake set debugging flags like MOTION_DEBUG 30 | #ifdef DEBUG_MOTION 31 | # define WALK_DEBUG 32 | #endif 33 | 34 | #include "MotionConstants.h" 35 | 36 | 37 | enum SupportMode{ 38 | SUPPORTING=0, 39 | SWINGING, 40 | DOUBLE_SUPPORT, 41 | PERSISTENT_DOUBLE_SUPPORT 42 | }; 43 | 44 | static const float LARM_WALK_ANGLES[Kinematics::ARM_JOINTS] = 45 | {M_PI_FLOAT/2.0f ,.26f,0.0f,0.0f}; 46 | static const float RARM_WALK_ANGLES[Kinematics::ARM_JOINTS] = 47 | {M_PI_FLOAT/2.0f,-.26f,0.0f,0.0f}; 48 | 49 | 50 | //Sensitivity to new walk vectors -- currently 0, giving maximum sensitivity 51 | //when a new vector differs by more than these constants, the internal 52 | //walk vector held in the StepGenerator changes 53 | const float NEW_VECTOR_THRESH_MMS = 0.0f; //difference in speed in mm/second 54 | const float NEW_VECTOR_THRESH_RADS = 0.0f; //difference in speed in radians/second 55 | 56 | 57 | 58 | 59 | 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /motion/JointCommand.h: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | #ifndef _JointCommand_h_DEFINED 22 | #define _JointCommand_h_DEFINED 23 | 24 | /* 25 | * General Scripted motion class. 26 | * Implements MotionCommand. 27 | * 28 | */ 29 | 30 | #include "MotionConstants.h" 31 | #include "MotionCommand.h" 32 | #include "Kinematics.h" 33 | 34 | class JointCommand : public MotionCommand { 35 | public: 36 | JointCommand(const MotionConstants::MotionType motionType, 37 | const float _duration, 38 | const Kinematics::InterpolationType _type, 39 | const std::vector* _stiffness) 40 | : MotionCommand(motionType), 41 | duration(_duration), 42 | type(_type), 43 | stiffness(_stiffness) 44 | { } 45 | 46 | virtual ~JointCommand() { delete stiffness; }; 47 | 48 | const float getDuration() const { return duration; } 49 | const Kinematics::InterpolationType getInterpolation() const {return type;} 50 | const std::vector* getStiffness() const{ return stiffness; } 51 | virtual const std::vector* getJoints(Kinematics::ChainID chain) const = 0; 52 | 53 | 54 | protected: 55 | const float duration; 56 | const Kinematics::InterpolationType type; 57 | 58 | private: 59 | const std::vector *stiffness; 60 | }; 61 | #endif 62 | -------------------------------------------------------------------------------- /motion/debug/locus_log.R: -------------------------------------------------------------------------------- 1 | # R file to read in a debug walking output and generate pdf reports 2 | # Instructions: Install the R language (package 'r-base' in debian) 3 | # run 'make' in the terminal 4 | # Author: Johannes Strom 5 | # Date: Decemeber 2008 6 | 7 | 8 | 9 | foot_locus = function(foot){ 10 | 11 | name = paste(foot,"_locus_log",sep="") 12 | PDF = ".pdf" 13 | 14 | file = paste("/tmp/",name,".xls",sep="") 15 | if(!file.exists(file)) 16 | quit("no") 17 | dat = read.table(file,header=T,na.strings=c("-")) 18 | 19 | pdf(paste(name,"-x",PDF,sep="")) 20 | plot(dat$time,dat$goal_x,pch="",main=paste(foot,"leg","x"),xlab="s",ylab="mm") 21 | names = c("goal_x") 22 | cols = c("2") 23 | points(dat$time,dat$goal_x,type="p",col=2) 24 | legend("top",lwd=2,legend=names,col=cols) 25 | zeros = dat$time 26 | zeros[zeros > -100] = mean(dat$goal_x,na.rm=T) -1 27 | points(dat$time,zeros,pch=1,col=dat$state+2) 28 | names = c("Supporting","Swinging","Dbl Sup", "P. Dbl Sup") 29 | legend("topleft",lwd=2,legend=names,col=c(2:5)) 30 | dev.off() 31 | 32 | pdf(paste(name,"-y",PDF,sep="")) 33 | plot(dat$time,dat$goal_y,pch="",main=paste(foot,"leg"),xlab="s",ylab="mm") 34 | names = c("goal_y") 35 | cols = c("2") 36 | points(dat$time,dat$goal_y,type="p",col=2) 37 | legend("top",lwd=2,legend=names,col=cols) 38 | zeros = dat$time 39 | zeros[zeros > -100] = mean(dat$goal_y,na.rm=T) +10 40 | points(dat$time,zeros,pch=1,col=dat$state+2) 41 | names = c("Supporting","Swinging","Dbl Sup", "P. Dbl Sup") 42 | legend("topleft",lwd=2,legend=names,col=c(2:5)) 43 | dev.off() 44 | 45 | pdf(paste(name,"-z",PDF,sep="")) 46 | plot(dat$time,dat$goal_z,pch="",main=paste(foot,"leg"),xlab="s",ylab="mm") 47 | names = c("goal_z") 48 | cols = c("2") 49 | points(dat$time,dat$goal_z,type="l",col=2) 50 | legend("top",lwd=2,legend=names,col=cols) 51 | zeros = dat$time 52 | zeros[zeros > -100] = mean(dat$goal_z,na.rm=T) +5 53 | points(dat$time,zeros,pch=1,col=dat$state+2) 54 | points(dat$time,pch=1,col=dat$state+2) 55 | names = c("Supporting","Swinging","Dbl Sup", "P. Dbl Sup") 56 | legend("topleft",lwd=2,legend=names,col=c(2:5)) 57 | dev.off() 58 | } 59 | 60 | 61 | foot_locus("left") 62 | foot_locus("right") -------------------------------------------------------------------------------- /motion/debug/com_f_log.R: -------------------------------------------------------------------------------- 1 | # R file to read in a debug walking output and generate pdf reports 2 | # Instructions: Install the R language (package 'r-base' in debian) 3 | # run 'make' in the terminal 4 | # Author: Johannes Strom 5 | # Date: Decemeber 2008 6 | 7 | 8 | name = "com_f_log" 9 | PDF = ".pdf" 10 | 11 | file = paste("/tmp/",name,".xls",sep="") 12 | if(!file.exists(file)) 13 | quit("no") 14 | dat = read.table(file,header=T,na.strings=c("-")) 15 | 16 | pdf(paste(name,"-x",PDF,sep="")) 17 | plot(dat$time,dat$com_f_x,type="l",col=2,main="",xlab="s",ylab="mm") 18 | names = c("com_f_x") 19 | cols = c("2") 20 | 21 | zeros = dat$time 22 | zeros[zeros > -100] = mean(dat$com_f_x,na.rm=T) -1 23 | points(dat$time,zeros,pch=1,col=dat$state+2) 24 | 25 | legend("top",lwd=2,legend=names,col=cols) 26 | dev.off() 27 | 28 | 29 | pdf(paste(name,"-y",PDF,sep="")) 30 | plot(dat$time,dat$com_f_y,type="l",main="",col=2,xlab="s",ylab="mm") 31 | names = c("com_f_y") 32 | cols = c("2") 33 | 34 | zeros = dat$time 35 | zeros[zeros > -100] = mean(dat$com_f_y,na.rm=T) -1 36 | points(dat$time,zeros,pch=1,col=dat$state+2) 37 | 38 | legend("top",lwd=2,legend=names,col=cols) 39 | dev.off() 40 | 41 | 42 | 43 | # pdf(paste(name,"-y",PDF,sep="")) 44 | # plot(dat$time,dat$pre_y,pch="",main="",xlab="s",ylab="mm") 45 | # names = c("com_y","pre_y","zmp_y","real_com_y") 46 | # cols = c("2","3","4","5") 47 | 48 | # zeros = dat$time 49 | # zeros[zeros > -100] = mean(dat$pre_y,na.rm=T) +5 50 | # points(dat$time,zeros,pch=18,col=dat$state+2) 51 | 52 | # points(dat$time,dat$com_y,type="l",col=2) 53 | # points(dat$time,dat$pre_y,type="l",col=3) 54 | # points(dat$time,dat$zmp_y,type="l",col=4) 55 | # points(dat$time,dat$real_com_y,type="l",col=5) 56 | # legend("top",lwd=2,legend=names,col=cols) 57 | # dev.off() 58 | 59 | 60 | 61 | # pdf(paste(name,"-xy",PDF,sep="")) 62 | # plot(dat$com_x,dat$com_y,pch="",main="",xlab="s",ylab="mm") 63 | # names = c("com","pre","zmp") 64 | # cols = c("2","3","4") 65 | 66 | # points(dat$com_x,dat$com_y,type="l",col=2) 67 | # points(dat$pre_x,dat$pre_y,type="l",col=3) 68 | # points(dat$zmp_x,dat$zmp_y,type="l",col=4) 69 | # legend("top",lwd=2,legend=names,col=cols) 70 | # dev.off() 71 | -------------------------------------------------------------------------------- /motion/HeadJointCommand.h: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | #ifndef _HeadJointCommand_h_DEFINED 22 | #define _HeadJointCommand_h_DEFINED 23 | 24 | /** 25 | * Class to store joint commands specifically for the head. 26 | * Pass in a vector with target angles and the amount of time the robot needs 27 | * to take to get there. If the vector pointer is NULL, then that means we 28 | * are queueing up idle time on the head. 29 | */ 30 | 31 | #include 32 | #include 33 | 34 | #include "Kinematics.h" 35 | #include "JointCommand.h" 36 | #include "MotionConstants.h" 37 | 38 | class HeadJointCommand : public JointCommand { 39 | public: 40 | HeadJointCommand(const float time, const std::vector *joints, 41 | const std::vector *head_stiffness, 42 | const Kinematics::InterpolationType _type); 43 | HeadJointCommand(const HeadJointCommand &other); 44 | virtual ~HeadJointCommand(); 45 | 46 | virtual const std::vector* getJoints(Kinematics::ChainID chain) const { 47 | if (chain == Kinematics::HEAD_CHAIN) { 48 | return headJoints; 49 | } else { 50 | return &noJoints; 51 | } 52 | } 53 | private: 54 | const std::vector *headJoints; 55 | virtual void setChainList(); 56 | const std::vector noJoints; 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /cmake/FindBOOST_PYTHON.cmake: -------------------------------------------------------------------------------- 1 | 2 | ## 3 | # Includes 4 | ## 5 | 6 | INCLUDE( ${CMAKE_MODULE_PATH}/base_definitions.cmake ) 7 | 8 | ## 9 | # Clear variables/caches 10 | ## 11 | 12 | SET( BOOST_PYTHON_DEFINITIONS "" ) 13 | SET( BOOST_PYTHON_INCLUDE_DIR "PYTHON_INCLUDE_DIR-NOT-FOUND" CACHE FILEPATH "Cleared." FORCE) 14 | SET( BOOST_PYTHON_LIBRARIES "PYTHON_LIBRARIES-NOT-FOUND" CACHE FILEPATH "Cleared." FORCE) 15 | 16 | ## 17 | # Defined package variable 18 | ## 19 | 20 | SET( BOOST_PYTHON_LIBRARIES ${OE_CROSS_DIR}/staging/geode-linux/usr/lib/libboost_python-mt.so) 21 | SET( BOOST_PYTHON_INCLUDE_DIR ${OE_CROSS_DIR}/staging/geode-linux/usr/include) 22 | 23 | IF( BOOST_PYTHON_INCLUDE_DIR AND BOOST_PYTHON_LIBRARIES ) 24 | IF ( EXISTS BOOST_PYTHON_INCLUDE_DIR AND EXISTS BOOST_PYTHON_LIBRARIES ) 25 | SET( BOOST_PYTHON_FOUND TRUE ) 26 | ENDIF ( EXISTS BOOST_PYTHON_INCLUDE_DIR AND EXISTS BOOST_PYTHON_LIBRARIES ) 27 | ENDIF( BOOST_PYTHON_INCLUDE_DIR AND BOOST_PYTHON_LIBRARIES ) 28 | 29 | IF( NOT BOOST_PYTHON_FOUND AND BOOST_PYTHON_FIND_REQUIRED ) 30 | IF( NOT BOOST_PYTHON_INCLUDE_DIR OR NOT EXISTS ${BOOST_PYTHON_INCLUDE_DIR} ) 31 | MESSAGE( STATUS "Required include not found" ) 32 | MESSAGE( FATAL_ERROR "Could not find BOOST_PYTHON include!" ) 33 | ENDIF( NOT BOOST_PYTHON_INCLUDE_DIR OR NOT EXISTS ${BOOST_PYTHON_INCLUDE_DIR} ) 34 | IF( NOT BOOST_PYTHON_LIBRARIES OR NOT EXISTS ${BOOST_PYTHON_LIBRARIES} ) 35 | MESSAGE( STATUS "Required libraries not found" ) 36 | MESSAGE( FATAL_ERROR "Could not find BOOST_PYTHON libraries!" ) 37 | ENDIF( NOT BOOST_PYTHON_LIBRARIES OR NOT EXISTS ${BOOST_PYTHON_LIBRARIES} ) 38 | ENDIF( NOT BOOST_PYTHON_FOUND AND BOOST_PYTHON_FIND_REQUIRED ) 39 | 40 | # Finally, display informations if not in quiet mode 41 | IF( NOT BOOST_PYTHON_FIND_QUIETLY ) 42 | MESSAGE( STATUS "BOOST_PYTHON found " ) 43 | MESSAGE( STATUS " includes : ${BOOST_PYTHON_INCLUDE_DIR}" ) 44 | MESSAGE( STATUS " libraries : ${BOOST_PYTHON_LIBRARIES}" ) 45 | MESSAGE( STATUS " definitions: ${BOOST_PYTHON_DEFINITIONS}" ) 46 | ENDIF( NOT BOOST_PYTHON_FIND_QUIETLY ) 47 | 48 | 49 | 50 | MARK_AS_ADVANCED( 51 | BOOST_PYTHON_DEFINITIONS 52 | BOOST_PYTHON_INCLUDE_DIR 53 | BOOST_PYTHON_LIBRARIES 54 | ) 55 | -------------------------------------------------------------------------------- /motion/ZmpEKF.h: -------------------------------------------------------------------------------- 1 | // This file is part of Man, a robotic perception, locomotion, and 2 | // team strategy application created by the Northern Bites RoboCup 3 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 4 | // Nao robot. 5 | // 6 | // Man is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Lesser Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // Man is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Lesser Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // and the GNU Lesser Public License along with Man. If not, see 18 | // . 19 | 20 | /** 21 | * Class for filtering accelerometer values received from sensors. Extends the 22 | * abstract EKF class. 23 | */ 24 | 25 | #include "EKF.h" 26 | #include "EKFStructs.h" 27 | 28 | class ZmpEKF : public EKF 30 | { 31 | public: 32 | ZmpEKF(); 33 | virtual ~ZmpEKF(); 34 | 35 | // Update functions 36 | void update(const ZmpTimeUpdate tUp, 37 | const ZmpMeasurement zMeasure); 38 | 39 | // getters 40 | const float get_zmp_x() const { return xhat_k(0); } 41 | const float get_zmp_y() const { return xhat_k(1); } 42 | const float get_zmp_unc_x() const { return P_k(0,0); } 43 | const float get_zmp_unc_y() const { return P_k(1,1); } 44 | 45 | private: 46 | // Core functions 47 | virtual StateVector associateTimeUpdate(ZmpTimeUpdate u_k); 48 | virtual void incorporateMeasurement(ZmpMeasurement z, 49 | StateMeasurementMatrix &H_k, 50 | MeasurementMatrix &R_k, 51 | MeasurementVector &V_k); 52 | 53 | private: // Constants 54 | static const float beta; 55 | static const float gamma; 56 | }; 57 | -------------------------------------------------------------------------------- /vision/VisualRobot.cpp: -------------------------------------------------------------------------------- 1 | #include "VisualRobot.h" 2 | VisualRobot::VisualRobot() : VisualDetection() 3 | { 4 | init(); 5 | } 6 | 7 | VisualRobot::VisualRobot(const VisualRobot& o) : VisualDetection(o) {} 8 | 9 | // Initialization, happens every frame. 10 | void VisualRobot::init() 11 | { 12 | width = 0; 13 | height = 0; 14 | setX(0); 15 | setY(0); 16 | centerX = 0; 17 | centerY = 0; 18 | angleX = 0; 19 | angleY = 0; 20 | focDist = 0; 21 | setDistance(0); 22 | setBearing(0); 23 | elevation = 0; 24 | } 25 | 26 | /** 27 | * Update the robot values from the blob 28 | * 29 | * @param b The blob to update our object from. 30 | */ 31 | void VisualRobot::updateRobot(Blob b) 32 | { 33 | setLeftTopX(b.getLeftTopX()); 34 | setLeftTopY(b.getLeftTopY()); 35 | setLeftBottomX(b.getLeftBottomX()); 36 | setLeftBottomY(b.getLeftBottomY()); 37 | setRightTopX(b.getRightTopX()); 38 | setRightTopY(b.getRightTopY()); 39 | setRightBottomX(b.getRightBottomX()); 40 | setRightBottomY(b.getRightBottomY()); 41 | setX(b.getLeftTopX()); 42 | setY(b.getLeftTopY()); 43 | setWidth(dist(b.getRightTopX(), b.getRightTopY(), b.getLeftTopX(), 44 | b.getLeftTopY())); 45 | setHeight(dist(b.getLeftTopX(), b.getLeftTopY(), b.getLeftBottomX(), 46 | b.getLeftBottomY())); 47 | setCenterX(getLeftTopX() + ROUND2(getWidth() / 2)); 48 | setCenterY(getRightTopY() + ROUND2(getHeight() / 2)); 49 | setDistance(1); 50 | 51 | } 52 | 53 | /** 54 | * Calculate and set the standard deviation for the distance measurement. 55 | * Set the distance measurement. 56 | * 57 | * @param _distance the distance estimate to be set 58 | */ 59 | void VisualRobot::setDistanceWithSD(float _distance) 60 | { 61 | setDistance(_distance); 62 | setDistanceSD(robotDistanceToSD(_distance)); 63 | } 64 | 65 | /** 66 | * Calculate and set the standard deviation for the bearing measurement. 67 | * Set the bearing measurement. 68 | * 69 | * @param _bearing the distance estimate to be set 70 | */ 71 | void VisualRobot::setBearingWithSD(float _bearing) 72 | { 73 | setBearing(_bearing); 74 | setBearingSD(robotBearingToSD(_bearing)); 75 | } 76 | -------------------------------------------------------------------------------- /noggin/players/KickingHelpers.py: -------------------------------------------------------------------------------- 1 | from .. import NogginConstants 2 | import KickingConstants as constants 3 | from ..typeDefs.Location import Location 4 | 5 | def inCenterOfField(player): 6 | return NogginConstants.FIELD_HEIGHT *2/3 > player.brain.my.y > \ 7 | NogginConstants.FIELD_HEIGHT / 3 8 | 9 | def inTopOfField(player): 10 | return NogginConstants.FIELD_HEIGHT*2/3 < player.brain.my.y 11 | 12 | def inBottomOfField(player): 13 | return NogginConstants.FIELD_HEIGHT/3 > player.brain.my.y 14 | 15 | def isFacingSideline(player): 16 | h = player.brain.my.h 17 | 18 | return (inTopOfField(player) and 19 | constants.FACING_SIDELINE_ANGLE > h > 20 | 180.0 - constants.FACING_SIDELINE_ANGLE ) or \ 21 | (inBottomOfField(player) and 22 | -constants.FACING_SIDELINE_ANGLE > h > 23 | -(180 - constants.FACING_SIDELINE_ANGLE) ) 24 | 25 | def getShotCloseAimPoint(player): 26 | return Location(NogginConstants.FIELD_WIDTH, 27 | NogginConstants.MIDFIELD_Y) 28 | 29 | def getShotFarAimPoint(player): 30 | if player.brain.my.y < NogginConstants.MIDFIELD_Y: 31 | return constants.SHOOT_AT_LEFT_AIM_POINT 32 | else : 33 | return constants.SHOOT_AT_RIGHT_AIM_POINT 34 | 35 | def getKickObjective(player): 36 | """ 37 | Figure out what to do with the ball 38 | """ 39 | kickDecider = player.kickDecider 40 | avgOppGoalDist = 0.0 41 | 42 | my = player.brain.my 43 | 44 | if not player.hasKickedOffKick: 45 | return constants.OBJECTIVE_KICKOFF 46 | 47 | if my.x < NogginConstants.FIELD_WIDTH / 2: 48 | return constants.OBJECTIVE_CLEAR 49 | 50 | elif my.dist( Location(NogginConstants.OPP_GOALBOX_RIGHT_X, 51 | NogginConstants.OPP_GOALBOX_MIDDLE_Y )) > \ 52 | NogginConstants.FIELD_WIDTH / 3 : 53 | return constants.OBJECTIVE_CENTER 54 | 55 | elif my.x > NogginConstants.FIELD_WIDTH * 3/4 and \ 56 | NogginConstants.FIELD_HEIGHT/4. < my.y < \ 57 | NogginConstants.FIELD_HEIGHT * 3./4.: 58 | return constants.OBJECTIVE_SHOOT_CLOSE 59 | 60 | else : 61 | return constants.OBJECTIVE_SHOOT_FAR 62 | 63 | -------------------------------------------------------------------------------- /noggin/typeDefs/VisualObject.py: -------------------------------------------------------------------------------- 1 | from .. import NogginConstants as Constants 2 | from .Location import Location 3 | 4 | class VisualObject(Location): 5 | """VisualObject is a class for all objects that need general vision information 6 | in python. the fields common to all are centerX, centerY, width, height, focDist, 7 | dist, bearing 8 | """ 9 | def __init__(self): 10 | Location.__init__(self, 0,0,0) 11 | self.centerX = 0 12 | self.centerY = 0 13 | self.width = 0 14 | self.height = 0 15 | self.focDist = 0 16 | self.dist = 0 17 | self.bearing = 0 18 | self.framesOn = 0 19 | self.framesOff = 0 20 | self.on = False 21 | 22 | def updateVision(self, visionInfos): 23 | self.centerX = visionInfos.centerX 24 | self.centerY = visionInfos.centerY 25 | self.width = visionInfos.width 26 | self.height = visionInfos.height 27 | self.focDist = visionInfos.focDist 28 | self.dist = visionInfos.dist 29 | self.bearing = visionInfos.bearing 30 | 31 | # obj is in this frame 32 | if self.dist > 0: 33 | self.on = True 34 | self.framesOn += 1 35 | self.framesOff = 0 36 | # set angleX, angleY so that we don't create c->python object overhead 37 | self.angleX = (((Constants.IMAGE_WIDTH/2.-1) - self.centerX)/ 38 | Constants.IMAGE_ANGLE_X) 39 | self.angleY = (((Constants.IMAGE_HEIGHT/2.-1) - self.centerY)/ 40 | Constants.IMAGE_ANGLE_Y) 41 | # obj not in this frame 42 | else: 43 | self.on = False 44 | self.framesOff += 1 45 | self.framesOn = 0 46 | 47 | def __str__(self): 48 | """returns string with all class variables""" 49 | return ("dist: %g bearing: %g center: ""(%d,%d) w/h: %g/%g aX/aY: %g/%g \ 50 | framesOn: %d framesOff: %d on: %s " % 51 | (self.dist, self.bearing, 52 | self.centerX, self.centerY, 53 | self.width, self.height, 54 | self.angleX, self.angleY, 55 | self.framesOn, self.framesOff, self.on) ) 56 | -------------------------------------------------------------------------------- /noggin/typeDefs/Play.py: -------------------------------------------------------------------------------- 1 | from ..playbook.PBConstants import (INIT_STRATEGY, 2 | INIT_FORMATION, 3 | INIT_ROLE, 4 | INIT_SUB_ROLE, 5 | STRATEGIES, 6 | FORMATIONS, 7 | ROLES, 8 | SUB_ROLES) 9 | 10 | class Play: 11 | def __init__(self, 12 | strategy = INIT_STRATEGY, 13 | formation = INIT_FORMATION, 14 | role = INIT_ROLE, 15 | subRole = INIT_SUB_ROLE, 16 | position = [0,0] 17 | ): 18 | self.strategy = strategy 19 | self.formation = formation 20 | self.role = role 21 | self.subRole = subRole 22 | self.position = position 23 | 24 | def setStrategy(self, strategy): 25 | self.strategy = strategy 26 | 27 | def setFormation(self, formation): 28 | self.formation = formation 29 | 30 | def setRole(self, role): 31 | self.role = role 32 | 33 | def setSubRole(self, subRole): 34 | self.subRole = subRole 35 | 36 | def setPosition(self, position): 37 | self.position = position 38 | 39 | def isSubRole(self, subRoleToTest): 40 | return (self.subRole == subRoleToTest) 41 | 42 | def isRole(self, roleToTest): 43 | return (self.role == roleToTest) 44 | 45 | def getPosition(self): 46 | return self.position 47 | 48 | def equals(self, otherPlay): 49 | '''compares two plays for equality by value''' 50 | if( ( self.subRole != otherPlay.subRole ) or 51 | ( self.role != otherPlay.role ) or 52 | ( self.formation != otherPlay.formation ) or 53 | ( self.strategy != otherPlay.strategy ) ): 54 | return False 55 | 56 | else: 57 | return True 58 | 59 | def __str__(self): 60 | return ("Strategy: " + STRATEGIES[self.strategy] + 61 | " Formation: " + FORMATIONS[self.formation] + 62 | " Role:" + ROLES[self.role] + 63 | " SubRole:" + SUB_ROLES[self.subRole]) 64 | -------------------------------------------------------------------------------- /include/Common.h: -------------------------------------------------------------------------------- 1 | /* 2 | *Constants for the most basic of things (and things that don't fit elsewhere) 3 | */ 4 | 5 | #ifndef Common_h_DEFINED 6 | #define Common_h_DEFINED 7 | 8 | #include // for PI 9 | #include "NBMath.h" 10 | 11 | // ROBOT TYPES 12 | #define NAO_RL 3 13 | #define NAO_SIM 4 14 | #define NAO 5 15 | #ifndef ROBOT_TYPE 16 | # define ROBOT_TYPE NAO_RL 17 | #endif 18 | #define ROBOT(t) ( \ 19 | (t == NAO_RL && ROBOT_TYPE == NAO_RL) || \ 20 | (t == NAO_SIM && ROBOT_TYPE == NAO_SIM) || \ 21 | (t == NAO && \ 22 | (ROBOT_TYPE == NAO_RL || ROBOT_TYPE == NAO_SIM) ) \ 23 | ) 24 | 25 | #ifndef NUM_PLAYERS_PER_TEAM 26 | # define NUM_PLAYERS_PER_TEAM 4 27 | #endif 28 | 29 | // game controller constants for structure information 30 | #define GAME_CONTROLLER_LIST_SIZE 11 31 | #define GAME_CONTROLLER_TEAMS_LIST_SIZE 2 32 | #define GAME_CONTROLLER_TEAM_LIST_SIZE 4 33 | #define GAME_CONTROLLER_PLAYERS_LIST_SIZE NUM_PLAYERS_PER_TEAM 34 | 35 | 36 | // 37 | // Define oft-used short-hand or clarifying user-defined types 38 | 39 | #ifndef true 40 | # define true 1 41 | # define false 0 42 | #endif 43 | 44 | #ifndef byte 45 | typedef unsigned char byte; 46 | #endif 47 | 48 | #include 49 | #ifndef _WIN32 50 | #include 51 | #else 52 | #include 53 | #endif 54 | static const long long MICROS_PER_SECOND = 1000000; 55 | 56 | const static float MOTION_FRAME_LENGTH_S = 0.01f; 57 | // 1 second * 1000 ms/s * 1000 us/ms 58 | const float MOTION_FRAME_LENGTH_uS = 1000.0f * 1000.0f * MOTION_FRAME_LENGTH_S; 59 | const float MOTION_FRAME_RATE = 1.0f / MOTION_FRAME_LENGTH_S; 60 | 61 | 62 | static long long micro_time (void) 63 | { 64 | #ifndef _WIN32 65 | // Needed for microseconds which we convert to milliseconds 66 | struct timeval tv; 67 | gettimeofday(&tv, NULL); 68 | 69 | return tv.tv_sec * MICROS_PER_SECOND + tv.tv_usec; 70 | #else 71 | _timeb timebuffer; 72 | time_t secondsSince1970; 73 | unsigned short millis; 74 | 75 | _ftime64_s( &timebuffer); 76 | secondsSince1970 = timebuffer.time; 77 | millis = timebuffer.millitm; 78 | return (secondsSince1970 * 1000ul + millis) * 1000ul; 79 | #endif 80 | } 81 | 82 | #endif // Common_h_DEFINED 83 | 84 | -------------------------------------------------------------------------------- /motion/SetHeadCommand.h: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Man, a robotic perception, locomotion, and 3 | // team strategy application created by the Northern Bites RoboCup 4 | // team of Bowdoin College in Brunswick, Maine, for the Aldebaran 5 | // Nao robot. 6 | // 7 | // Man is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Lesser Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | // 12 | // Man is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Lesser Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // and the GNU Lesser Public License along with Man. If not, see 19 | // . 20 | 21 | #ifndef _SetHeadCommand_h_DEFINED 22 | #define _SetHeadCommand_h_DEFINED 23 | 24 | #include "Kinematics.h" 25 | 26 | class SetHeadCommand : public MotionCommand 27 | { 28 | public: 29 | SetHeadCommand(const float _yaw, const float _pitch, 30 | const float _maxSpeedYaw = Kinematics::jointsMaxVelNominal[Kinematics::HEAD_YAW], 31 | const float _maxSpeedPitch = Kinematics::jointsMaxVelNominal[Kinematics::HEAD_PITCH] 32 | ) 33 | : MotionCommand(MotionConstants::SET_HEAD), 34 | yaw(_yaw),pitch(_pitch), 35 | maxSpeedYaw(_maxSpeedYaw),maxSpeedPitch(_maxSpeedPitch) 36 | { 37 | setChainList(); 38 | } 39 | const float getYaw() const {return yaw;} 40 | const float getPitch() const {return pitch;} 41 | const float getMaxSpeedYaw() const {return maxSpeedYaw; } 42 | const float getMaxSpeedPitch() const {return maxSpeedPitch; } 43 | private: 44 | virtual void setChainList() { 45 | chainList.insert(chainList.end(), 46 | MotionConstants::HEAD_JOINT_CHAINS, 47 | MotionConstants::HEAD_JOINT_CHAINS 48 | + MotionConstants::HEAD_JOINT_NUM_CHAINS); 49 | } 50 | private: 51 | const float yaw,pitch; 52 | const float maxSpeedYaw,maxSpeedPitch; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /noggin/FallController.py: -------------------------------------------------------------------------------- 1 | from man.motion import SweetMoves as SweetMoves 2 | from . import FallStates 3 | from .util import FSA 4 | 5 | class FallController(FSA.FSA): 6 | def __init__(self, brain): 7 | FSA.FSA.__init__(self,brain) 8 | self.brain = brain 9 | self.addStates(FallStates) 10 | self.currentState = 'notFallen' 11 | self.setName('FallController') 12 | self.setPrintStateChanges(True) 13 | self.stateChangeColor = 'blue' 14 | self.setPrintFunction(self.brain.out.printf) 15 | self.standingUp = False 16 | self.fallCount = 0 17 | self.FALLEN_THRESH = 72 18 | self.FALL_COUNT_THRESH = 15 19 | self.doneStandingCount = 0 20 | self.DONE_STANDING_THRESH = 2 21 | self.standupMoveTime = 0 22 | 23 | def run(self): 24 | # Only try to stand up when playing or localizing in ready 25 | if (self.brain.gameController.currentState == 'gamePlaying' or 26 | self.brain.gameController.currentState == 'gameReady' ): 27 | # Check to see if fallen over 28 | inertial = self.brain.sensors.inertial 29 | #self.printf("run angleY is "+str(inertial.angleY)) 30 | 31 | if (not self.standingUp and self.isFallen() ): 32 | self.standingUp = True 33 | self.fallCount = 0 34 | self.switchTo('fallen') 35 | # elif self.brain.guardian.falling: 36 | # self.switchTo('falling') 37 | FSA.FSA.run(self) 38 | 39 | def isFallen(self): 40 | inertial = self.brain.sensors.inertial 41 | #self.printf("isFallen angleY is "+str(inertial.angleY)) 42 | if ( abs(inertial.angleY) > self.FALLEN_THRESH ): 43 | self.fallCount += 1 44 | if self.fallCount > self.FALL_COUNT_THRESH: 45 | return True 46 | else: 47 | self.fallCount = 0 48 | return False 49 | 50 | return False 51 | 52 | def getTimeRemainingEst(self): 53 | if (self.currentState == "notFallen" or 54 | self.currentState == "doneStanding"): 55 | return 0 56 | else: 57 | return SweetMoves.getMoveTime(SweetMoves.STAND_UP_FRONT) 58 | -------------------------------------------------------------------------------- /noggin/LocSystem.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Defines an interface for a localization system. Current implementing classes 3 | * are LocEKF and MCL 4 | * 5 | * @author Tucker Hermans 6 | */ 7 | 8 | #ifndef LocSystem_h_DEFINED 9 | #define LocSystem_h_DEFINED 10 | #include 11 | #include "NogginStructs.h" 12 | #include "Observation.h" 13 | 14 | class LocSystem 15 | { 16 | public: 17 | virtual ~LocSystem() {}; 18 | // Core Functions 19 | virtual void updateLocalization(MotionModel u_t, 20 | std::vector z_t) = 0; 21 | virtual void reset() = 0; 22 | // These should be made pure virtual and the implementing MCL class should 23 | // be forced to implement them 24 | virtual void blueGoalieReset() {} 25 | virtual void redGoalieReset() {} 26 | 27 | // Getters 28 | virtual const PoseEst getCurrentEstimate() const = 0; 29 | virtual const PoseEst getCurrentUncertainty() const = 0; 30 | virtual const float getXEst() const = 0; 31 | virtual const float getYEst() const = 0; 32 | virtual const float getHEst() const = 0; 33 | virtual const float getHEstDeg() const = 0; 34 | virtual const float getXUncert() const = 0; 35 | virtual const float getYUncert() const = 0; 36 | virtual const float getHUncert() const = 0; 37 | virtual const float getHUncertDeg() const = 0; 38 | virtual const MotionModel getLastOdo() const = 0; 39 | virtual const vector getLastObservations() const = 0; 40 | 41 | // Setters 42 | virtual void setXEst(float xEst) = 0; 43 | virtual void setYEst(float yEst) = 0; 44 | virtual void setHEst(float hEst) = 0; 45 | virtual void setXUncert(float uncertX) = 0; 46 | virtual void setYUncert(float uncertY) = 0; 47 | virtual void setHUncert(float uncertH) = 0; 48 | 49 | friend std::ostream& operator<< (std::ostream &o, 50 | const LocSystem &c) { 51 | return o << "Est: (" << c.getXEst() << ", " << c.getYEst() << ", " 52 | << c.getHEst() << ")\t" 53 | << "Uncert: (" << c.getXUncert() << ", " << c.getYUncert() 54 | << ", " 55 | << c.getHUncert() << ")"; 56 | 57 | } 58 | }; 59 | 60 | #endif // LocSystem_h_DEFINED 61 | --------------------------------------------------------------------------------