mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
@@ -47,7 +47,7 @@ If you're cross-compiling, you'll need the wpilib toolchain installed. This can
|
||||
|
||||
## Out-of-Source Dependencies
|
||||
|
||||
PhotonVision uses the following additonal out-of-source repositories for building code.
|
||||
PhotonVision uses the following additional out-of-source repositories for building code.
|
||||
|
||||
- Base system images for Raspberry Pi & Orange Pi: https://github.com/PhotonVision/photon-image-modifier
|
||||
- C++ driver for Raspberry Pi CSI cameras: https://github.com/PhotonVision/photon-libcamera-gl-driver
|
||||
|
||||
@@ -26,7 +26,7 @@ The built documentation is located at `docs/build/html/index.html` relative to t
|
||||
|
||||
## Docs Builds on Pull Requests
|
||||
|
||||
Pre-merge builds of docs can be found at: `https://photonvision-docs--PRNUMBER.org.readthedocs.build/en/PRNUMBER/index.html`. These docs are republished on every commit to a pull request made to PhotonVision/photonvision-docs. For example, PR 325 would have pre-merge documentation published to `https://photonvision-docs--325.org.readthedocs.build/en/325/index.html`. Additionally, the pull requrest will have a link directly to the pre-release build of the docs. This build only runs when there is a change to files in the docs sub-folder.
|
||||
Pre-merge builds of docs can be found at: `https://photonvision-docs--PRNUMBER.org.readthedocs.build/en/PRNUMBER/index.html`. These docs are republished on every commit to a pull request made to PhotonVision/photonvision-docs. For example, PR 325 would have pre-merge documentation published to `https://photonvision-docs--325.org.readthedocs.build/en/325/index.html`. Additionally, the pull request will have a link directly to the pre-release build of the docs. This build only runs when there is a change to files in the docs sub-folder.
|
||||
|
||||
## Style Guide
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ A Pre-Built Raspberry Pi image is available for ease of installation.
|
||||
Download the latest release of the PhotonVision Raspberry image (.xz file) from the [releases page](https://github.com/PhotonVision/photonvision/releases). You do not need to extract the downloaded ZIP file.
|
||||
|
||||
:::{note}
|
||||
Make sure you download the image that ends in '-RasberryPi.xz'.
|
||||
Make sure you download the image that ends in '-RaspberryPi.xz'.
|
||||
:::
|
||||
|
||||
## Flashing the Pi Image
|
||||
|
||||
@@ -142,7 +142,7 @@ export interface CameraCalibrationResult {
|
||||
distCoeffs: JsonMatOfDouble;
|
||||
observations: BoardObservation[];
|
||||
calobjectWarp?: number[];
|
||||
// We might have to omit observations for bandwith, so backend will send us this
|
||||
// We might have to omit observations for bandwidth, so backend will send us this
|
||||
numSnapshots: number;
|
||||
meanErrors: number[];
|
||||
}
|
||||
|
||||
@@ -340,7 +340,8 @@ public class ConfigManager {
|
||||
|
||||
/**
|
||||
* Disable flushing settings to disk as part of our JVM exit hook. Used to prevent uploading all
|
||||
* settings from getting its new configs overwritten at program exit and before theyre all loaded.
|
||||
* settings from getting its new configs overwritten at program exit and before they're all
|
||||
* loaded.
|
||||
*/
|
||||
public void disableFlushOnShutdown() {
|
||||
this.flushOnShutdown = false;
|
||||
|
||||
@@ -28,7 +28,7 @@ public enum PigpioCommand {
|
||||
PCMD_WVDEL(50), // int wave_delete(unsigned wave_id)
|
||||
PCMD_WVTX(51), // int wave_tx_send(unsigned wave_id) (once)
|
||||
PCMD_WVTXR(52), // int wave_tx_send(unsigned wave_id) (repeat)
|
||||
PCMD_GDC(83), // int get_duty_cyle(unsigned user_gpio)
|
||||
PCMD_GDC(83), // int get_duty_cycle(unsigned user_gpio)
|
||||
PCMD_HP(86), // int hardware_pwm(unsigned gpio, unsigned PWMfreq, unsigned PWMduty)
|
||||
PCMD_WVTXM(100); // int wave_tx_send(unsigned wave_id, unsigned wave_mode)
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class RK3588Cmds extends LinuxCmds {
|
||||
// CPU Temperature
|
||||
/* The RK3588 chip has 7 thermal zones that can be accessed via:
|
||||
* /sys/class/thermal/thermal_zoneX/temp
|
||||
* where X is an interger from 0 to 6.
|
||||
* where X is an integer from 0 to 6.
|
||||
*
|
||||
* || Zone || Location || Comments ||
|
||||
* | 0 | soc | soc thermal (near the center of the chip) |
|
||||
|
||||
@@ -143,7 +143,7 @@ public class QuirkyCamera {
|
||||
* @param usbVid USB VID of camera
|
||||
* @param usbPid USB PID of camera
|
||||
* @param baseName CSCore name of camera
|
||||
* @param displayName Human-friendly quicky camera name
|
||||
* @param displayName Human-friendly quirky camera name
|
||||
* @param quirks Camera quirks
|
||||
*/
|
||||
private QuirkyCamera(
|
||||
@@ -160,7 +160,7 @@ public class QuirkyCamera {
|
||||
this.quirks.put(q, true);
|
||||
}
|
||||
|
||||
// (2) for all other quirks in CameraQuirks (in this version of Photon), defalut to false
|
||||
// (2) for all other quirks in CameraQuirks (in this version of Photon), default to false
|
||||
for (var q : CameraQuirk.values()) {
|
||||
this.quirks.putIfAbsent(q, false);
|
||||
}
|
||||
|
||||
@@ -152,17 +152,17 @@ public class FileSaveFrameConsumer implements Consumer<CVMat> {
|
||||
var matchType = ntMatchType.getAtomic();
|
||||
if (matchType.timestamp == 0) {
|
||||
// no NT info yet
|
||||
logger.warn("Did not recieve match type, defaulting to 0");
|
||||
logger.warn("Did not receive match type, defaulting to 0");
|
||||
}
|
||||
|
||||
var matchNum = ntMatchNum.getAtomic();
|
||||
if (matchNum.timestamp == 0) {
|
||||
logger.warn("Did not recieve match num, defaulting to -1");
|
||||
logger.warn("Did not receive match num, defaulting to -1");
|
||||
}
|
||||
|
||||
var eventName = ntEventName.getAtomic();
|
||||
if (eventName.timestamp == 0) {
|
||||
logger.warn("Did not recieve event name, defaulting to 'UNKNOWN'");
|
||||
logger.warn("Did not receive event name, defaulting to 'UNKNOWN'");
|
||||
}
|
||||
|
||||
String matchTypeStr =
|
||||
|
||||
@@ -140,7 +140,7 @@ public class CornerDetectionPipe
|
||||
var compareDistToTr =
|
||||
Comparator.comparingDouble((Point p) -> distanceBetween(p, boundingBoxCorners.get(2)));
|
||||
|
||||
// top left and top right are the poly corners closest to the bouding box tl and tr
|
||||
// top left and top right are the poly corners closest to the bounding box tl and tr
|
||||
pointList.sort(compareDistToTl);
|
||||
var tl = pointList.get(0);
|
||||
pointList.remove(tl);
|
||||
|
||||
@@ -512,7 +512,7 @@ public class PipelineManager {
|
||||
var oldSettings = userPipelineSettings.get(idx);
|
||||
|
||||
var name = getCurrentPipelineSettings().pipelineNickname;
|
||||
// Dummy settings to copy common fileds over
|
||||
// Dummy settings to copy common fields over
|
||||
var newSettings = createSettingsForType(type, name);
|
||||
|
||||
// Copy all fields from AdvancedPipelineSettings/its superclasses from old to new
|
||||
|
||||
@@ -535,7 +535,7 @@ public class VisionSourceManager {
|
||||
* Filter out any blacklisted or ignored devices.
|
||||
*
|
||||
* @param allDevices
|
||||
* @return list of devices with blacklisted or ingore devices removed.
|
||||
* @return list of devices with blacklisted or ignore devices removed.
|
||||
*/
|
||||
private List<CameraInfo> filterAllowedDevices(List<CameraInfo> allDevices) {
|
||||
List<CameraInfo> filteredDevices = new ArrayList<>();
|
||||
|
||||
@@ -59,7 +59,7 @@ public abstract class VisionSourceSettables {
|
||||
public abstract void setGain(int gain);
|
||||
|
||||
// Pretty uncommon so instead of abstract this is just a no-op by default
|
||||
// Overriden by cameras with AWB gain support
|
||||
// Overriddenn by cameras with AWB gain support
|
||||
public void setRedGain(int red) {}
|
||||
|
||||
public void setBlueGain(int blue) {}
|
||||
|
||||
@@ -287,7 +287,7 @@ public class Calibrate3dPipeTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses a given camera coefficents matrix set to "undistort" every image file found in a given
|
||||
* Uses a given camera coefficientss matrix set to "undistort" every image file found in a given
|
||||
* directory and display them. Provides an easy way to visually debug the results of the
|
||||
* calibration routine. Seems to play havoc with CI and takes a chunk of time, so shouldn't
|
||||
* usually be left active in tests.
|
||||
|
||||
@@ -139,7 +139,7 @@ public class CalibrationRotationPipeTest {
|
||||
|
||||
Point[] originalPoints = {new Point(100, 100), new Point(200, 200), new Point(300, 100)};
|
||||
|
||||
// Distort the origional points
|
||||
// Distort the origonal points
|
||||
var distortedOriginalPoints =
|
||||
OpenCVHelp.distortPoints(
|
||||
List.of(originalPoints),
|
||||
@@ -153,14 +153,14 @@ public class CalibrationRotationPipeTest {
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// Now let's instead rotate then distort
|
||||
var rotatedOrigionalPoints =
|
||||
var rotatedOriginalPoints =
|
||||
Arrays.stream(originalPoints)
|
||||
.map(it -> rot.rotatePoint(it, frameProps.imageWidth, frameProps.imageHeight))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
var distortedRotatedPoints =
|
||||
OpenCVHelp.distortPoints(
|
||||
rotatedOrigionalPoints,
|
||||
rotatedOriginalPoints,
|
||||
rotatedFrameProps.cameraCalibration.getCameraIntrinsicsMat(),
|
||||
rotatedFrameProps.cameraCalibration.getDistCoeffsMat());
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@ public class VisionSourceManagerTest {
|
||||
new CameraConfiguration(
|
||||
"Arducam OV2311 USB Camera",
|
||||
"Arducam OV2311 USB Camera",
|
||||
"fromt-left",
|
||||
"front-left",
|
||||
"/dev/video0",
|
||||
CAM1_OLD_PATHS);
|
||||
camera1_saved_config.usbVID = 3141;
|
||||
@@ -306,7 +306,7 @@ public class VisionSourceManagerTest {
|
||||
new CameraConfiguration(
|
||||
"Arducam OV2311 USB Camera",
|
||||
"Arducam OV2311 USB Camera (1)",
|
||||
"fromt-left",
|
||||
"front-left",
|
||||
"/dev/video2",
|
||||
CAM2_OLD_PATH);
|
||||
camera2_saved_config.usbVID = 3141;
|
||||
@@ -362,7 +362,7 @@ public class VisionSourceManagerTest {
|
||||
new CameraConfiguration(
|
||||
"Arducam OV2311 USB Camera",
|
||||
"Arducam OV2311 USB Camera (1)",
|
||||
"fromt-left",
|
||||
"front-left",
|
||||
"/dev/video0",
|
||||
CAM1_OLD_PATHS);
|
||||
camera1_saved_config.usbVID = 3141;
|
||||
@@ -371,7 +371,7 @@ public class VisionSourceManagerTest {
|
||||
new CameraConfiguration(
|
||||
"Arducam OV2311 USB Camera",
|
||||
"Arducam OV2311 USB Camera (1)",
|
||||
"fromt-left",
|
||||
"front-left",
|
||||
"/dev/video2",
|
||||
CAM2_OLD_PATH);
|
||||
camera2_saved_config.usbVID = 3141;
|
||||
@@ -571,7 +571,7 @@ public class VisionSourceManagerTest {
|
||||
ret1.stream().filter(it -> thisName.equals(it.cameraConfiguration.uniqueName)).count());
|
||||
}
|
||||
|
||||
// duplciate cameras, same info, new ref
|
||||
// duplicate cameras, same info, new ref
|
||||
var duplicateCameraInfos = new ArrayList<CameraInfo>();
|
||||
CameraInfo info1_dup =
|
||||
new CameraInfo(
|
||||
@@ -609,7 +609,7 @@ public class VisionSourceManagerTest {
|
||||
assertTrue(inst.knownCameras.contains(info2_dup));
|
||||
assertEquals(2, inst.knownCameras.size());
|
||||
|
||||
// duplciate cameras this simulates unplugging one and plugging the other in where v4l assigns
|
||||
// duplicate cameras this simulates unplugging one and plugging the other in where v4l assigns
|
||||
// the same by-id path to the other camera
|
||||
var duplicateCameraInfos1 = new ArrayList<CameraInfo>();
|
||||
CameraInfo info3_dup =
|
||||
|
||||
@@ -408,7 +408,7 @@ public class PhotonPoseEstimator {
|
||||
result.getTargets(),
|
||||
PoseStrategy.MULTI_TAG_PNP_ON_COPROCESSOR));
|
||||
} else {
|
||||
// We can nver fall back on another multitag strategy
|
||||
// We can never fall back on another multitag strategy
|
||||
return update(result, Optional.empty(), Optional.empty(), this.multiTagFallbackStrategy);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public class OpenCVTest {
|
||||
assertEquals(
|
||||
actualRelation.camToTargPitch.getDegrees(),
|
||||
pitchDiff.getDegrees()
|
||||
* Math.cos(yaw2d.getRadians()), // adjust for unaccounted perpsective distortion
|
||||
* Math.cos(yaw2d.getRadians()), // adjust for unaccounted perspective distortion
|
||||
kRotDeltaDeg,
|
||||
"2d pitch doesn't match 3d");
|
||||
assertEquals(
|
||||
|
||||
@@ -15,7 +15,7 @@ Like Rosmsg. But worse.
|
||||
The code for a single type is split across 3 files. Let's look at PnpResult:
|
||||
- [The struct definition](src/struct/pnpresult_struct.h): This is the data the object holds. Auto-generated. The data this object holds can be primitives or other, fully-deserialized types (like Vec2)
|
||||
- [The user class](src/targeting/pnpresult_struct.h): This is the fully-deserialized PnpResult type. This contains extra functions users might need to expose like `Amgiguity`, or other computed helper things.
|
||||
- [The serde interface](src/serde/pnpresult_struct.h): This is a template specilization for converting the user class to/from bytes
|
||||
- [The serde interface](src/serde/pnpresult_struct.h): This is a template specialization for converting the user class to/from bytes
|
||||
|
||||
## Prior art
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ remotes {
|
||||
task findDeployTarget {
|
||||
doLast {
|
||||
if(project.hasProperty('tgtIP')){
|
||||
//If user specificed IP, default to using the PI profile
|
||||
//If user specified IP, default to using the PI profile
|
||||
// but adjust hostname to match the provided IP address
|
||||
findDeployTarget.ext.rmt = remotes.pi
|
||||
findDeployTarget.ext.rmt.host=tgtIP
|
||||
|
||||
@@ -203,7 +203,7 @@ public final class OpenCVHelp {
|
||||
* @param <T> Element type
|
||||
* @param elements list elements
|
||||
* @param backwards If indexing should happen in reverse (0, size-1, size-2, ...)
|
||||
* @param shiftStart How much the inital index should be shifted (instead of starting at index 0,
|
||||
* @param shiftStart How much the initial index should be shifted (instead of starting at index 0,
|
||||
* start at shiftStart, negated if backwards)
|
||||
* @return Reordered list
|
||||
*/
|
||||
@@ -257,7 +257,7 @@ public final class OpenCVHelp {
|
||||
*
|
||||
* @param pointsList the undistorted points
|
||||
* @param cameraMatrix standard OpenCV camera mat
|
||||
* @param distCoeffs standard OpenCV distortion coefficeints. Must OPENCV5 or OPENCV8
|
||||
* @param distCoeffs standard OpenCV distortion coefficients. Must OPENCV5 or OPENCV8
|
||||
*/
|
||||
public static List<Point> distortPoints(
|
||||
List<Point> pointsList, Mat cameraMatrix, Mat distCoeffs) {
|
||||
|
||||
@@ -119,7 +119,7 @@ public class PhotonTrackedTarget
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ratio of best:alternate pose reprojection errors, called ambiguity. This is betweeen 0
|
||||
* Get the ratio of best:alternate pose reprojection errors, called ambiguity. This is between 0
|
||||
* and 1 (0 being no ambiguity, and 1 meaning both have the same reprojection error). Numbers
|
||||
* above 0.2 are likely to be ambiguous. -1 if invalid.
|
||||
*/
|
||||
|
||||
@@ -41,7 +41,7 @@ class PhotonPipelineResult : public PhotonPipelineResult_PhotonStruct {
|
||||
PhotonPipelineResult() : Base() {}
|
||||
explicit PhotonPipelineResult(Base&& data) : Base(data) {}
|
||||
|
||||
// Don't forget to deal with our ntRecieveTimestamp
|
||||
// Don't forget to deal with our ntReceiveTimestamp
|
||||
PhotonPipelineResult(const PhotonPipelineResult& other)
|
||||
: Base(other), ntReceiveTimestamp(other.ntReceiveTimestamp) {}
|
||||
PhotonPipelineResult(PhotonPipelineResult& other)
|
||||
|
||||
@@ -111,7 +111,7 @@ class PhotonTrackedTarget : public PhotonTrackedTarget_PhotonStruct {
|
||||
|
||||
/**
|
||||
* Get the ratio of best:alternate pose reprojection errors, called ambiguity.
|
||||
* This is betweeen 0 and 1 (0 being no ambiguity, and 1 meaning both have the
|
||||
* This is between 0 and 1 (0 being no ambiguity, and 1 meaning both have the
|
||||
* same reprojection error). Numbers above 0.2 are likely to be ambiguous. -1
|
||||
* if invalid.
|
||||
*/
|
||||
|
||||
@@ -81,7 +81,7 @@ void Robot::TeleopPeriodic() {
|
||||
targetRange = photon::PhotonUtils::CalculateDistanceToTarget(
|
||||
0.5_m, // Measured with a tape measure, or in CAD
|
||||
1.435_m, // From 2024 game manual for ID 7
|
||||
-30.0_deg, // Measured witha protractor, or in CAD
|
||||
-30.0_deg, // Measured with a protractor, or in CAD
|
||||
units::degree_t{target.GetPitch()});
|
||||
targetVisible = true;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Unziped image: " $IMAGE_FILE " -- mounting"
|
||||
echo "Unzipped image: " $IMAGE_FILE " -- mounting"
|
||||
TMP=$(mktemp -d)
|
||||
LOOP=$(sudo losetup --show -fP "${IMAGE_FILE}")
|
||||
echo "Image mounted! Copying jar..."
|
||||
|
||||
@@ -11,5 +11,5 @@ systemctl stop photonvision
|
||||
systemctl disable photonvision
|
||||
rm /lib/systemd/system/photonvision.service
|
||||
rm /etc/systemd/system/photonvision.service
|
||||
systemctl dameon-relaod
|
||||
systemctl daemeon-reload
|
||||
systemctl reset-failed
|
||||
|
||||
@@ -30,4 +30,4 @@ curl -sk https://api.github.com/repos/photonvision/photonvision/releases/latest
|
||||
echo "Starting PhotonVision service"
|
||||
systemctl start photonvision
|
||||
|
||||
echo "PhotonVision update succesful!"
|
||||
echo "PhotonVision update successful!"
|
||||
|
||||
Reference in New Issue
Block a user