Skip to content

penalti com toque#4

Open
joaopedrodeo wants to merge 1 commit into
robocin:mainfrom
joaopedrodeo:main
Open

penalti com toque#4
joaopedrodeo wants to merge 1 commit into
robocin:mainfrom
joaopedrodeo:main

Conversation

@joaopedrodeo
Copy link
Copy Markdown

Implementado o comportamento de Penalti

Copy link
Copy Markdown

@lucaasleal lucaasleal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muito boa a lógica que foi pensada para essa aplicação do penâlti. Máquinas de estado bem planejadas e uma ótima utilização dos métodos e funções disponíveis.

Copy link
Copy Markdown

@giovanna-bardi giovanna-bardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Projeto muito bem estruturado

Copy link
Copy Markdown
Contributor

@MatheusPaixaoG MatheusPaixaoG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muito bom galera! Vi o comportamento funcionando e tá show. Deixei algumas sugestões de organização e padronização de código. Além disso, seria bom transformar os valores numéricos que estão nas condicionais em constantes e formatar o código (pra isso, basta apertar ctrl+s usando o Default Formatter como sendo o clang-format 😉)

return;
}
if(!frame->has_ball()) return;
auto&& pos_ball = frame->ball();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Padronizar o nome das variáveis. Nesse caso, o nome devera ser posBall.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Em C++ costumamos usar o padrão camelCase

if(!frame->has_ball()) return;
auto&& pos_ball = frame->ball();
if(field->enemyPenaltyAreaContains(pos_ball)) return;
if(robot->distTo(pos_ball)>150)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Colocar nomes de variáveis descritivas para facilitar o entendimento:

Suggested change
if(robot->distTo(pos_ball)>150)
bool isRobotFarFromBall = robot->distTo(pos_ball)>150;
if(isRobotFarFromBall)

command.set_dribblerVelocity(4);
emit sendCommand(command);
}else {
SSLMotion::RotateOnSelf Rotate((field->enemyGoalInsideCenter() -robot->position()).angle());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manter o padrão dos nomes dos estados

Suggested change
SSLMotion::RotateOnSelf Rotate((field->enemyGoalInsideCenter() -robot->position()).angle());
SSLMotion::RotateOnSelf rotate((field->enemyGoalInsideCenter() - robot->position()).angle());

Comment on lines +64 to +66
auto irparapos = sslNavigation.run(robot.value(), SSLRobotCommand(goToPoint));
irparapos.set_front(true);
irparapos.set_kickSpeed(2);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pode ser um nome mais descritivo

Suggested change
auto irparapos = sslNavigation.run(robot.value(), SSLRobotCommand(goToPoint));
irparapos.set_front(true);
irparapos.set_kickSpeed(2);
auto command = sslNavigation.run(robot.value(), SSLRobotCommand(goToPoint));
command.set_front(true);
command.set_kickSpeed(2);

Comment on lines +70 to +72
irparapos.set_kickSpeed(6);
}
emit sendCommand(irparapos);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trocar aqui também

Suggested change
irparapos.set_kickSpeed(6);
}
emit sendCommand(irparapos);
command.set_kickSpeed(6);
}
emit sendCommand(command);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants