*ET¥í¥Ü¥³¥ó ¥·¥ß¥å¥ì¡¼¥¿ [#z2ede221] ¼«ºî ET¥í¥Ü¥³¥ó ¥·¥ß¥å¥ì¡¼¥¿ ¤Î³«È¯Æüµ ·ó ET¥í¥Ü¥³¥ó»²Àïµ ·ó È÷˺Ͽ~ ¡ÚÌÜŪ¡Û ¥¤¥ó¥¿¥Õ¥§¡¼¥¹¶¦Ä̲½¤Ë¤è¤êPC¾å¤ÇPathfinder¤ÎÁö¹Ô¥¢¥ë¥´¥ê¥º¥à¤ò³Îǧ¤Ç¤¤ë¤è¤¦¤Ë¤¹¤ë¡£¡Ê¤³¤Î¥Ú¡¼¥¸²¼Éô¤Ë¥³¡¼¥ÉÎã·ÇºÜ)~ ~ ¡Ú³«È¯¥Õ¥í¡¼¡Û ¥·¥ß¥å¥ì¡¼¥¿¤Ç¥¢¥ë¥´¥ê¥º¥à¤Î´ðÁø¡Æ¤¢ª¼Âµ¡¤Ç¥Á¥å¡¼¥Ë¥ó¥°¡¡¤Îή¤ì¤Ç³Ú¤·¤¯³«È¯¢ö~ ~ ¡Ú¥¹¥Ú¥Ã¥¯¡Û ±¿Æ°³Ø¡§2ÎØ¥â¥Ç¥ë¡¢BRICK¡§LEGO Mindstorm(RCX)¡¢½ï¸µÃÍ¡§RCX¥Ù¡¼¥¹¤Î¥Ñ¥¹¥Õ¥¡¥¤¥ó¥À¡¼¤«¤é¼Â¬¡¢2Dɽ¼¨¥â¡¼¥É¡¦3Dɽ¼¨¥â¡¼¥É¡¢¼Â»þ´Ö¥·¥ß¥å¥ì¡¼¥·¥ç¥ó²Äǽ¡¢ET¥í¥Ü¥³¥ó 2007Âбþ ¡ÚÆ°²è¡Û -¥·¥ß¥å¥ì¡¼¥¿¡¼Æ°ºî²èÌÌ¡ÊBGM¤¢¤ê¡Ë~ #youtube_big(U2Wmjv24hbQ) #youtube_big(rhE9s7tCPP4) ~ ~ -¼ç´Ñ¥Ó¥å¡¼¡ÊBGM¤¢¤ê¡Ë~ #youtube_big(nepdFs-2V1Y) ¤½¤Î¸å RCX¤«¤éNXT¤ËÊѤï¤Ã¤Æ¡¢º£¤ÏEV3¤Ê¤ó¤Ç¤¹¤Ã¤Æ¤Í¡£(2016Äɵ) -¥·¥ß¥å¥ì¡¼¥¿¡¼¤ÈƱ¤¸¥¢¥ë¥´¥ê¥º¥à¤ÇÆ°¤¤¤Æ¤¤¤ë¼Âµ¡~ #youtube_big(-WS6tBwbS8w) ~ ~ *¥·¥ß¥å¥ì¡¼¥¿¡¼À©ºîÆüµ [#p3c652e5] -¥Á¡¼¥à¹çή¤«¤é¥·¥ß¥å¥ì¡¼¥¿´°À®¤Þ¤Ç¡¢20Âå¸åȾ¡¢Ë¿²ÈÅť᡼¥«¡¼¥¨¥ó¥¸¥Ë¥¢Misawa¤Î3¥«·î¤Îµ°À×~ [[''¥·¥ß¥å¥ì¡¼¥¿¡¼À©ºîÆüµ''>Æüµ/20070406]] *¥·¥ß¥å¥ì¡¼¥¿¡¼»È¤¤Êý [#w82e0a0f] -¥³¡¼¥¹²èÁü¤ò½àÈ÷¤¹¤ë¡£~ -Áö¹Ô¥í¥¸¥Ã¥¯¤ò½ñ¤¯¡£¥é¥Ã¥Ñ¡¼(¥¤¥ó¥¿¥Õ¥§¡¼¥¹)¤ò¤¿¤¿¤¯¤À¤±¤ÇOK~ --CPU Core2Duo°Ê¾å¡¢DirectX9¡ÁÂбþ¥°¥é¥Ü¤Ê¤é3Dɽ¼¨¤·¤Æ¤â¼Â»þ´Ö¼Â¹Ô²Äǽ~ ¡¡Î¥»¶²½ùt¤ÎÃͤòÂ礤¯¤¹¤ì¤Ð¡¢·×»»¤Ï¹Ó¤¯¤Ê¤ë¤¬ÃÙ¤¤PC¤Ç¤â¥µ¥¯¥µ¥¯Æ°¤¯¤Ï¤º¡£~ -¥³¡¼¥¹¾å¤Î»ØÄꤷ¤¿ºÂɸ¤ËPathfinder¤òÇÛÃÖ¤·¤Æ¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¥¹¥¿¡¼¥È~ **¥¤¥ó¥¿¥Õ¥§¡¼¥¹ [#y0028abe] -BrickOSWrapper.h~ ¡¡¼Âµ¡¤È¥·¥ß¥å¥ì¡¼¥¿¤Ç¤³¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤ò¶¦Ä̲½ #pragma once #include <vcclr.h> namespace BrickOSWrapper{ class PathFinder{ private: static gcroot<Misawat::Etrobo::Simulator::PathFinder*> _pathFinder; public: static void Set( Misawat::Etrobo::Simulator::PathFinder* pathFinder ){ _pathFinder = pathFinder; } static Misawat::Etrobo::Simulator::PathFinder* pathFinder(){ return _pathFinder; } }; class LightSensorWrapper{ private: gcroot<Misawat::Etrobo::Simulator::LightSensor*> _lightSensor; public: LightSensorWrapper(){ _lightSensor = PathFinder::pathFinder()->GetLightSensor(); } unsigned int get() const{ return _lightSensor->Get(); } }; class TractionMotorWrapper{ private: gcroot<Misawat::Etrobo::Simulator::Motor*> _tractionMotor; public: TractionMotorWrapper(){ _tractionMotor = PathFinder::pathFinder()->GetTractionMotor(); } void Forward( unsigned char s ) const{ _tractionMotor->Foward(s); } void Reverse( unsigned char s ) const{ _tractionMotor->Reverse(s); } }; class SteeringMotorWrapper{ private: gcroot<Misawat::Etrobo::Simulator::Motor*> _steeringMotor; public: SteeringMotorWrapper(){ _steeringMotor = PathFinder::pathFinder()->GetSteeringMotor(); } void Forward( unsigned char s ) const{ _steeringMotor->Foward(s); } void Reverse( unsigned char s ) const{ _steeringMotor->Reverse(s); } }; }; **Áö¹Ô¥í¥¸¥Ã¥¯¡Ê¥¢¥ë¥´¥ê¥º¥à¡Ë¥¯¥é¥¹¤ÎÎã [#udd3de67] -RunningMethodManager.cpp~ Áö¹Ô¥í¥¸¥Ã¥¯¤Î¥Þ¥Í¡¼¥¸¥ã #include "StdAfx.h" #include "RunningMethodManager.h" // Normal #include "RunningMethod_Normal.h" RunningMethod::Normal* iRunningMethodNormal; // TODO-start: ¤³¤³¤Ë³Æ¼«¤ÎRunngingMethod¥¯¥é¥¹¤òÄɲà // #include "RunningMethod_XXX.h" // iRunningMethodXXX* iRunningMethodXXX; // TODO-end: RunningMethodManager::RunningMethodManager() { // ¸÷¥»¥ó¥µ¡¼ÃÍÍúÎò´ÉÍý¥â¥¸¥å¡¼¥ëÀ¸À® iLightValueHistory = new Common::LightValueHistory(); iRunningMethodNormal = new RunningMethod::Normal(); // TODO-start: ¤³¤³¤Ë³Æ¼«¤ÎRunngingMethod¥¯¥é¥¹¤òÄɲà // iRunningMethodXXX = new iRunningMethodXXX(); // TODO-end: // ïçÃÍÀßÄê Common::LightValueHistory::setThreshold( 100,0, 50 ); } RunningMethodManager::~RunningMethodManager() { } int RunningMethodManager::StartRunning() { bool courseDetection = false; unsigned int latestValue = 0; // ¸÷¥»¥ó¥µ¡¼Ã͹¹¿· iLightValueHistory->UpdateLightValueHistory(&latestValue); // ¥³¡¼¥¹È½ÊÌ // TODO-start: ¤³¤³¤Ë³Æ¼«¤ÎRunngingMethod¥¯¥é¥¹¤òÄɲà // courseDetection = iRunningMethodXXX->DetectCourse(iLightValueHistory); // if(true == courseDetection){ // iRunningMethodXXX->Run(); // } // TODO-end: courseDetection = iRunningMethodNormal->DetectCourse(iLightValueHistory); if(true == courseDetection){ iRunningMethodNormal->Run(); } return 1; } int RunningMethodManager::StopRunning() { return 1; } -RunningMethod_Normal.cpp~ ¡¡¾õ¶·¤´¤È¤ÎÁö¹Ô¥í¥¸¥Ã¥¯¡ÊÊ£¿ôÍÑ°Õ¤·¤Æ¤â¡¢£±¤Ä¤Ç¤â£Ï£Ë¡Ë //============================================================================== // - ̾Á°: Ä̾ïÁö¹Ô // - µ¡Ç½: Æñ½ê¤Ê¤É¤ò´Þ¤Þ¤Ê¤¤Ä̾ï¤Î¥«¡¼¥Ö¡¦Ä¾Àþ¤òÁö¤ë¥í¥¸¥Ã¥¯¤ò»ý¤Ä¡£ // - ³¥¿§¸¡½Ð¤Î¤¿¤á¥³¡¼¥¹¤Î³°Â¦¤ò¥¨¥Ã¥¸Áö¹Ô¤¹¤ë¡£ // ¤Ä¤Þ¤ê¡¢¹õ¡§±¦¡¢Çò¡§º¸¤Ë¥¹¥Æ¥¢¥ê¥ó¥°¤òÀڤ롣 // - °ìÄê³ÑÅٰʾ她¥Æ¥¢¥ê¥ó¥°¤ò¤¤é¤Ê¤¤¤è¤¦¤Ë¥ê¥ß¥Ã¥È¤òÀߤ±¤ë¡£ //============================================================================== #include "stdafx.h" #include "RunningMethod_Normal.h" using namespace Common; using namespace BrickOSWrapper; using namespace RunningMethod; #define ABS(x) (0<(x)?(x):-(x)) Normal::Normal() : _currentDirection( DirectionRight ), _counter( 0 ) { COUNTER_MAX = 100; STEERING_SPEED = 255 / (LIGHT_HISTORY_MAX / 2); } Normal::~Normal() { } int Normal::Run() { _tractionMotor.Forward(100); if( _lightValueHistory->isWhite( _lightSensor.get() ) ){ Left(); }else{ Right(); } return 0; } void Normal::Right() { Count( DirectionRight ); _steeringMotor.Forward( GetSpeed() ); } void Normal::Left() { Count( DirectionLeft ); _steeringMotor.Reverse( GetSpeed() ); } void Normal::Count( Direction direction ) { if( _currentDirection!=direction ){ _counter = 0; } else{ _counter ++; } _currentDirection = direction; } unsigned char Normal::GetSpeed() { if( _counter < COUNTER_MAX ){ return GetSpeedFromHistory(); } else{ // ¥¹¥Æ¥¢¥ê¥ó¥°¤¤ê¤¹¤®ËÉ»ß return 0; } } unsigned char Normal::GetSpeedFromHistory() { // Çò¹õ¤Î³ä¹ç¤Ë¤è¤Ã¤Æ¡¢¥¹¥Æ¥¢¥ê¥ó¥°¥¹¥Ô¡¼¥É¤ÎÊѹ¹ return ABS(_lightValueHistory->GetWhiteRate()-LIGHT_HISTORY_MAX/2) * STEERING_SPEED; } bool Normal::DetectCourse(Common::LightValueHistory* lightValueHistory) { // run¤Ç»ÈÍѤ¹¤ë¤Î¤Ç¥Ý¥¤¥ó¥¿¤òÊÝ»ý _lightValueHistory = lightValueHistory; // Ä̾ïÁö¹Ô¤Ê¤Î¤Çɬ¤ºtrue¤òÊÖ¤¹ return true; } *ET¥í¥Ü¥³¥ó2007´ØÅìÂç²ñ ͽÁª²ñ¤Ë½Ð¾ì¤·¤Þ¤·¤¿ [#hfdcdc20] #ref(yosen.png,nolink); -''[[''ET¥í¥Ü¥³¥óÅöÆü¥ì¥Ý¡¼¥È¡¡¤½¤Î£±''>Æüµ/20070630]]''~ -''[[''ET¥í¥Ü¥³¥óÅöÆü¥ì¥Ý¡¼¥È¡¡¤½¤Î£²''>Æüµ/20070701]]''~ -''[[''ET¥í¥Ü¥³¥óÅöÆü¥ì¥Ý¡¼¥È¡¡¤½¤Î£³''>Æüµ/20070702]]''~ ~ *º£¸å¤ÎŸ˾ [#t7d1b664] -¤Ò¤È¤Þ¤º£±²ó½Ð¾ì¤Ç¤¤¿¤À¤±¤ÇËþÂ~ -UML¤ò¤Ä¤«¤Ã¤¿¥Ç¥¶¥¤¥ó¤òÌÜŪ¤È¤·¤Æ¤¤¤ë¤±¤ÉÁö¹ÔÂΤζ¥Áö¤ß¤¿¤¤¤Ê¦Ì̤⤢¤ë¤«¤é¡¢º£¸å¤ÏÀ©¸æ¤Ç¾¡É顪¤ß¤¿¤¤¤Ê¥Á¡¼¥à¤â¤â¤Ã¤È½Ð¤Æ¤¯¤ë¤ó¤¸¤ã¤Ê¤¤¤Ç¤·¤ç¤¦¤«¡£¤½¤·¤ÆPID¤«¤é¤Ï¤¸¤Þ¤ê¡¢¥Þ¥¤¥¯¥í¥Þ¥¦¥¹¤Î¤è¤¦¤Ê¾¢¤ÎÀ¤³¦¤Ë¤Ê¤Ã¤Æ¤¤¤¯¤Î¤À¤í¤¦¤«¡£~ *¥·¥ß¥å¥ì¡¼¥¿³«È¯¾õ¶·¡¦¹¹¿·ÍúÎò [#t7c3b6ba] ~ -''2007.06.30:''ET¥í¥Ü¥³¥ó´ØÅìÂç²ñͽÁª²ñ¤Ç3D¥·¥ß¥å¥ì¡¼¥¿¤ò¾Ò²ð¡£É¾È½¤Ï¾å¡¹^o^~ -''2012.10.10:''Visual Studio 2010¤Ç¥Ó¥ë¥É/¼Â¹Ô¤Ç¤¤ë¤³¤È¤ò³Îǧ~ --COM Interop¥é¥Ã¥Ñ¡¼¤ÎÅÔ¹ç¾å¡¢32bitÍѤǥӥë¥É¤¹¤ëɬÍפ¢¤ê¡£~ --¥Ó¥ë¥É¡ä¹½À®¥Þ¥Í¡¼¥¸¥ã¡¼¡ä¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Ëx86¤òÄɲÃ~ ~ -''2016.10.16:''¥½¡¼¥¹¤òVisual Studio Community 2015¤Ç¥Ó¥ë¥É¤Ç¤¤Ê¤¤¤³¤È¤ò³Îǧ¡Ê¤¢¤ì¤Þ¡Ë~ -''2016.10.16:''³Æ¼ïÆ°²è¤ò¼«¥µ¡¼¥Ð¡¼¢ªYoutube¤Ø~ ~ ~ ~ //*contact [#h216589c] //¤³¤Î¥µ¥¤¥È¤Ë·ÇºÜ¤µ¤ì¤Æ¤¤¤ë¾ðÊó¤Ë´Ø¤¹¤ë¤´°Õ¸«¡¦¤´´¶ÁÛ¡¦¤ªÌ䤤¹ç¤ï¤»¤Ï¡¢ //#ref(mailto.png,nolink); //¤Þ¤Ç¤É¤¦¤¾¡£~ //*À©ºîÆüµ [#ie4c15c2] //#ls2(Æüµ/,reverse,title) //#ls2(Æüµ/,title) //#calendar2(Æüµ)