From: <sgv...@us...> - 2009-04-30 16:03:50
|
Revision: 62 http://simspark.svn.sourceforge.net/simspark/?rev=62&view=rev Author: sgvandijk Date: 2009-04-30 16:03:43 +0000 (Thu, 30 Apr 2009) Log Message: ----------- - add camera controls to external monitor Modified Paths: -------------- trunk/rcssserver3d/ChangeLog trunk/rcssserver3d/plugin/soccermonitor/soccerinputlogplayer.cpp trunk/rcssserver3d/plugin/soccermonitor/soccerinputlogplayer.h trunk/rcssserver3d/rcssmonitor3d/soccerbindings.rb Modified: trunk/rcssserver3d/ChangeLog =================================================================== --- trunk/rcssserver3d/ChangeLog 2009-04-30 13:26:16 UTC (rev 61) +++ trunk/rcssserver3d/ChangeLog 2009-04-30 16:03:43 UTC (rev 62) @@ -1,3 +1,13 @@ +2009-04-30 Sander van Dijk <sgv...@gm...> + + * rcssmonitor3d/rcssmonitor3d.rb + - set camera parameters to those used in internal monitor + + * plugin/soccermonitor/soccerinputlogplayer.h + * plugin/soccermonitor/soccerinputlogplayer.cpp + * rcssmonitor3d/soccerbindings.rb + - add camera controls to external monitor + 2009-04-08 Hedayat Vatankhah <he...@gr...> * plugin/soccer/beameffector/beamaction.h (BeamAction): @@ -99,4 +109,4 @@ * plugin/soccer/restrictedvisionperceptor/restrictedvisionperceptor.cpp: * plugin/soccer/agentstateperceptor/agentstateperceptor.cpp: - Replaced make_shared() with .lock() function call.(fixed compilation - error with recent boost versions.) \ No newline at end of file + error with recent boost versions.) Modified: trunk/rcssserver3d/plugin/soccermonitor/soccerinputlogplayer.cpp =================================================================== --- trunk/rcssserver3d/plugin/soccermonitor/soccerinputlogplayer.cpp 2009-04-30 13:26:16 UTC (rev 61) +++ trunk/rcssserver3d/plugin/soccermonitor/soccerinputlogplayer.cpp 2009-04-30 16:03:43 UTC (rev 62) @@ -20,6 +20,7 @@ #include "soccerinputlogplayer.h" #include <zeitgeist/scriptserver/scriptserver.h> #include <zeitgeist/logserver/logserver.h> +#include <oxygen/physicsserver/body.h> using namespace boost; using namespace zeitgeist; @@ -42,6 +43,14 @@ mScriptServer->CreateVariable("Command.StepBackward", CmdStepBackward); mScriptServer->CreateVariable("Command.BPlayback", CmdBPlayback); + mScriptServer->CreateVariable("Command.CameraLeftGoal", CmdCameraLeftGoal); + mScriptServer->CreateVariable("Command.CameraLeftCorner", CmdCameraLeftCorner); + mScriptServer->CreateVariable("Command.CameraMiddleLeft", CmdCameraMiddleLeft); + mScriptServer->CreateVariable("Command.CameraMiddleRight", CmdCameraMiddleRight); + mScriptServer->CreateVariable("Command.CameraMiddle", CmdCameraMiddle); + mScriptServer->CreateVariable("Command.CameraRightCorner", CmdCameraRightCorner); + mScriptServer->CreateVariable("Command.CameraRightGoal", CmdCameraRightGoal); + mMonitorClient = shared_dynamic_cast<SimControlNode> (GetCore()->Get("/sys/server/simulation/SparkMonitorLogFileServer")); @@ -51,6 +60,26 @@ << "ERROR: (SoccerInput) Unable to get SparkMonitorClient\n"; } + // get fps controller + mFPS = shared_dynamic_cast<FPSController> + (GetCore()->Get("/usr/scene/camera/physics/controller")); + + if (mFPS.get() == 0) + { + GetLog()->Error() + << "ERROR: (InternalSoccerInput) Unable to get FPS controller\n"; + } + + // get camera body + mCameraBody = shared_dynamic_cast<Body> + (GetCore()->Get("/usr/scene/camera/physics")); + + if (mCameraBody.get() == 0) + { + GetLog()->Error() + << "ERROR: (SoccerInput) Unable to get camera body\n"; + } + } void SoccerInputLogPlayer::OnUnlink() @@ -108,5 +137,68 @@ mScriptServer->Eval("monitorLogServer.playBackward()"); } break; + case CmdCameraLeftGoal: + if (input.GetKeyPress()) + { + salt::Vector3f pos(-12*0.8, 0.0, 12*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(90); + mFPS->SetVAngleDeg(35); + } + break; + case CmdCameraLeftCorner: + if (input.GetKeyPress()) + { + salt::Vector3f pos(-12*0.8, -8, 12*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(50); + mFPS->SetVAngleDeg(30); + } + break; + case CmdCameraMiddleLeft: + if (input.GetKeyPress()) + { + salt::Vector3f pos(0, -8, 12*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(salt::gRadToDeg(-0.625)); + mFPS->SetVAngleDeg(40); + } + break; + case CmdCameraMiddleRight: + if (input.GetKeyPress()) + { + salt::Vector3f pos(0, -8, 12*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(salt::gRadToDeg(0.625)); + mFPS->SetVAngleDeg(40); + } + break; + case CmdCameraMiddle: + if (input.GetKeyPress()) + { + salt::Vector3f pos(0, -8*1.1, 12*0.6); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(0); + mFPS->SetVAngleDeg(45); + } + break; + case CmdCameraRightCorner: + if (input.GetKeyPress()) + { + salt::Vector3f pos(12*0.8, -8, 12*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(-50); + mFPS->SetVAngleDeg(30); + } + break; + case CmdCameraRightGoal: + if (input.GetKeyPress()) + { + salt::Vector3f pos(12*0.8, 0.0, 12*0.4); + mCameraBody->SetPosition(pos); + mFPS->SetHAngleDeg(-90); + mFPS->SetVAngleDeg(35); + } + break; }; } Modified: trunk/rcssserver3d/plugin/soccermonitor/soccerinputlogplayer.h =================================================================== --- trunk/rcssserver3d/plugin/soccermonitor/soccerinputlogplayer.h 2009-04-30 13:26:16 UTC (rev 61) +++ trunk/rcssserver3d/plugin/soccermonitor/soccerinputlogplayer.h 2009-04-30 16:03:43 UTC (rev 62) @@ -24,6 +24,7 @@ #include <kerosin/inputserver/inputcontrol.h> #include <oxygen/simulationserver/simcontrolnode.h> + class SoccerInputLogPlayer : public kerosin::InputItem { public: @@ -33,7 +34,14 @@ CmdPause = CmdUser + 1, CmdStepForward = CmdUser + 2, CmdStepBackward = CmdUser + 3, - CmdBPlayback = CmdUser + 4 + CmdBPlayback = CmdUser + 4, + CmdCameraLeftGoal = CmdBPlayback + 1, + CmdCameraLeftCorner = CmdCameraLeftGoal + 1, + CmdCameraMiddleLeft = CmdCameraLeftCorner + 1, + CmdCameraMiddle = CmdCameraMiddleLeft + 1, + CmdCameraMiddleRight = CmdCameraMiddle + 1, + CmdCameraRightCorner = CmdCameraMiddleRight + 1, + CmdCameraRightGoal = CmdCameraRightCorner + 1 }; public: @@ -62,6 +70,12 @@ /** cached reference to the script server */ boost::shared_ptr<zeitgeist::ScriptServer> mScriptServer; + + /** cached reference to the camera body */ + boost::shared_ptr<oxygen::Body> mCameraBody; + + /** cached reference to the camera body */ + boost::shared_ptr<oxygen::FPSController> mFPS; }; DECLARE_CLASS(SoccerInputLogPlayer); Modified: trunk/rcssserver3d/rcssmonitor3d/soccerbindings.rb =================================================================== --- trunk/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2009-04-30 13:26:16 UTC (rev 61) +++ trunk/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2009-04-30 16:03:43 UTC (rev 62) @@ -15,6 +15,13 @@ inputServer.bindCommand('f', Command.StepForward); inputServer.bindCommand('b', Command.StepBackward); inputServer.bindCommand('l', Command.BPlayback); + inputServer.bindCommand('1', Command.CameraLeftGoal); + inputServer.bindCommand('2', Command.CameraLeftCorner); + inputServer.bindCommand('3', Command.CameraMiddleLeft); + inputServer.bindCommand('4', Command.CameraMiddle); + inputServer.bindCommand('5', Command.CameraMiddleRight); + inputServer.bindCommand('6', Command.CameraRightCorner); + inputServer.bindCommand('7', Command.CameraRightGoal); else print "setting bindings for online monitor\n\n"; inputServer.bindCommand('k', Command.KickOff); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |