mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-05 12:54:57 +00:00
Compare commits
4 Commits
1fd88c7636
...
rtsp-camer
Author | SHA1 | Date | |
---|---|---|---|
ff89b8a742 | |||
eaee4ebd60 | |||
a4ba54161a | |||
2448691e63 |
35
README.md
35
README.md
@@ -1,39 +1,8 @@
|
||||
# TI-project - exploration robot Kobuki
|
||||
# TI-project - Kobuki
|
||||
|
||||
## Description
|
||||
This project is a kobuki that drives around in dangerous areas and detects objects in its path. It uses a camera to detect objects. The purpose of this project is to explore dangerous areas without risking human lives. You are able to control the robot using controller on the website.
|
||||
This project is a kobuki that drives around in dangerous areas and detects objects in its path. It uses a camera to detect objects. The kobuki is able to drive around in a room and detect objects.
|
||||
|
||||
## Photos
|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
### Requirements
|
||||
|
||||
- Kobuki robot
|
||||
- Raspberry Pi (minimum 3B)
|
||||
- Camera
|
||||
- power supply for Raspberry Pi
|
||||
- laptop or computer
|
||||
|
||||
### Steps
|
||||
|
||||
1. **Install Python and Pip**
|
||||
- Ensure you have Python installed on your system. You can download it from [python.org](https://www.python.org/).
|
||||
- Pip is the package installer for Python. It usually comes with Python, but you can install it separately if needed.
|
||||
|
||||
2. **Clone Our Repository**
|
||||
- Clone our repository to your local machine doing the following :
|
||||
- Open your terminal
|
||||
- Change the current working directory to the location where you want the cloned directory.
|
||||
- Type `git clone https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
|
||||
|
||||
3. **Install the required packages**
|
||||
- Open the terminal and navigate to the project - scr - Python - flask.
|
||||
- Run the following command to install the required packages:
|
||||
- `pip install -r requirements.txt`
|
||||
- This will install all the python packages required to run the project.
|
||||
- for C++, you will need to install the following packages:
|
||||
- OpenCV
|
||||
- mqtt-client
|
||||
4.
|
@@ -289,12 +289,23 @@ void sendKobukiData(TKobukiData &data) {
|
||||
}
|
||||
|
||||
void CapnSend() {
|
||||
VideoCapture cap(0);
|
||||
int fps = 15;
|
||||
int width = 800;
|
||||
int height = 600;
|
||||
|
||||
VideoCapture cap("/dev/video0");
|
||||
if (!cap.isOpened()) {
|
||||
cerr << "Error: Could not open camera" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
VideoWriter out("appsrc ! videoconvert ! video/x-raw,format=I420 ! x264enc speed-preset=ultrafast bitrate=600 key-int-max=" + to_string(fps * 2) + " ! video/x-h264,profile=baseline ! mpegtsmux ! udpsink host=127.0.0.1 port=5001",
|
||||
CAP_GSTREAMER, 0, fps, Size(width, height), true);
|
||||
if (!out.isOpened()) {
|
||||
cerr << "Error: Can't open video writer" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
Mat frame;
|
||||
while (true) {
|
||||
cap >> frame; // Capture a new image frame
|
||||
@@ -303,15 +314,10 @@ void CapnSend() {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Convert the image to a byte array
|
||||
vector<uchar> buf;
|
||||
imencode(".jpg", frame, buf);
|
||||
auto* enc_msg = reinterpret_cast<unsigned char*>(buf.data());
|
||||
|
||||
// Publish the image data
|
||||
client.publishMessage("kobuki/cam", string(enc_msg, enc_msg + buf.size()));
|
||||
// Write the frame to the UDP stream
|
||||
out.write(frame);
|
||||
cout << "Sent image" << endl;
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200)); // Send image every 200ms
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000 / fps)); // Control the frame rate
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user