mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-22 01:11:40 +00:00
Merge branch 'master' into 'dev'
Master See merge request chameleon-vision/Chameleon-Vision!15
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.chameleon-vision.main</groupId>
|
||||
<artifactId>chameleon-vision</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>1.0.2</version>
|
||||
<build>
|
||||
<plugins>
|
||||
<!--setup for java jdk 12-->
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.chameleonvision.settings.SettingsManager;
|
||||
import com.chameleonvision.vision.camera.CameraManager;
|
||||
import com.chameleonvision.vision.process.VisionProcess;
|
||||
import com.chameleonvision.web.Server;
|
||||
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
@@ -12,7 +13,8 @@ public class Main {
|
||||
for (var camSet : CameraManager.getAllCamerasByName().entrySet()) {
|
||||
new Thread(new VisionProcess(camSet.getValue())).start();
|
||||
}
|
||||
// NetworkTableInstance.getDefault().startClientTeam(SettingsManager.GeneralSettings.team_number);
|
||||
NetworkTableInstance.getDefault().startClientTeam(SettingsManager.GeneralSettings.team_number);
|
||||
// NetworkTableInstance.getDefault().startClient("localhost");
|
||||
Server.main(8888);
|
||||
} else {
|
||||
System.err.println("No cameras connected!");
|
||||
|
||||
@@ -140,7 +140,7 @@ public class Camera {
|
||||
return currentPipelineIndex;
|
||||
}
|
||||
|
||||
void setCurrentPipelineIndex(int pipelineNumber) {
|
||||
public void setCurrentPipelineIndex(int pipelineNumber) {
|
||||
if (pipelineNumber - 1 > pipelines.size()) return;
|
||||
currentPipelineIndex = pipelineNumber;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,9 @@ public class CameraManager {
|
||||
|
||||
private static boolean addCamera(Camera camera, String cameraName) {
|
||||
if (AllCamerasByName.containsKey(cameraName)) return false;
|
||||
camera.addPipeline();
|
||||
for (int i = 0; i < 10;i++){
|
||||
camera.addPipeline(); // simple fix to create more pipelines for now
|
||||
}
|
||||
AllCamerasByName.put(cameraName, camera);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ package com.chameleonvision.vision.process;
|
||||
import com.chameleonvision.settings.SettingsManager;
|
||||
import com.chameleonvision.vision.Pipeline;
|
||||
import com.chameleonvision.vision.camera.Camera;
|
||||
import com.chameleonvision.web.Server;
|
||||
import com.chameleonvision.web.ServerHandler;
|
||||
import edu.wpi.cscore.VideoException;
|
||||
import edu.wpi.first.networktables.*;
|
||||
import org.opencv.core.*;
|
||||
import org.opencv.imgproc.Imgproc;
|
||||
@@ -77,12 +79,18 @@ public class VisionProcess implements Runnable {
|
||||
if (camera.getPipelines().containsKey(ntPipelineIndex)) {
|
||||
// camera.setEntryNotification.value.getString());
|
||||
var pipeline = camera.getCurrentPipeline();
|
||||
|
||||
camera.setExposure(pipeline.exposure);
|
||||
camera.setCurrentPipelineIndex(ntPipelineIndex);
|
||||
try{
|
||||
camera.setExposure(pipeline.exposure);
|
||||
}
|
||||
catch (VideoException e){
|
||||
System.err.println(e.toString());
|
||||
}
|
||||
camera.setBrightness(pipeline.brightness);
|
||||
HashMap<String, Object> pipeChange = new HashMap<>();
|
||||
pipeChange.put("curr_pipeline", ntPipelineIndex);
|
||||
ServerHandler.broadcastMessage(pipeChange);
|
||||
ServerHandler.sendFullSettings();
|
||||
|
||||
} else {
|
||||
ntPipelineEntry.setString("pipeline" + camera.getCurrentPipelineIndex());
|
||||
|
||||
@@ -99,12 +99,13 @@ public class ServerHandler {
|
||||
sendFullSettings();
|
||||
break;
|
||||
case "curr_pipeline":
|
||||
String newPipeline = (String) value;
|
||||
String newPipeline = value.toString();
|
||||
var pipelineNumber = Integer.parseInt(newPipeline.replace("pipeline", ""));
|
||||
System.out.printf("Changing pipeline to %s\n", newPipeline);
|
||||
CameraManager.setCurrentPipeline(pipelineNumber);
|
||||
// broadcastMessage(allFieldsToMap(CameraManager.getCurrentPipeline()));
|
||||
broadcastMessage(allFieldsToMap(CameraManager.getCurrentPipeline()));
|
||||
|
||||
break;
|
||||
case "resolution":
|
||||
int newVideoMode = (int) value;
|
||||
|
||||
171
README.md
171
README.md
@@ -1,163 +1,78 @@
|
||||
# Chameleon-Vision
|
||||
|
||||
a free software for FRC teams to use for vision proccesing on their robots
|
||||
Chameleon Vision is free open-source software for FRC teams to use for vision proccesing on their robots.
|
||||
|
||||
## getting started
|
||||
## Getting started
|
||||
|
||||
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
|
||||
See Deployment for notes on how to deploy the project on a live system.
|
||||
|
||||
|
||||
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
|
||||
(Coming soon!)
|
||||
|
||||
### Prerequisites
|
||||
---
|
||||
#### For the co-processor
|
||||
|
||||
|
||||
- Java 12 Runtime (See Deployment - Software)
|
||||
- Avahi Daemon
|
||||
|
||||
so in order to run this project we will need to install python in order to run the backend and node.js with vue.js in order to run the fronted
|
||||
#### For the driver station
|
||||
|
||||
#### backend
|
||||
- Bonjour
|
||||
|
||||
- python 3.7 and above
|
||||
|
||||
- opencv 3.4.5
|
||||
## Deployment
|
||||
Deploying is as simple as uploading the chameleon-vision-1.xx.jar file to your target device.
|
||||
Run the program with `java -jar chameleon-vision-1.xx.jar`
|
||||
|
||||
- tornado web framework
|
||||
## Software
|
||||
|
||||
- robotpy-cscore
|
||||
### Java 12
|
||||
Follow the correct instructions for your platform from [BellSoft](https://bell-sw.com/pages/liberica_install_guide-12.0.2/)
|
||||
|
||||
- pynetworktables
|
||||
### Avahi Daemon (Linux systems)
|
||||
`sudo apt-get install avahi-daemon avahi-discover avahi-utils libnss-mdns mdns-scan`
|
||||
|
||||
- pymq
|
||||
|
||||
|
||||
|
||||
#### frontend
|
||||
|
||||
- vue.js
|
||||
|
||||
- vuex
|
||||
|
||||
- vue-router
|
||||
|
||||
- less and less-loader
|
||||
|
||||
- iView
|
||||
|
||||
- vue-native-websocket
|
||||
|
||||
|
||||
|
||||
### installing
|
||||
|
||||
#### for the backend
|
||||
|
||||
1. sudo apt-get update
|
||||
|
||||
2. apt-get dist-upgrade
|
||||
|
||||
3. sudo apt-get upgrade
|
||||
|
||||
4. sudo apt-get install python3-pip python3-dev cmake zip unzip build-essential git libnss-mdns --fix-missing
|
||||
|
||||
5. sudo pip3 install numpy (if on raspberry pi do "sudo apt-get install python3-numpy")
|
||||
6. sudo apt-get install python3-opencv
|
||||
7. pip3 install robotpy-cscore
|
||||
8. pip3 install pyzmq
|
||||
9. pip3 install tornado
|
||||
|
||||
|
||||
|
||||
to run the backend:
|
||||
|
||||
```
|
||||
|
||||
sudo python3 Main.py
|
||||
|
||||
```
|
||||
|
||||
if backed gets suck or no camera are recognized after a crash do:
|
||||
|
||||
```
|
||||
|
||||
sudo pkill -9 python3
|
||||
|
||||
```
|
||||
|
||||
#### compiling:
|
||||
|
||||
in order to compile the program for runtime run: (still needs to install dependencies)
|
||||
|
||||
```
|
||||
|
||||
python3 -m nuitka --follow-imports Main.py
|
||||
|
||||
```
|
||||
|
||||
#### for the frontend
|
||||
|
||||
1. sudo apt-get install nodejs npm
|
||||
|
||||
2. cd chameleon-client
|
||||
|
||||
3. sudo npm install
|
||||
|
||||
4. sudo npm install @vue/cli
|
||||
|
||||
|
||||
|
||||
to run the front end you can open the cli ui by:
|
||||
|
||||
```
|
||||
|
||||
vue ui
|
||||
|
||||
```
|
||||
|
||||
of you can auto serve the ui by
|
||||
|
||||
```
|
||||
|
||||
npm run serve
|
||||
|
||||
```
|
||||
### Bonjour (Windows Systems)
|
||||
Download and install Bonjour [from here](https://support.apple.com/kb/DL999?locale=en_US)
|
||||
|
||||
## Hardware
|
||||
|
||||
this is important when choosing your sbc it is more important to have a good usb controller that a good cpu
|
||||
### ARM Co-processors
|
||||
Currently only Raspberry Pi 3 or 4 models with at least 1GB of RAM are tested and supported.
|
||||
Additional ARM-based single board computers (Odroid, Nvidia Jetson, etc.) will be supported in the near future.
|
||||
|
||||
on the odroid xu4 which is very fast i have got many bottlenecks from the usb controller and many times making the program crach
|
||||
|
||||
#### networking
|
||||
|
||||
it is very important to install Bonjour
|
||||
|
||||
|
||||
|
||||
|
||||
## docs
|
||||
|
||||
main docs can be found at [google docs](https://docs.google.com/document/d/1qDuwHtpIPJfyXGIL8PJG89LZwRWbn2J9f-5g19lWL9U/edit?usp=sharing)
|
||||
|
||||
|
||||
### x86 Computers
|
||||
Currently any 64-Bit devices (Windows, Linux and Mac OS) are supported.
|
||||
32 Bit devices are not supported.
|
||||
|
||||
## Authors
|
||||
|
||||
* **Sagi Frimer** - *initial work* - websocket, settings manager, UI
|
||||
|
||||
* **Ori Agranat** - *main coder* - vision loop , UI, websocket, networktables
|
||||
* **Ori Agranat** - *main coder* - vision loop, UI, websocket, networktables
|
||||
|
||||
* **Omer Zipory** - *developer* - vision loop, websocket, networking
|
||||
|
||||
* **Banks Troutman** - *developer* - vision loop, websocket, networking
|
||||
|
||||
* **Matt Morley** - *developer* - documentation
|
||||
|
||||
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
* the [robotpy project](https://github.com/robotpy) and mainly the cscore libs
|
||||
* [WPILib](https://github.com/wpilibsuite) - Specifically [cscore](https://github.com/wpilibsuite/allwpilib/tree/master/cscore), [CameraServer](https://github.com/wpilibsuite/allwpilib/tree/master/cameraserver), [NTCore](https://github.com/wpilibsuite/allwpilib/tree/master/ntcore), and [OpenCV](https://github.com/wpilibsuite/thirdparty-opencv).
|
||||
|
||||
* basically all of stackoverflow
|
||||
* [Apache Commons](https://commons.apache.org/) - Specifically [Commons Math](https://commons.apache.org/proper/commons-math/), and [Commons Lang](https://commons.apache.org/proper/commons-lang/)
|
||||
|
||||
##License
|
||||
Copyright (C) 2019 Ori Agranat oriagranat9@gmail.com
|
||||
* [Javalin](https://javalin.io/)
|
||||
|
||||
* [Spring Framework](https://spring.io/)
|
||||
|
||||
* This file is part of Chameleon Vision.
|
||||
* [JSON](https://json.org)
|
||||
|
||||
Chameleon Vision can not be copied without the express permission of Ori Agranat
|
||||
Chameleon Vision binaries may be distributed under [Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/)
|
||||
* [Google](https://github.com/google) - Specifically [Gson](https://github.com/google/gson)
|
||||
|
||||
## License
|
||||
Usage of Chameleon Vision must fall under all terms of [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode)
|
||||
|
||||
Reference in New Issue
Block a user