- added shadow_mpa11
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5955 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 2e1c35a25df86cbf81a9713630fffe876454b409 Former-commit-id: f15bea767b47f28412febe0526b52de6afeede49
This commit is contained in:
parent
74c82bb8d7
commit
d5abe16ec4
5 changed files with 46 additions and 19 deletions
|
@ -6,7 +6,7 @@ SET(ROBOT_NAME "shadow")
|
||||||
# Official-only shadow interface.
|
# Official-only shadow interface.
|
||||||
SET(ROBOT_INTERFACE LEGACY WELCOME)
|
SET(ROBOT_INTERFACE LEGACY WELCOME)
|
||||||
|
|
||||||
# Work-in-progress / unofficial shadow2 interface.
|
# Work-in-progress / unofficial shadow interface.
|
||||||
#IF(NOT OPTION_OFFICIAL_ONLY)
|
#IF(NOT OPTION_OFFICIAL_ONLY)
|
||||||
#
|
#
|
||||||
# SET(ROBOT_INTERFACE ${ROBOT_INTERFACE} shadow_mpa11)
|
# SET(ROBOT_INTERFACE ${ROBOT_INTERFACE} shadow_mpa11)
|
||||||
|
@ -81,9 +81,9 @@ SET(ROBOT_SOURCES src/Array.h
|
||||||
src/Vec3d.h
|
src/Vec3d.h
|
||||||
)
|
)
|
||||||
|
|
||||||
# Official-only shadow2 instances.
|
# Official-only shadow instances.
|
||||||
SET(ROBOT_CLONES shadow_36GP shadow_sc shadow_srw shadow_trb1 shadow_ls1 shadow_ls2 shadow_mp5
|
SET(ROBOT_CLONES shadow_36GP shadow_sc shadow_srw shadow_trb1 shadow_ls1 shadow_ls2 shadow_mp5
|
||||||
shadow_mpa1 shadow_lp1 shadow_ref)
|
shadow_mpa1 shadow_mpa11 shadow_lp1 shadow_ref)
|
||||||
|
|
||||||
# The ubiquitous robot module and its clones.
|
# The ubiquitous robot module and its clones.
|
||||||
ROBOT_MODULE(NAME ${ROBOT_NAME} VERSION 3.3.0 SOVERSION 1.0.0
|
ROBOT_MODULE(NAME ${ROBOT_NAME} VERSION 3.3.0 SOVERSION 1.0.0
|
||||||
|
|
|
@ -225,6 +225,11 @@ TDriver::TDriver(int Index, const int robot_type):
|
||||||
robot_name = "shadow_mpa1";
|
robot_name = "shadow_mpa1";
|
||||||
Frc = 0.88;
|
Frc = 0.88;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SHADOW_MPA11:
|
||||||
|
robot_name = "shadow_mpa11";
|
||||||
|
Frc = 0.88;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int i = 0; i < 50; i++ )
|
for( int i = 0; i < 50; i++ )
|
||||||
|
@ -2719,29 +2724,29 @@ void TDriver::initTireMu()
|
||||||
m_cm.TYRE_MU_R = TIREMUR;
|
m_cm.TYRE_MU_R = TIREMUR;
|
||||||
}
|
}
|
||||||
|
|
||||||
double TDriver::filterTCL(double Accel) // Tracktion control
|
double TDriver::filterTCL(double Accel) // Tracktion control
|
||||||
{
|
{
|
||||||
if(fabs(car->_speed_x) < 0.001) // Only if driving faster
|
if(fabs(car->_speed_x) < 0.001) // Only if driving faster
|
||||||
return Accel;
|
return Accel;
|
||||||
|
|
||||||
double Spin = 0; // Initialize spin
|
double Spin = 0; // Initialize spin
|
||||||
double Wr = 0; // wheel radius
|
double Wr = 0; // wheel radius
|
||||||
int Count = 0; // count impellers
|
int Count = 0; // count impellers
|
||||||
|
|
||||||
if(HasTrainFWD) // If front wheels
|
if(HasTrainFWD) // If front wheels
|
||||||
{ // are impellers
|
{ // are impellers
|
||||||
double WSL = car->_wheelSpinVel(FRNT_LFT); // Get spin velocity
|
double WSL = car->_wheelSpinVel(FRNT_LFT); // Get spin velocity
|
||||||
double WSR = car->_wheelSpinVel(FRNT_RGT);
|
double WSR = car->_wheelSpinVel(FRNT_RGT);
|
||||||
if (WSL > WSR) // Depending on max
|
if (WSL > WSR) // Depending on max
|
||||||
Spin += 2 * WSL + WSR; // calc weighted spin
|
Spin += 2 * WSL + WSR; // calc weighted spin
|
||||||
else
|
else
|
||||||
Spin += WSL + 2 * WSR;
|
Spin += WSL + 2 * WSR;
|
||||||
Wr += car->_wheelRadius(FRNT_LFT)+ car->_wheelRadius(FRNT_RGT); // measure radius
|
Wr += car->_wheelRadius(FRNT_LFT)+ car->_wheelRadius(FRNT_RGT); // measure radius
|
||||||
Count += 3; // and count weights
|
Count += 3; // and count weights
|
||||||
}
|
}
|
||||||
|
|
||||||
if(HasTrainRWD) // If rear wheels
|
if(HasTrainRWD) // If rear wheels
|
||||||
{ // are impellers
|
{ // are impellers
|
||||||
double WSL = car->_wheelSpinVel(REAR_LFT);
|
double WSL = car->_wheelSpinVel(REAR_LFT);
|
||||||
double WSR = car->_wheelSpinVel(REAR_RGT);
|
double WSR = car->_wheelSpinVel(REAR_RGT);
|
||||||
if (WSL > WSR)
|
if (WSL > WSR)
|
||||||
|
|
|
@ -99,7 +99,7 @@ static const int MAXNBBOTS = MAX_NBBOTS; // Number of drivers/robots
|
||||||
static const int BUFSIZE = 256;
|
static const int BUFSIZE = 256;
|
||||||
|
|
||||||
enum { SHADOW_TRB1=1, SHADOW_SC, SHADOW_SRW, SHADOW_LS1, SHADOW_LS2, SHADOW_36GP,
|
enum { SHADOW_TRB1=1, SHADOW_SC, SHADOW_SRW, SHADOW_LS1, SHADOW_LS2, SHADOW_36GP,
|
||||||
SHADOW_RS, SHADOW_LP1, SHADOW_MPA1 };
|
SHADOW_RS, SHADOW_LP1, SHADOW_MPA1, SHADOW_MPA11 };
|
||||||
|
|
||||||
class TDriver
|
class TDriver
|
||||||
{
|
{
|
||||||
|
|
|
@ -150,10 +150,8 @@ public:
|
||||||
|
|
||||||
void UpdatePath();
|
void UpdatePath();
|
||||||
|
|
||||||
void UpdateSit( const CarElt* myCar, const TeamInfo* pTeamInfo,
|
void UpdateSit( const CarElt* myCar, const TeamInfo* pTeamInfo, double myDirX, double myDirY );
|
||||||
double myDirX, double myDirY );
|
void ProcessMyCar( const Situation* s, const TeamInfo* pTeamInfo, const CarElt* myCar, const Sit& mySit,
|
||||||
void ProcessMyCar( const Situation* s, const TeamInfo* pTeamInfo,
|
|
||||||
const CarElt* myCar, const Sit& mySit,
|
|
||||||
const TDriver& me, double myMaxAccX, int idx );
|
const TDriver& me, double myMaxAccX, int idx );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -198,13 +198,20 @@ void SetupSHADOW_lp1()
|
||||||
robot_type = SHADOW_LP1;
|
robot_type = SHADOW_LP1;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Schismatic init for usr_mpa1
|
// Schismatic init for shadow_mpa1
|
||||||
void SetupSHADOW_mpa1()
|
void SetupSHADOW_mpa1()
|
||||||
{
|
{
|
||||||
// Add shadow_mpa1 specific initialization here
|
// Add shadow_mpa1 specific initialization here
|
||||||
robot_type = SHADOW_MPA1;
|
robot_type = SHADOW_MPA1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Schismatic init for shadow_mpa1
|
||||||
|
void SetupSHADOW_mpa11()
|
||||||
|
{
|
||||||
|
// Add shadow_mpa1 specific initialization here
|
||||||
|
robot_type = SHADOW_MPA11;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Carset specific entry points (functions)
|
// Carset specific entry points (functions)
|
||||||
|
@ -301,6 +308,21 @@ extern "C" int shadow_mpa1(tModInfo *ModInfo)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Schismatic entry point for shadow_mpa11
|
||||||
|
extern "C" int shadow_mpa11(tModInfo *ModInfo)
|
||||||
|
{
|
||||||
|
int ret = -1;
|
||||||
|
setRobotName("shadow_mpa11");
|
||||||
|
robot_type = SHADOW_MPA11;
|
||||||
|
void *robot_settings = getFileHandle();
|
||||||
|
if (robot_settings)
|
||||||
|
{
|
||||||
|
ret = shadow(ModInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
// Schismatic entry point for shadow_36GP
|
// Schismatic entry point for shadow_36GP
|
||||||
extern "C" int shadow_36GP(tModInfo *ModInfo)
|
extern "C" int shadow_36GP(tModInfo *ModInfo)
|
||||||
{
|
{
|
||||||
|
@ -445,6 +467,8 @@ extern "C" int moduleWelcome(const tModWelcomeIn* welcomeIn,
|
||||||
SetupSHADOW_lp1();
|
SetupSHADOW_lp1();
|
||||||
else if (strncmp(robot_name,"shadow_mpa1", strlen("shadow_mpa1")) == 0)
|
else if (strncmp(robot_name,"shadow_mpa1", strlen("shadow_mpa1")) == 0)
|
||||||
SetupSHADOW_mpa1();
|
SetupSHADOW_mpa1();
|
||||||
|
else if (strncmp(robot_name,"shadow_mpa11", strlen("shadow_mpa11")) == 0)
|
||||||
|
SetupSHADOW_mpa11();
|
||||||
|
|
||||||
|
|
||||||
// Set max nb of interfaces to return.
|
// Set max nb of interfaces to return.
|
||||||
|
|
Loading…
Reference in a new issue