EU_Robot_Group-D/README.md

130 lines
3.0 KiB
Markdown

## Complete Calibration and Detection Procedure
### Step 1: Setup Configuration Files
1. Create `arena_config.yml` with fixed marker positions:
```yaml
markers:
- id: 1
position: [0, 0]
- id: 2
position: [0, 1]
- id: 3
position: [0, 2]
```
2. Create `arena_transformation.yml` with an initial transformation matrix (example identity matrix):
```yaml
transformation_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
```
### Step 2: Calibrate the Camera
1. Run the `calibration_webcam` node to capture frames and calibrate the camera:
```bash
rosrun your_package calibration_webcam
```
2. Follow the on-screen instructions to capture at least 10 frames of the chessboard pattern from different angles and positions.
3. The calibration parameters will be saved to `camera_parameters.yml`.
### Step 3: Calibrate the Arena
1. Run the `arena_calibration` node to detect ArUco markers and calibrate the arena:
```bash
rosrun your_package arena_calibration
```
2. The detected marker positions and transformation matrix will be saved to `arena_config.yml` and `arena_transformation.yml` respectively.
### Step 4: Run the Main Node
1. Run the `aruco_detector` node to detect ArUco markers and display their positions in the arena:
```bash
rosrun your_package aruco_detector
```
2. The node will process frames from the camera, detect ArUco markers, and display their positions in the arena frame.
### Additional Information
#### Dependencies
Ensure you have the following dependencies installed:
- ROS
- OpenCV
- yaml-cpp
#### Building the Package
1. Navigate to your catkin workspace:
```bash
cd ~/catkin_ws
```
2. Build the package:
```bash
catkin build test
```
3. Source the workspace:
```bash
source devel/setup.bash
```
#### Running the Nodes
1. Start the ROS master node:
```bash
roscore
```
2. In a new terminal, run the desired node as described in the steps above.
#### Troubleshooting
- If the camera is not detected, ensure it is properly connected and recognized by the system.
- If not enough markers are detected, try adjusting the lighting conditions or the camera position.
- Ensure all configuration files (`camera_parameters.yml`, `arena_config.yml`, `arena_transformation.yml`) are correctly formatted and located in the appropriate directory.
#### Example Configuration Files
`camera_parameters.yml`:
```yaml
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [fx, 0, cx, 0, fy, cy, 0, 0, 1]
distortion_coefficients: !!opencv-matrix
rows: 1
cols: 5
dt: d
data: [k1, k2, p1, p2, k3]
```
`arena_config.yml`:
```yaml
markers:
- id: 1
position: [0, 0]
- id: 2
position: [0, 1]
- id: 3
position: [0, 2]
```
`arena_transformation.yml`:
```yaml
transformation_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
```