diff --git a/CMakeLists.txt b/CMakeLists.txt index e448ccf53aa0d14c8d012b33a2272202ba16d77e..efb6f222f6593725042c08e3d74b4a00a611ca8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,7 +134,7 @@ check_include_file_cxx("opencv2/cudastereo.hpp" HAVE_OPENCVCUDA) find_program(CPPCHECK_FOUND cppcheck) if (CPPCHECK_FOUND) message(STATUS "Found cppcheck: will perform source checks") - set(CMAKE_CXX_CPPCHECK "cppcheck" "--enable=warning,performance,portability,style" "--inline-suppr" "--std=c++11" "--suppress=*:*catch.hpp" "--suppress=*:*elas*" "--suppress=*:*json.hpp" "--quiet") + set(CMAKE_CXX_CPPCHECK "cppcheck" "--enable=warning,performance,portability,style" "--inline-suppr" "--std=c++11" "--suppress=*:*catch.hpp" "--suppress=*:*elas*" "--suppress=*:*nanogui*" "--suppress=*:*json.hpp" "--quiet") endif() # include_directories(${PROJECT_SOURCE_DIR}/common/cpp/include) diff --git a/applications/reconstruct/include/ftl/matrix_conversion.hpp b/applications/reconstruct/include/ftl/matrix_conversion.hpp index 48e27de718aa0fd538a192a239c1fdc0831f008d..ac0bff14da8ad6be553943db2c04f6b9ef22844f 100644 --- a/applications/reconstruct/include/ftl/matrix_conversion.hpp +++ b/applications/reconstruct/include/ftl/matrix_conversion.hpp @@ -30,7 +30,7 @@ namespace MatrixConversion return Eigen::Matrix4f(mat.ptr()).transpose(); }*/ - static Eigen::Vector4f VecH(const Eigen::Vector3f& v) + /*static Eigen::Vector4f VecH(const Eigen::Vector3f& v) { return Eigen::Vector4f(v[0], v[1], v[2], 1.0); } @@ -38,7 +38,7 @@ namespace MatrixConversion static Eigen::Vector3f VecDH(const Eigen::Vector4f& v) { return Eigen::Vector3f(v[0]/v[3], v[1]/v[3], v[2]/v[3]); - } + }*/ /*static Eigen::Vector3f VecToEig(const vec3f& v) { diff --git a/applications/reconstruct/include/ftl/registration.hpp b/applications/reconstruct/include/ftl/registration.hpp index d75d96efae5b168dd5a4065acc54d19d8d87f1ed..e5375dfe096d51b216900bb1c658076573786fc5 100644 --- a/applications/reconstruct/include/ftl/registration.hpp +++ b/applications/reconstruct/include/ftl/registration.hpp @@ -44,7 +44,7 @@ bool findChessboardCorners(cv::Mat &rgb, const cv::Mat &depth, const ftl::rgbd:: */ class Registration : public ftl::Configurable { public: - Registration(nlohmann::json &config); + explicit Registration(nlohmann::json &config); void addSource(ftl::rgbd::RGBDSource* source); size_t getSourcesCount() { return sources_.size(); } @@ -161,7 +161,7 @@ private: */ class ChessboardRegistration : public Registration { public: - ChessboardRegistration(nlohmann::json &config); + explicit ChessboardRegistration(nlohmann::json &config); /** * @brief Creates new ChessboardRegistration or ChessboardRegistrationChain * object depending on chain option in config. User of the method @@ -189,7 +189,7 @@ protected: */ class ChessboardRegistrationChain : public ChessboardRegistration { public: - ChessboardRegistrationChain(nlohmann::json &config); + explicit ChessboardRegistrationChain(nlohmann::json &config); bool findTransformations(std::vector<Eigen::Matrix4f> &data) override; diff --git a/applications/reconstruct/include/ftl/scene_rep_hash_sdf.hpp b/applications/reconstruct/include/ftl/scene_rep_hash_sdf.hpp index a9f32b4c3489ab8c91fc0f69dc02c8a87d8eb6fa..5da37d479f29aefc84e46c73432187579a56d31c 100644 --- a/applications/reconstruct/include/ftl/scene_rep_hash_sdf.hpp +++ b/applications/reconstruct/include/ftl/scene_rep_hash_sdf.hpp @@ -195,7 +195,7 @@ class SceneRep : public ftl::Configurable { std::unordered_set<unsigned int> pointersFreeHash; - std::vector<unsigned int> pointersFreeVec(m_hashParams.m_numSDFBlocks, 0); + std::vector<int> pointersFreeVec(m_hashParams.m_numSDFBlocks, 0); // CHECK Nick Changed to int from unsigned in for (unsigned int i = 0; i < heapCounterCPU; i++) { pointersFreeHash.insert(heapCPU[i]); pointersFreeVec[heapCPU[i]] = FREE_ENTRY; @@ -207,7 +207,7 @@ class SceneRep : public ftl::Configurable { unsigned int numOccupied = 0; unsigned int numMinusOne = 0; - unsigned int listOverallFound = 0; + //unsigned int listOverallFound = 0; std::list<myint3Voxel> l; //std::vector<myint3Voxel> v; diff --git a/applications/reconstruct/src/virtual_source.cpp b/applications/reconstruct/src/virtual_source.cpp index 7e7317b68ee9e4e11545b27569e94303002a68c7..ecaec6d2f8b7ad521db1116942074a95c662a93d 100644 --- a/applications/reconstruct/src/virtual_source.cpp +++ b/applications/reconstruct/src/virtual_source.cpp @@ -58,5 +58,5 @@ void VirtualSource::grab() { } bool VirtualSource::isReady() { - + return true; } diff --git a/components/net/cpp/include/ftl/net/universe.hpp b/components/net/cpp/include/ftl/net/universe.hpp index 3d0bbd7cc8d1f0bd3dc984a0867f5838b26a3a5a..1b233519a4f7d17cba790c6cb8c7ec5fdcf87077 100644 --- a/components/net/cpp/include/ftl/net/universe.hpp +++ b/components/net/cpp/include/ftl/net/universe.hpp @@ -180,9 +180,9 @@ class Universe : public ftl::Configurable { // --- Event Handlers ------------------------------------------------------ - ftl::net::callback_t onConnect(std::function<void(ftl::net::Peer*)>); - ftl::net::callback_t onDisconnect(std::function<void(ftl::net::Peer*)>); - ftl::net::callback_t onError(std::function<void(ftl::net::Peer*, const ftl::net::Error &)>); + ftl::net::callback_t onConnect(const std::function<void(ftl::net::Peer*)>&); + ftl::net::callback_t onDisconnect(const std::function<void(ftl::net::Peer*)>&); + ftl::net::callback_t onError(const std::function<void(ftl::net::Peer*, const ftl::net::Error &)>&); void removeCallback(ftl::net::callback_t cbid); diff --git a/components/net/cpp/src/peer.cpp b/components/net/cpp/src/peer.cpp index e84c95dbf18f9a4b88348afaf4a77f37fdfab8fa..af5051129032100917b46528eb5740b7e171a255 100644 --- a/components/net/cpp/src/peer.cpp +++ b/components/net/cpp/src/peer.cpp @@ -258,6 +258,9 @@ bool Peer::reconnect() { return false; } } + + // TODO(Nick) allow for other protocols in reconnect + return false; } void Peer::_updateURI() { diff --git a/components/net/cpp/src/universe.cpp b/components/net/cpp/src/universe.cpp index df27b3e0158d0e3ea14ac36072553f73a160dd22..b0a72d1f395ff5f222862f3164e642935f96fad8 100644 --- a/components/net/cpp/src/universe.cpp +++ b/components/net/cpp/src/universe.cpp @@ -361,21 +361,21 @@ void Universe::_run() { } } -callback_t Universe::onConnect(std::function<void(ftl::net::Peer*)> cb) { +callback_t Universe::onConnect(const std::function<void(ftl::net::Peer*)> &cb) { unique_lock<shared_mutex> lk(handler_mutex_); callback_t id = cbid__++; on_connect_.push_back({id, cb}); return id; } -callback_t Universe::onDisconnect(std::function<void(ftl::net::Peer*)> cb) { +callback_t Universe::onDisconnect(const std::function<void(ftl::net::Peer*)> &cb) { unique_lock<shared_mutex> lk(handler_mutex_); callback_t id = cbid__++; on_disconnect_.push_back({id, cb}); return id; } -callback_t Universe::onError(std::function<void(ftl::net::Peer*, const ftl::net::Error &)> cb) { +callback_t Universe::onError(const std::function<void(ftl::net::Peer*, const ftl::net::Error &)> &cb) { unique_lock<shared_mutex> lk(handler_mutex_); callback_t id = cbid__++; on_error_.push_back({id, cb}); diff --git a/components/net/cpp/test/peer_unit.cpp b/components/net/cpp/test/peer_unit.cpp index 1146c1b1dcd3224606ee00cf165446d1e323639d..09eb4bef9e70171b84e57f1e954e833aa9768566 100644 --- a/components/net/cpp/test/peer_unit.cpp +++ b/components/net/cpp/test/peer_unit.cpp @@ -48,8 +48,8 @@ class Universe { void _notifyDisconnect(Peer*) {} void removeCallback(callback_t id) {} - callback_t onConnect(std::function<void(Peer*)> f) { return 0; } - callback_t onDisconnect(std::function<void(Peer*)> f) { return 0; } + callback_t onConnect(const std::function<void(Peer*)> &f) { return 0; } + callback_t onDisconnect(const std::function<void(Peer*)> &f) { return 0; } }; } } diff --git a/components/renderers/cpp/include/ftl/display.hpp b/components/renderers/cpp/include/ftl/display.hpp index 2c2e8b8d5b80a1f3355e27462798d0fe6f698f12..bf4eb51f5687eb7f905c70cab0a7b451cc7fce57 100644 --- a/components/renderers/cpp/include/ftl/display.hpp +++ b/components/renderers/cpp/include/ftl/display.hpp @@ -46,7 +46,7 @@ class Display : public ftl::Configurable { void wait(int ms); - void onKey(std::function<void(int)> h) { key_handlers_.push_back(h); } + void onKey(const std::function<void(int)> &h) { key_handlers_.push_back(h); } private: #if defined HAVE_VIZ diff --git a/components/renderers/cpp/include/ftl/rgbd_display.hpp b/components/renderers/cpp/include/ftl/rgbd_display.hpp index fead71e645cefaccfbed28fd289541920fb547c0..0467030b0beef75e183aea34302476418196be15 100644 --- a/components/renderers/cpp/include/ftl/rgbd_display.hpp +++ b/components/renderers/cpp/include/ftl/rgbd_display.hpp @@ -20,7 +20,7 @@ class Display : public ftl::Configurable { bool active() const { return active_; } - void onKey(std::function<void(int)> h) { key_handlers_.push_back(h); } + void onKey(const std::function<void(int)> &h) { key_handlers_.push_back(h); } void wait(int ms); diff --git a/components/renderers/cpp/src/display.cpp b/components/renderers/cpp/src/display.cpp index 2911c9ea6e38610e4fd123a1208c5cd61783c2d9..712590d80fbad551fdfb8c4585a187899b753999 100644 --- a/components/renderers/cpp/src/display.cpp +++ b/components/renderers/cpp/src/display.cpp @@ -225,7 +225,7 @@ bool Display::render(pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr pc) { bool Display::render(const cv::Mat &img, style_t s) { if (s == STYLE_NORMAL) { cv::imshow("Image", img); - } else if (s = STYLE_DISPARITY) { + } else if (s == STYLE_DISPARITY) { Mat idepth; if (value("flip_vert", false)) { diff --git a/components/renderers/cpp/src/rgbd_display.cpp b/components/renderers/cpp/src/rgbd_display.cpp index e5ae0ed765a05a34152f32cd8f5a6c049f352900..d8f588ad1c3ccec27590176d75d336aae42ce3c4 100644 --- a/components/renderers/cpp/src/rgbd_display.cpp +++ b/components/renderers/cpp/src/rgbd_display.cpp @@ -119,7 +119,7 @@ void Display::update() { centre_ += (lookPoint_ - centre_) * (lerpSpeed_ * 0.1f); Eigen::Matrix4f viewPose = lookAt<float>(eye_,centre_,up_).inverse(); - //source_->setPose(viewPose); + source_->setPose(viewPose); Mat rgb, depth; //source_->grab(); diff --git a/components/rgbd-sources/include/ftl/snapshot.hpp b/components/rgbd-sources/include/ftl/snapshot.hpp index 3f0f6d1a403e625e42686a576a68828d51a95c1d..b146c49d8b1a370f154e16b806bcdd935eed987b 100644 --- a/components/rgbd-sources/include/ftl/snapshot.hpp +++ b/components/rgbd-sources/include/ftl/snapshot.hpp @@ -21,7 +21,7 @@ namespace rgbd { class SnapshotWriter { public: - SnapshotWriter(const std::string &filename); + explicit SnapshotWriter(const std::string &filename); ~SnapshotWriter(); bool addCameraRGBD(const std::string &name, const cv::Mat &rgb, const cv::Mat &depth, const Eigen::Matrix4f &pose, const ftl::rgbd::CameraParameters ¶ms); @@ -46,7 +46,7 @@ struct SnapshotEntry { class SnapshotReader { public: - SnapshotReader(const std::string &filename); + explicit SnapshotReader(const std::string &filename); ~SnapshotReader(); bool getCameraRGBD(const std::string &id, cv::Mat &rgb, cv::Mat &depth, Eigen::Matrix4f &pose, ftl::rgbd::CameraParameters ¶ms); diff --git a/components/rgbd-sources/src/calibrate.cpp b/components/rgbd-sources/src/calibrate.cpp index 05364c507c8072c0c4da2f060ec7d8a992945c61..315fc8f35d15f03957fd6d8716244850278d8ddd 100644 --- a/components/rgbd-sources/src/calibrate.cpp +++ b/components/rgbd-sources/src/calibrate.cpp @@ -384,7 +384,7 @@ bool Calibrate::recalibrate() { bool Calibrate::_recalibrate(vector<vector<Point2f>> *imagePoints, Mat *cameraMatrix, Mat *distCoeffs, Size *imageSize) { - int winSize = 11; // parser.get<int>("winSize"); + //int winSize = 11; // parser.get<int>("winSize"); float grid_width = settings_.squareSize * (settings_.boardSize.width - 1); bool release_object = false;