Skip to content
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

Add static field for 2017 #65

Merged
merged 4 commits into from
Jan 15, 2017
Merged

Add static field for 2017 #65

merged 4 commits into from
Jan 15, 2017

Conversation

ArchdukeTim
Copy link
Contributor

No description provided.

Users can now load in there own image by setting 'pyfrc.field.image' to the name of the image file within the sim directory. If no image is specified, a defaultwill be used.
Copy link

@calebeby calebeby left a comment

Choose a reason for hiding this comment

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

👍

# setup board characteristics -- cell size is 1ft
self.cols, self.rows = field_size
self.margin = 5
self.cellSize = px_per_ft
self.canvasWidth = 2*self.margin + self.cols*self.cellSize
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this breaking old fields? It would be good for the old field mechanism to work (as they're present in the examples repository).

@ArchdukeTim
Copy link
Contributor Author

Well the old fields wouldn't show up anyway because I deprecated the objects dict

@virtuald
Copy link
Member

That seems like a problem if someone runs the examples repo and it doesn't work.

@virtuald
Copy link
Member

Like these: https://github.com/robotpy/examples/tree/master/physics/src . Breaking examples is not a good user experience.

@ArchdukeTim
Copy link
Contributor Author

...lets update the example? I think it's better to use an image anyway because it can change easily every year

@calebeby
Copy link

Yes, drawing the field out with the points takes forever.

@virtuald
Copy link
Member

I like the image stuff too, and I'm fine with updating the examples, but I don't want to break old robot code if I can help it, I use them for demos.

@ArchdukeTim
Copy link
Contributor Author

ArchdukeTim commented Jan 12, 2017 via email

@ArchdukeTim
Copy link
Contributor Author

Came up with a solution. PRing soon

self.canvasHeight = 2*self.margin + self.rows*self.cellSize

self.objects = config_obj['pyfrc']['field']['objects']
self.cellSize = px_per_ft if self.objects else 485 / self.cols
Copy link
Member

Choose a reason for hiding this comment

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

All three of these if statements depend on self.objects, it's a bit strange to use ternary operators in this instance.

@virtuald virtuald merged commit 82c0ba9 into robotpy:master Jan 15, 2017
@virtuald
Copy link
Member

It would be nice to update the examples to use the 2017 field.

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.

None yet

3 participants