Skip to content

Commit 5849705

Browse files
committed
make sentry just spin
1 parent 7a0dc12 commit 5849705

File tree

1 file changed

+39
-43
lines changed

1 file changed

+39
-43
lines changed

ut-robomaster/src/subsystems/chassis/command_sentry_position.cpp

Lines changed: 39 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -10,51 +10,51 @@ void CommandSentryPosition::initialize() { keyboardInputMove = Vector2f(0.0f); }
1010

1111
void CommandSentryPosition::execute()
1212
{
13-
float yawAngle = turret->getTargetLocalYaw();
14-
Vector2f inputMove = Vector2f(0.0f);
15-
float inputSpin = 0.0f;
13+
// float yawAngle = turret->getTargetLocalYaw();
14+
// Vector2f inputMove = Vector2f(0.0f);
15+
// float inputSpin = 0.0f;
1616

17-
// get keyboard input
18-
float keyboardInputSpin;
19-
bool hasKeyboardInput = applyKeyboardInput(keyboardInputMove, keyboardInputSpin);
17+
// // get keyboard input
18+
// float keyboardInputSpin;
19+
// bool hasKeyboardInput = applyKeyboardInput(keyboardInputMove, keyboardInputSpin);
2020

21-
// get joystick input
22-
Vector2f joystickInputMove;
23-
float joystickInputSpin;
24-
bool hasJoystickInput = applyJoystickInput(joystickInputMove, joystickInputSpin);
21+
// // get joystick input
22+
// Vector2f joystickInputMove;
23+
// float joystickInputSpin;
24+
// bool hasJoystickInput = applyJoystickInput(joystickInputMove, joystickInputSpin);
2525

26-
// decide which input source to use (keyboard has inertia)
27-
if (!hasKeyboardInput && hasJoystickInput)
28-
{
29-
inputMove = joystickInputMove;
30-
inputSpin = joystickInputSpin;
31-
}
32-
else
33-
{
34-
inputMove = keyboardInputMove;
35-
inputSpin = keyboardInputSpin;
36-
}
26+
// // decide which input source to use (keyboard has inertia)
27+
// if (!hasKeyboardInput && hasJoystickInput)
28+
// {
29+
// inputMove = joystickInputMove;
30+
// inputSpin = joystickInputSpin;
31+
// }
32+
// else
33+
// {
34+
// inputMove = keyboardInputMove;
35+
// inputSpin = keyboardInputSpin;
36+
// }
3737

38-
// auto-align chassis to turret when moving
39-
if (inputMove.getLengthSquared() > 0.0f && inputSpin == 0.0f)
40-
{
41-
inputSpin = calculateAutoAlignCorrection(yawAngle, CHASSIS_AUTOALIGN_ANGLE) *
42-
CHASSIS_AUTOALIGN_FACTOR;
43-
}
38+
// // auto-align chassis to turret when moving
39+
// if (inputMove.getLengthSquared() > 0.0f && inputSpin == 0.0f)
40+
// {
41+
// inputSpin = calculateAutoAlignCorrection(yawAngle, CHASSIS_AUTOALIGN_ANGLE) *
42+
// CHASSIS_AUTOALIGN_FACTOR;
43+
// }
4444

45-
// override spin input while beyblading
46-
if (beyblade)
47-
{
48-
inputSpin = 1.0f;
49-
}
45+
// // override spin input while beyblading
46+
// if (beyblade)
47+
// {
48+
// inputSpin = 1.0f;
49+
// }
5050

51-
// rotate movement vector relative to turret
52-
if (turretRelative)
53-
{
54-
inputMove = inputMove.rotate(yawAngle);
55-
}
51+
// // rotate movement vector relative to turret
52+
// if (turretRelative)
53+
// {
54+
// inputMove = inputMove.rotate(yawAngle);
55+
// }
5656

57-
chassis->input(inputMove, inputSpin);
57+
// chassis->input(inputMove, inputSpin);
5858

5959
// if (drivers->isGameActive() && moveTimer.isStopped())
6060
// {
@@ -68,14 +68,13 @@ void CommandSentryPosition::execute()
6868
// }
6969

7070
// // speen
71-
// chassis->input(Vector2f(0.0f), 1.0f);
71+
chassis->input(Vector2f(0.0f), 1.0f);
7272
}
7373

7474
void CommandSentryPosition::end(bool) { chassis->input(Vector2f(0.0f), 0.0f); }
7575

7676
bool CommandSentryPosition::isFinished() const { return false; }
7777

78-
7978
bool CommandSentryPosition::applyKeyboardInput(Vector2f &inputMove, float &inputSpin)
8079
{
8180
Remote *remote = &drivers->remote;
@@ -107,8 +106,6 @@ bool CommandSentryPosition::applyKeyboardInput(Vector2f &inputMove, float &input
107106
return rawMoveInput != Vector2f(0.0f);
108107
}
109108

110-
111-
112109
bool CommandSentryPosition::applyJoystickInput(Vector2f &inputMove, float &inputSpin)
113110
{
114111
Remote *remote = &drivers->remote;
@@ -141,5 +138,4 @@ bool CommandSentryPosition::applyJoystickInput(Vector2f &inputMove, float &input
141138
return inputMove != Vector2f(0.0f) || inputSpin != 0.0f;
142139
}
143140

144-
145141
} // namespace commands

0 commit comments

Comments
 (0)