-
Notifications
You must be signed in to change notification settings - Fork 0
Pi-camera UDP Client + boost MVP #326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
864111e
078eae9
c733592
f94e54a
d55398d
efe4aa1
9d082df
8f7530f
7d65cf6
bcfdaa0
6e3b256
cb845f6
a396fa6
83e9ef6
00d6adf
7548cfb
2a3b163
d5a7adf
d573496
0d12b7f
6c68c3f
4121c05
b8eb719
4d3f717
6f78c76
19cacc7
b1ba268
a9f90d7
d0d76d4
98d302a
2e1baf6
43bd3ca
4140fd7
ee20f3d
f4cdabb
a11407a
abbb74a
cf16f78
0feb640
250d648
5e69301
38491b3
080d5ab
b7a3a1b
3d7042c
88e2bf5
574c898
7cea1f5
519d726
a99076b
39f93dd
e78c919
06ec426
d6b4b8f
374f3e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The long term solution is to add this to the docker-file correct? If that is the case, I should start looking into implementing it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I think we can look into using |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| function(target_add_boost target_name) | ||
| include(FetchContent) | ||
|
|
||
| FetchContent_Declare(boost | ||
| URL https://github.com/boostorg/boost/releases/download/boost-1.87.0/boost-1.87.0-b2-nodocs.tar.gz | ||
| URL_HASH SHA256=d6c69e4459eb5d6ec208250291221e7ff4a2affde9af6e49c9303b89c687461f | ||
| DOWNLOAD_EXTRACT_TIMESTAMP true | ||
| ) | ||
| FetchContent_MakeAvailable(boost) | ||
| # target_link_libraries(${target_name} PRIVATE | ||
| # boost | ||
| # ) | ||
| target_include_directories(${target_name} PUBLIC ${boost_SOURCE_DIR}) | ||
|
|
||
|
|
||
| endfunction() |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #ifndef INCLUDE_CAMERA_RPI_HPP_ | ||
| #define INCLUDE_CAMERA_RPI_HPP_ | ||
|
|
||
| #include <string> | ||
| #include <memory> | ||
| #include <optional> | ||
| #include <shared_mutex> | ||
| #include <thread> | ||
| #include <deque> | ||
| #include <vector> | ||
|
|
||
| #include <nlohmann/json.hpp> | ||
| #include "camera/interface.hpp" | ||
| #include "network/mavlink.hpp" | ||
| #include "network/udp_client.hpp" | ||
|
|
||
| using json = nlohmann::json; | ||
| using namespace std::chrono_literals; // NOLINT | ||
|
|
||
| namespace asio = boost::asio; | ||
|
|
||
| enum class CameraRequest : std::uint8_t { | ||
| START = 's', | ||
| PICTURE = 'I', | ||
| END = 'e', | ||
| LOCK = 'l' | ||
| }; | ||
|
|
||
| class RPICamera : public CameraInterface { | ||
| private: | ||
| UDPClient client; | ||
| asio::io_context io_context_; | ||
| std::atomic_bool connected; | ||
|
|
||
| /** | ||
| * Converts the 3-plane raw data to BGR cv::Mat, handling stride/padding | ||
| */ | ||
| std::optional<cv::Mat> imgConvert(const std::vector<std::vector<uint8_t>>& planes); | ||
|
|
||
| /** | ||
| * Reads the 3 planes (Y, U, V) from the camera | ||
| */ | ||
| std::vector<std::vector<uint8_t>> readImage(); | ||
|
|
||
| public: | ||
| explicit RPICamera(CameraConfig config, asio::io_context* io_context_); | ||
| ~RPICamera(); | ||
|
|
||
| void connect() override; | ||
| bool isConnected() override; | ||
|
|
||
| std::optional<ImageData> getLatestImage() override {return std::nullopt;} | ||
| std::deque<ImageData> getAllImages() override {return std::deque<ImageData>();} | ||
|
|
||
| std::optional<ImageData> takePicture(const std::chrono::milliseconds& timeout, | ||
| std::shared_ptr<MavlinkClient> mavlinkClient) override; | ||
|
|
||
| void startTakingPictures(const std::chrono::milliseconds& interval, | ||
| std::shared_ptr<MavlinkClient> mavlinkClient) override; | ||
| void stopTakingPictures() override; | ||
| void startStreaming() override; | ||
| void ping(); | ||
| }; | ||
|
|
||
| #endif // INCLUDE_CAMERA_RPI_HPP_ |
Uh oh!
There was an error while loading. Please reload this page.