-
Notifications
You must be signed in to change notification settings - Fork 8
penalti com toque #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,5 @@ | ||||||||||||||
| #include "CustomPlayer.h" | ||||||||||||||
| #include "Packages/SSLRobotCommand/SSLRobotCommand.h" | ||||||||||||||
|
|
||||||||||||||
| CustomPlayer::CustomPlayer(int index, QThreadPool* threadPool) : Processing(index, threadPool) { | ||||||||||||||
| } | ||||||||||||||
|
|
@@ -37,9 +38,42 @@ void CustomPlayer::exec() { | |||||||||||||
| if (!field || !frame || !robot) { | ||||||||||||||
| return; | ||||||||||||||
| } | ||||||||||||||
| if(!frame->has_ball()) return; | ||||||||||||||
| auto&& pos_ball = frame->ball(); | ||||||||||||||
| if(field->enemyPenaltyAreaContains(pos_ball)) return; | ||||||||||||||
| if(robot->distTo(pos_ball)>150) | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Colocar nomes de variáveis descritivas para facilitar o entendimento:
Suggested change
|
||||||||||||||
| { | ||||||||||||||
| SSLMotion::GoToPoint goToPoint(pos_ball, | ||||||||||||||
| (pos_ball - robot->position()).angle(), | ||||||||||||||
| true); | ||||||||||||||
| auto command = sslNavigation.run(robot.value(), SSLRobotCommand(goToPoint)); | ||||||||||||||
| command.set_dribbler(true); | ||||||||||||||
| command.set_dribblerVelocity(4); | ||||||||||||||
| emit sendCommand(command); | ||||||||||||||
| }else { | ||||||||||||||
| SSLMotion::RotateOnSelf Rotate((field->enemyGoalInsideCenter() -robot->position()).angle()); | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Manter o padrão dos nomes dos estados
Suggested change
|
||||||||||||||
| auto command = sslNavigation.run(robot.value(), SSLRobotCommand(Rotate)); | ||||||||||||||
| command.set_dribbler(true); | ||||||||||||||
| command.set_dribblerVelocity(4); | ||||||||||||||
| emit sendCommand(command); | ||||||||||||||
| if(abs(robot->angleTo(field->enemyGoalInsideCenter()))<0.1) | ||||||||||||||
| { | ||||||||||||||
| SSLMotion::GoToPoint goToPoint(pos_ball, | ||||||||||||||
| (pos_ball - robot->position()).angle(), | ||||||||||||||
| true); | ||||||||||||||
| auto irparapos = sslNavigation.run(robot.value(), SSLRobotCommand(goToPoint)); | ||||||||||||||
| irparapos.set_front(true); | ||||||||||||||
| irparapos.set_kickSpeed(2); | ||||||||||||||
|
Comment on lines
+64
to
+66
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pode ser um nome mais descritivo
Suggested change
|
||||||||||||||
|
|
||||||||||||||
| if(robot->distTo(field->enemyGoalInsideCenter())<4000) | ||||||||||||||
| { | ||||||||||||||
| irparapos.set_kickSpeed(6); | ||||||||||||||
| } | ||||||||||||||
| emit sendCommand(irparapos); | ||||||||||||||
|
Comment on lines
+70
to
+72
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trocar aqui também
Suggested change
|
||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| // TODO: here... | ||||||||||||||
| // emit sendCommand(...); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| void CustomPlayer::receiveField(const Field& field) { | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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