penalti com toque#4
Conversation
giovanna-bardi
left a comment
There was a problem hiding this comment.
Projeto muito bem estruturado
MatheusPaixaoG
left a comment
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
Padronizar o nome das variáveis. Nesse caso, o nome devera ser posBall.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Colocar nomes de variáveis descritivas para facilitar o entendimento:
| 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()); |
There was a problem hiding this comment.
Manter o padrão dos nomes dos estados
| SSLMotion::RotateOnSelf Rotate((field->enemyGoalInsideCenter() -robot->position()).angle()); | |
| SSLMotion::RotateOnSelf rotate((field->enemyGoalInsideCenter() - robot->position()).angle()); |
| auto irparapos = sslNavigation.run(robot.value(), SSLRobotCommand(goToPoint)); | ||
| irparapos.set_front(true); | ||
| irparapos.set_kickSpeed(2); |
There was a problem hiding this comment.
Pode ser um nome mais descritivo
| 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); |
| irparapos.set_kickSpeed(6); | ||
| } | ||
| emit sendCommand(irparapos); |
There was a problem hiding this comment.
Trocar aqui também
| irparapos.set_kickSpeed(6); | |
| } | |
| emit sendCommand(irparapos); | |
| command.set_kickSpeed(6); | |
| } | |
| emit sendCommand(command); |
Implementado o comportamento de Penalti