Commter : Moyu
- Move ApriltagField To A Function Called
Translation2d getPosByApriltag()in ApriltagSubsystem - Change all of the variable name to m[what's this variable use to or stands for]
- Example :
mTime
- Example :
- Add a function called
void variableSettoZero()in README.md
Commiter : AngelShih
A command that will return the current position in the field by using apriltag.
Commiter : Moyu
-
Set setpoint to 36 cm ( In ApriltagCommand -> Excute )
- Code :
forward = targetToCamera.getX() - 0.36;
- Code :
-
New Function
-
Pair<Double, Double> getTwoRelativeEncoderData()RETURN The data of encoder
- Code :
/** * @return first -> leftPos * <li>second -> rightPos */ public Pair<Double, Double> getTwoRelativeEncoderData(){ double DPP = DriveConstants.kDistancePerPulse; return new Pair<>(leftEncoder.getPosition() * DPP, rightEncoder.getPosition() * DPP); }
- The way to get data :
- If you want the data of left encoder :
drive.getTwoRelativeEncoderData().getFirst();
- If you want the data of right encoder :
drive.getTwoRelativeEncoderData().getSecond();
- If you want the data of left encoder :
- Code :
-
void resetEncoder()
-
-
Change turn speed to 0.3
Cuz i found if i set it to 0.2, the outpuy will not be able to move ( due to the friction ) Here is the code :
drive.arcadeDrive(0, 0.3);
-
Add resetEncoder in
ApriltagCommand -> initialize()
Commiter : Moyu
Commoier : Moyu
Change
PhotonCamera pv_cam = new PhotonCamera("webcam");to
PhotonCamera pv_cam = new PhotonCamera("WEB_CAM");Commiter : Moyu
Commiter : Moyu
- Repo Name :
Apriltag->Imagine - Branch Name :
ap1->apriltag
Commiter : AngelShih
Using getBestCameraToTarget() to know the 3d transform of the camera to target and using PID to define the speed of the robot.
**return definition of the getBestCameraToTarget() **
(x,y,z) = (forward, left , up)
method added:
- snapshot()
- getCameratoTaget()
- getTargetID()
- getYaw()
- getSkew()
- getPitch()
- hasTarget()
- getPoseAmbiguity()
Commiter : Moyu
Commiter : FUNDAI
- Tuning Config files for photon vision
- The data is the best for my computer , you can have some small adjust according to your computer , but still can use it as the example
- How to use this file
- Download the tuning example.zip tuning example.zip
- Unzip it and drag the json file to the ...\photonvision_config\cameras\WEB_CAM\pipelines
- Please note that you need to run the photon vision jar file and plug in the webcam we use , so the config file can be generate .
- Then you can see the tunung example in the pipeline
- Calibrations image for the cam
- These config is only for the resolution of 320 * 240
- How to use this
- Download the zip calibImgs.zip
- Unzip it and drag the whole folder to the ...\photonvision_config
- Open the ...\photonvision_config\cameras\WEB_CAM\config.json
- Copy this to the "calibrations" :[ here ] in the json file
{ "resolution" : { "width" : 320.0, "height" : 240.0 }, "cameraIntrinsics" : { "rows" : 3, "cols" : 3, "type" : 6, "data" : [ 325.4782289990506, 0.0, 161.16227748156365, 0.0, 324.88650396794645, 126.84535212023526, 0.0, 0.0, 1.0 ] }, "cameraExtrinsics" : { "rows" : 1, "cols" : 5, "type" : 6, "data" : [ -0.42743921214881714, 0.18577548823718337, -0.0019772787780521733, -6.147030353048858E-4, 0.15962711883283534 ] }, "perViewErrors" : [ 0.16507820914949986, 0.1791804853539527, 0.3501084526252324, 0.060278947060275916, 0.11327293587756991, 0.10125361580613283, 0.10907778732478748, 0.08805826464716052, 0.11764671960915368, 0.15328027228464564, 0.15372513382862976, 0.0958581539721597, 0.09129136311272125, 0.056747500430105235, 0.2922282467441044, 0.18689829311976291 ], "standardDeviation" : 0.07733126413720712 }
- Quick way to open photon vision
- How to use it
- Create a txt file in the folder where your photon jar located
- Please note that you need to see the filename extension (like .zip .txt .jpg...) , if not please open it.
- Rename the file to -> the_name_you_want.bat
- Please note that you need to deleate the .txt when you are renaming , and the picture of the file change to the gear or check if it change the file to "window 批次檔"
- Right click the file , click edit and paste the code you start the photon vision (java - jar C:....."".jar)
- Then create a shortcut to desktop and click the shortcut you can see the terminal running
- Create a txt file in the folder where your photon jar located
- How to use it
Commiter : Moyu
- Remark Details
- Most of the Funciton and Something have their comments
- Changed data includes
- ApriltagSubsystem.java
- Consiants.java
- Every comment contains
SinceReturns- Some comments have
ApiNote
- Changed data includes
- Most of the Funciton and Something have their comments
Commiter : Moyu
- Declare Webcam
// Change this to match the name of your camera
PhotonCamera camera = new PhotonCamera("photonvision");PhotonCamera is a class in PhotonLib that allows a user to interact with one camera that is connected to hardware that is running Photon Vision. Through this class, users can retrieve yaw, pitch, roll, robot-relative pose, latency, and a wealth of other information.
The PhotonCamera class has two constructors: one that takes a NetworkTable and another that takes in the name of the network table that PhotonVision is broadcasting information over. For ease of use, it is recommended to use the latter. The name of the NetworkTable (for the string constructor) should be the same as the camera’s nickname (from the PhotonVision UI).
Notice In theory, I should name the camera a special name, but since I'm just starting to learn it, I'll use the
webcamname first.
- Getting the Pipeline Result
// Query the latest result from PhotonVision
PhotonPipelineResult wemcam_result = webcam.getLatestResult();A PhotonPipelineResult is a container that contains all information about currently detected targets from a PhotonCamera. You can retrieve the latest pipeline result using the PhotonCamera instance.
Use the getLatestResult()/GetLatestResult() (Java and C++ respectively) to obtain the latest pipeline result. An advantage of using this method is that it returns a container with information that is guaranteed to be from the same timestamp. This is important if you are using this data for latency compensation or in an estimator.
-
boolean hasTargets()RETURN if the result contains any targets.
Warning You must always check if the result has a target via
hasTargets()before getting targets or else you may get a null pointer exception. Further, you must use the same result in every subsequent call in that loop. -
List getApriltagTargeList()RETURN a List includes yaw, pitch, area, and robot relative pose.
-
PhotonTrackedTarget getBestApriltahTarget()RETURN the best target. Here is the declaration of bestTarget from PhotonVision
-
Getting Data From A Target
-
List<PhotonTrackedTarget> getApriltagTargeList( String best )RETURN A tracked target contains information about each target from a pipeline result. This information includes yaw, pitch, area, and robot relative pose.
Notice You can put an string while you called it. This string used to distinguish what kind of result you want. If you want the BEST target, put
"True"into funtion. Otherwise, put any string which dosen't match"True", here recommended to use"False". Once you put "True" into the function, it will return BEST Target to you. Otherwise, it will return the first Target ( Because I haven't figured out how to handle detecting many Apriltag at the same time) <- This problem needs to be resolved as soon as possible -
double getTargetYaw( String best )RETURN The yaw of the target in degrees ( positive right ).
Notice You can put an string while you called it. This string used to distinguish what kind of result you want. If you want the BEST target, put
"True"into funtion. Otherwise, put any string which dosen't match"True", here recommended to use"False". -
double getTargetPitch( String best )RETURN The pitch of the target in degrees ( positive up ).
Notice You can put an string while you called it. This string used to distinguish what kind of result you want. If you want the BEST target, put
"True"into funtion. Otherwise, put any string which dosen't match"True", here recommended to use"False". -
double getTargetArea( String best )RETURN The area ( how much of the camera feed the bounding box takes up ) as a percent ( 0 - 100 ).
Notice You can put an string while you called it. This string used to distinguish what kind of result you want. If you want the BEST target, put
"True"into funtion. Otherwise, put any string which dosen't match"True", here recommended to use"False" -
double getTargetSkew( String best )RETURN The skew of the target in degrees (counter-clockwise positive).
Notice You can put an string while you called it. This string used to distinguish what kind of result you want. If you want the BEST target, put
"True"into funtion. Otherwise, put any string which dosen't match"True", here recommended to use"False" -
List<TargetCorner> getTargetCorner( String best )RETURN the 4 corners of the minimum bounding box rectangle.
Notice You can put an string while you called it. This string used to distinguish what kind of result you want. If you want the BEST target, put
"True"into funtion. Otherwise, put any string which dosen't match"True", here recommended to use"False" -
Transform3d getCameraToTarget( String best )RETURN The camera to target transform.
Notice You can put an string while you called it. This string used to distinguish what kind of result you want. If you want the BEST target, put
"True"into funtion. Otherwise, put any string which dosen't match"True", here recommended to use"False"
-
Commiter : Moyu
- Finish DriveSubsystem.java
- Use
public static final class DriveConstantsto classify constants - Classification
- DriveConstants
- Four Direction
MotorID
- Four Direction
- JoystickConstants
- All of the
Button,Trigger, andAxis
- All of the
- DriveConstants