Skip to content

Grid tracking#27

Open
Woz4tetra wants to merge 12 commits into
mainfrom
gridTracking
Open

Grid tracking#27
Woz4tetra wants to merge 12 commits into
mainfrom
gridTracking

Conversation

@Woz4tetra
Copy link
Copy Markdown
Contributor

No description provided.

addGameObject(d.getName(), globalpos.getX(), globalpos.getY(), d.getPosition().z, 0);
}
removeInactiveGameObjects();
fillGridZones();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Instead of checking every place in the grid, you could just check the column that's closest to the robot. That'll save a lot of compute. Especially since the drivers aren't using the full grid's info.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I know we said we wanted to detect links, but for an initial release, we should focus on getting the minimum requirements fulfilled. I heard performance was an issue, so let's focus on making this code as lean as possible.

int closestColumnIndex = 0;
double distance = 1000;
for (int i = 0; i < 9; i++) {
if (gridZones.get(i).getX()-m_coprocessor.getTagGlobalPoseInches().getX() < distance) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think you want to wrap this in Math.abs()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

also, I would store this value in a variable since you do the same computation a few lines down

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.

3 participants