Permalink
...
Comparing changes
Open a pull request
- 6 commits
- 6 files changed
- 0 commit comments
- 2 contributors
Commits on Jan 06, 2015
|
|
virtuald |
df775c2
|
Commits on Jan 07, 2015
|
|
virtuald |
534b787
|
|||
|
|
PeterJohnson |
095df78
|
|||
|
|
PeterJohnson |
211226d
|
|||
|
|
PeterJohnson |
84ed148
|
|||
|
|
PeterJohnson |
c291ca7
|
Unified
Split
Showing
with
51 additions
and 18 deletions.
- +14 −4 docs/getting_started.rst
- +1 −3 docs/guide/running.rst
- +1 −1 examples/examples/QuickVision/robot.py
- +9 −1 hal-base/hal/functions.py
- +11 −0 installer/installer.rst
- +15 −9 wpilib/wpilib/cameraserver.py
View
18
docs/getting_started.rst
| @@ -70,16 +70,26 @@ your RoboRIO. | ||
| * Connect your RoboRIO to the internet | ||
| * SSH in, and copy the following to /etc/opkg/robotpy.conf:: | ||
| - src/gz robotpy http://www.tortall.net/~robotpy/feeds/2014 | ||
| + src/gz robotpy http://www.tortall.net/~robotpy/feeds/2014 | ||
| * Run this:: | ||
| - opkg install python3 | ||
| + opkg install python3 | ||
| * Then run this:: | ||
| - pip3 install robotpy-hal-roborio wpilib | ||
| - | ||
| + pip3 install pynivision robotpy-hal-roborio wpilib | ||
| + | ||
| +.. note:: When powered off, your RoboRIO does not keep track of the correct | ||
| + date, and as a result pip may fail with an SSL related error message. | ||
| + To set the date, you can either: | ||
| + | ||
| + * Set the date via the web interface | ||
| + * You can login to your roboRIO via SSH, and set the date via the | ||
| + date command:: | ||
| + | ||
| + date -s "2015-01-03 00:00:00" | ||
| + | ||
| Upgrading requires you to run the same commands, but with the appropriate | ||
| flags set to tell pip3/opkg to upgrade the packages for you. | ||
View
4
docs/guide/running.rst
| @@ -9,8 +9,6 @@ Now that you've created your first Python robot program, you probably want to kn | ||
| On the robot (using pyfrc) | ||
| -------------------------- | ||
| -.. note:: pyfrc support for uploading to a RoboRIO is not complete yet, and will be working by the end of the weekend | ||
| - | ||
| The easiest way to install code on the robot is to use pyfrc. | ||
| 1. Make sure you have RobotPy installed on the robot | ||
| @@ -40,7 +38,7 @@ If you don't have (or don't want) to install pyfrc, running code manually is pre | ||
| Your driver station should be able to connect to your code, and it will be able to operate your robot! | ||
| -.. note:: This is good for running experimental code, but it won't start the code when the robot starts up. In the future we'll add notes on how to properly do this. | ||
| +.. note:: This is good for running experimental code, but it won't start the code when the robot starts up. Use pyfrc to do that. | ||
| On your computer | ||
View
2
examples/examples/QuickVision/robot.py
| @@ -16,7 +16,7 @@ def robotInit(self): | ||
| camera = wpilib.USBCamera() | ||
| camera.setExposureManual(50) | ||
| camera.setBrightness(80) | ||
| - camera.updateSetting() # force update before we start thread | ||
| + camera.updateSettings() # force update before we start thread | ||
| server = wpilib.CameraServer.getInstance() | ||
| server.startAutomaticCapture(camera) | ||
View
10
hal-base/hal/functions.py
| @@ -22,8 +22,16 @@ def _STATUSFUNC(name, restype, *params, out=None, library=_dll, | ||
| handle_missing=False): | ||
| realparams = list(params) | ||
| realparams.append(("status", C.POINTER(C.c_int32))) | ||
| + if restype is not None and out is not None: | ||
| + outindexes = [i for i, p in enumerate(params) if p[0] in out] | ||
| + def errcheck(rv, f, args): | ||
| + out = [rv] | ||
| + out.extend(args[i].value for i in outindexes) | ||
| + return tuple(out) | ||
| + else: | ||
| + errcheck = None | ||
| _inner = _RETFUNC(name, restype, *realparams, out=out, library=library, | ||
| - handle_missing=handle_missing) | ||
| + errcheck=errcheck, handle_missing=handle_missing) | ||
| def outer(*args, **kwargs): | ||
| status = C.c_int32(0) | ||
| rv = _inner(*args, status=status, **kwargs) | ||
View
11
installer/installer.rst
| @@ -22,6 +22,17 @@ external packages, so use them at your own risk. | ||
| the RobotPy installer to install packages, then you can easily | ||
| reinstall them on your robot in the case you need to reimage it. | ||
| + If you choose to install packages manually via pip, keep in mind that | ||
| + when powered off, your RoboRIO does not keep track of the correct | ||
| + date, and as a result pip may fail with an SSL related error message. | ||
| + To set the date, you can either: | ||
| + | ||
| + * Set the date via the web interface | ||
| + * You can login to your roboRIO via SSH, and set the date via the | ||
| + date command:: | ||
| + | ||
| + date -s "2015-01-03 00:00:00" | ||
| + | ||
| Each of the commands supports various options, which you can read about by | ||
| invoking the --help command. | ||
View
24
wpilib/wpilib/cameraserver.py
| @@ -17,7 +17,7 @@ class CameraServer: | ||
| kSize320x240 = 1 | ||
| kSize160x120 = 2 | ||
| kHardwareCompression = -1 | ||
| - kMaxImageSize = 20000 | ||
| + kMaxImageSize = 200000 | ||
| intStruct = struct.Struct("!i") | ||
| @@ -114,11 +114,11 @@ def startAutomaticCapture(self, camera): | ||
| self.camera = camera | ||
| self.camera.startCapture() | ||
| - self.captureThread = threading.Thread(target=lambda: self._autoCapture(cameraName), name="CaptureThread") | ||
| + self.captureThread = threading.Thread(target=self._autoCapture, name="CaptureThread") | ||
| self.captureThread.daemon = True | ||
| self.captureThread.start() | ||
| - def _autoCapture(self, name): | ||
| + def _autoCapture(self): | ||
| frame = nivision.imaqCreateImage(nivision.IMAQ_IMAGE_RGB, 0) | ||
| while True: | ||
| @@ -127,12 +127,18 @@ def _autoCapture(self, name): | ||
| if hwClient: | ||
| data = self.dataPool[-1] | ||
| self.dataPool.pop() | ||
| - if hwClient: | ||
| - size = self.camera.getImageData(data, self.kMaxImageSize) | ||
| - self._setImageData(data, size) | ||
| - else: | ||
| - self.camera.getImage(frame) | ||
| - self.setImage(frame) | ||
| + try: | ||
| + if hwClient: | ||
| + size = self.camera.getImageData(data, self.kMaxImageSize) | ||
| + self._setImageData(data, size) | ||
| + else: | ||
| + self.camera.getImage(frame) | ||
| + self.setImage(frame) | ||
| + except (ValueError, IndexError): | ||
| + logger.exception("getting image") | ||
| + if hwClient and not self.ready.is_set(): | ||
| + self.dataPool.append(data) | ||
| + time.sleep(0.1) | ||
| def isAutoCaptureStarted(self): | ||
| """check if auto capture is started | ||