Skip to content

Commit

Permalink
Merge pull request #1242 from fspindle/fix_sonarqube_next
Browse files Browse the repository at this point in the history
Fix sonarqube issues
  • Loading branch information
fspindle authored Oct 2, 2023
2 parents c449424 + 6ed2b20 commit a108a15
Show file tree
Hide file tree
Showing 60 changed files with 2,811 additions and 2,634 deletions.
6 changes: 4 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@
"numbers": "cpp",
"semaphore": "cpp",
"stop_token": "cpp",
"view": "cpp"
"view": "cpp",
"mixinvector": "cpp"
},
"C_Cpp.vcFormat.indent.namespaceContents": false,
"editor.formatOnSave": true,
Expand All @@ -132,5 +133,6 @@
"C_Cpp.vcFormat.space.aroundBinaryOperator": "ignore",
"editor.comments.insertSpace": true,
"C_Cpp.vcFormat.indent.preserveComments": true,
"C_Cpp.doxygen.generatedStyle": "/*!"
"C_Cpp.doxygen.generatedStyle": "/*!",
"files.insertFinalNewline": true
}
12 changes: 6 additions & 6 deletions 3rdparty/qbdevice/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* \details
* This file is included in the qbMove and qbHand firmware, in its libraries and
* applications. It contains all definitions that are necessary for the
* contruction of communication packages.
* construction of communication packages.
*
* It includes definitions for all of the device commands, parameters and also
* the size of answer packages.
Expand Down Expand Up @@ -96,20 +96,20 @@ enum qbmove_command
CMD_GET_CURR_AND_MEAS = 134, ///< Command for asking device's
/// measurements and currents
CMD_SET_POS_STIFF = 135, ///< Not used in the softhand firmware
CMD_GET_EMG = 136, ///< Command for asking device's emg sensors
CMD_GET_EMG = 136, ///< Command for asking device's emg sensors
/// measurements
CMD_GET_VELOCITIES = 137, ///< Command for asking device's
/// velocity measurements
CMD_GET_COUNTERS = 138, ///< Command for asking device's counters
/// (mostly used for debugging sent commands)
CMD_GET_ACCEL = 139, ///< Command for asking device's
/// acceleration measurements
CMD_GET_CURR_DIFF = 140, ///< Command for asking device's
CMD_GET_CURR_DIFF = 140, ///< Command for asking device's
/// current difference between a measured
/// one and an estimated one (Only for SoftHand)
CMD_SET_CURR_DIFF = 141, ///< Command used to set current difference modality
/// (Only for Cuff device)
CMD_SET_CUFF_INPUTS = 142, ///< Command used to set Cuff device inputs
CMD_SET_CUFF_INPUTS = 142, ///< Command used to set Cuff device inputs
/// (Only for Cuff device)
CMD_SET_WATCHDOG = 143, ///< Command for setting watchdog timer
/// or disable it
Expand Down Expand Up @@ -163,7 +163,7 @@ enum qbmove_parameter
PARAM_DOUBLE_ENC_ON_OFF = 19, ///< Double Encoder Y/N
PARAM_MOT_HANDLE_RATIO = 20, ///< Multiplier between handle and motor
PARAM_MOTOR_SUPPLY = 21, ///< Motor supply voltage of the hand
PARAM_CURRENT_LOOKUP = 23, ///< Table of values used to calculate
PARAM_CURRENT_LOOKUP = 23, ///< Table of values used to calculate
/// an estimated current of the SoftHand
PARAM_DL_POS_PID = 24, ///< Double loop position PID
PARAM_DL_CURR_PID = 25 ///< Double loop current PID
Expand Down Expand Up @@ -213,7 +213,7 @@ enum qbmove_control_mode {
CONTROL_CURRENT = 2, ///< Current control
CURR_AND_POS_CONTROL = 3, ///< Position and current control
DEFLECTION_CONTROL = 4, ///< Deflection control
DEFL_CURRENT_CONTROL = 5 ///< Deflection and current control
DEFL_CURRENT_CONTROL = 5 ///< Deflection and current control

};

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ endif()
# VISP version number. An even minor number corresponds to releases.
set(VISP_VERSION_MAJOR "3")
set(VISP_VERSION_MINOR "6")
set(VISP_VERSION_PATCH "0")
set(VISP_VERSION_PATCH "1")
set(VISP_VERSION "${VISP_VERSION_MAJOR}.${VISP_VERSION_MINOR}.${VISP_VERSION_PATCH}")
set(VISP_SOVERSION "${VISP_VERSION_MAJOR}.${VISP_VERSION_MINOR}")
# Package revision number
Expand Down
12 changes: 12 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@
Copyright (C) 2005 - 2023 by Inria. All rights reserved.
https://visp.inria.fr

ViSP 3.x.x (Version in development)
- Contributors:
. Fabien Spindler,
- New classes
.
- New features and improvements
.
- Tutorials
.
- Bug fixed
.
----------------------------------------------
ViSP 3.6.0 (released September 22, 2023)
- Contributors:
. Fabien Spindler, Souriya Trinh, Romain Lagneau, Antonio Marino, Samuel Felton,
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Specify version format
version: "3.6.0-{build}"
version: "3.6.1-{build}"

image:
- Visual Studio 2017
Expand Down
2 changes: 1 addition & 1 deletion doc/config-doxygen.in
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ EXCLUDE = "@VISP_SOURCE_DIR@/tutorial/ios/StartedImageProc/Starte
"@VISP_SOURCE_DIR@/tutorial/ios/StartedImageProc/StartedImageProc/ViewController.h" \
"@VISP_SOURCE_DIR@/tutorial/ios/AprilTagLiveCamera/AprilTagLiveCamera/VispDetector.h" \
"@VISP_SOURCE_DIR@/tutorial/ios/AprilTagLiveCamera/AprilTagLiveCamera/VispDetector.mm" \
"@VISP_SOURCE_DIR@/tutorial/ios/AprilTagLiveCamera/VispHelper/ImageDisplay+withContext.h"
"@VISP_SOURCE_DIR@/tutorial/ios/AprilTagLiveCamera/VispHelper/ImageDisplayWithContext.h"

# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
Expand Down
50 changes: 25 additions & 25 deletions example/device/framegrabber/grabV4l2MultiCpp11Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ bool getOptions(int argc, char **argv, unsigned int &deviceCount, bool &saveVide

// Code adapted from the original author Dan Mašek to be compatible with ViSP
// image
class FrameQueue
class vpFrameQueue
{

public:
struct cancelled
struct vpCancelled_t
{ };

FrameQueue()
vpFrameQueue()
: m_cancelled(false), m_cond(), m_queueColor(), m_maxQueueSize(std::numeric_limits<size_t>::max()), m_mutex()
{ }

Expand Down Expand Up @@ -173,13 +173,13 @@ class FrameQueue

while (m_queueColor.empty()) {
if (m_cancelled) {
throw cancelled();
throw vpCancelled_t();
}

m_cond.wait(lock);

if (m_cancelled) {
throw cancelled();
throw vpCancelled_t();
}
}

Expand All @@ -199,11 +199,11 @@ class FrameQueue
std::mutex m_mutex;
};

class StorageWorker
class vpStorageWorker
{

public:
StorageWorker(FrameQueue &queue, const std::string &filename, unsigned int width, unsigned int height)
vpStorageWorker(vpFrameQueue &queue, const std::string &filename, unsigned int width, unsigned int height)
: m_queue(queue), m_filename(filename), m_width(width), m_height(height)
{ }

Expand All @@ -227,18 +227,18 @@ class StorageWorker
}
}
}
catch (FrameQueue::cancelled &) {
catch (vpFrameQueue::vpCancelled_t &) {
}
}

private:
FrameQueue &m_queue;
vpFrameQueue &m_queue;
std::string m_filename;
unsigned int m_width;
unsigned int m_height;
};

class ShareImage
class vpShareImage
{

private:
Expand All @@ -249,15 +249,15 @@ class ShareImage
unsigned int m_totalSize;

public:
struct cancelled
struct vpCancelled_t
{ };

ShareImage() : m_cancelled(false), m_cond(), m_mutex(), m_pImgData(NULL), m_totalSize(0) { }
vpShareImage() : m_cancelled(false), m_cond(), m_mutex(), m_pImgData(NULL), m_totalSize(0) { }

virtual ~ShareImage()
virtual ~vpShareImage()
{
if (m_pImgData != NULL) {
delete [] m_pImgData;
delete[] m_pImgData;
}
}

Expand All @@ -274,13 +274,13 @@ class ShareImage
std::unique_lock<std::mutex> lock(m_mutex);

if (m_cancelled) {
throw cancelled();
throw vpCancelled_t();
}

m_cond.wait(lock);

if (m_cancelled) {
throw cancelled();
throw vpCancelled_t();
}

// Copy to imageData
Expand All @@ -307,7 +307,7 @@ class ShareImage
m_totalSize = totalSize;

if (m_pImgData != NULL) {
delete [] m_pImgData;
delete[] m_pImgData;
}

m_pImgData = new unsigned char[m_totalSize];
Expand All @@ -320,7 +320,7 @@ class ShareImage
}
};

void capture(vpV4l2Grabber *const pGrabber, ShareImage &share_image)
void capture(vpV4l2Grabber *const pGrabber, vpShareImage &share_image)
{
vpImage<vpRGBa> local_img;

Expand All @@ -340,7 +340,7 @@ void capture(vpV4l2Grabber *const pGrabber, ShareImage &share_image)
}

void display(unsigned int width, unsigned int height, int win_x, int win_y, unsigned int deviceId,
ShareImage &share_image, FrameQueue &queue, bool save)
vpShareImage &share_image, vpFrameQueue &queue, bool save)
{
vpImage<vpRGBa> local_img(height, width);

Expand Down Expand Up @@ -419,7 +419,7 @@ void display(unsigned int width, unsigned int height, int win_x, int win_y, unsi
}
}
}
catch (ShareImage::cancelled &) {
catch (vpShareImage::vpCancelled_t &) {
std::cout << "Cancelled!" << std::endl;
}

Expand All @@ -428,7 +428,7 @@ void display(unsigned int width, unsigned int height, int win_x, int win_y, unsi

} // Namespace

int main(int argc, char *argv [])
int main(int argc, char *argv[])
{
unsigned int deviceCount = 1;
unsigned int cameraScale = 1; // 640x480
Expand Down Expand Up @@ -459,13 +459,13 @@ int main(int argc, char *argv [])

std::cout << "Grabbers: " << grabbers.size() << std::endl;

std::vector<ShareImage> share_images(grabbers.size());
std::vector<vpShareImage> share_images(grabbers.size());
std::vector<std::thread> capture_threads;
std::vector<std::thread> display_threads;

// Synchronized queues for each camera stream
std::vector<FrameQueue> save_queues(grabbers.size());
std::vector<StorageWorker> storages;
std::vector<vpFrameQueue> save_queues(grabbers.size());
std::vector<vpStorageWorker> storages;
std::vector<std::thread> storage_threads;

std::string parent_directory = vpTime::getDateTime("%Y-%m-%d_%H.%M.%S");
Expand Down Expand Up @@ -495,7 +495,7 @@ int main(int argc, char *argv [])
if (saveVideo) {
for (auto &s : storages) {
// Start the storage thread for the current camera stream
storage_threads.emplace_back(&StorageWorker::run, &s);
storage_threads.emplace_back(&vpStorageWorker::run, &s);
}
}

Expand Down
26 changes: 13 additions & 13 deletions example/device/framegrabber/saveRealSenseData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,13 @@ bool getOptions(int argc, char **argv, bool &save, std::string &output_directory
return true;
}

class FrameQueue
class vpFrameQueue
{
public:
struct cancelled
struct vpCancelled_t
{ };

FrameQueue()
vpFrameQueue()
: m_cancelled(false), m_cond(), m_queueColor(), m_queueDepth(), m_queuePointCloud(), m_queueInfrared(),
m_maxQueueSize(1024 * 8), m_mutex()
{ }
Expand Down Expand Up @@ -252,13 +252,13 @@ class FrameQueue

while (m_queueColor.empty() || m_queueDepth.empty() || m_queuePointCloud.empty() || m_queueInfrared.empty()) {
if (m_cancelled) {
throw cancelled();
throw vpCancelled_t();
}

m_cond.wait(lock);

if (m_cancelled) {
throw cancelled();
throw vpCancelled_t();
}
}

Expand Down Expand Up @@ -290,10 +290,10 @@ class FrameQueue
std::mutex m_mutex;
};

class StorageWorker
class vpStorageWorker
{
public:
StorageWorker(FrameQueue &queue, const std::string &directory, bool save_color, bool save_depth, bool save_pointcloud,
vpStorageWorker(vpFrameQueue &queue, const std::string &directory, bool save_color, bool save_depth, bool save_pointcloud,
bool save_infrared, bool save_pointcloud_binary_format,
int
#ifndef VISP_HAVE_PCL
Expand Down Expand Up @@ -437,13 +437,13 @@ class StorageWorker
}
}
}
catch (const FrameQueue::cancelled &) {
std::cout << "Receive cancel FrameQueue." << std::endl;
catch (const vpFrameQueue::vpCancelled_t &) {
std::cout << "Receive cancel vpFrameQueue." << std::endl;
}
}

private:
FrameQueue &m_queue;
vpFrameQueue &m_queue;
std::string m_directory;
unsigned int m_cpt;
bool m_save_color;
Expand Down Expand Up @@ -607,10 +607,10 @@ int main(int argc, char *argv[])
file.close();
}

FrameQueue save_queue;
StorageWorker storage(std::ref(save_queue), std::cref(output_directory), save_color, save_depth, save_pointcloud,
vpFrameQueue save_queue;
vpStorageWorker storage(std::ref(save_queue), std::cref(output_directory), save_color, save_depth, save_pointcloud,
save_infrared, save_pointcloud_binary_format, width, height);
std::thread storage_thread(&StorageWorker::run, &storage);
std::thread storage_thread(&vpStorageWorker::run, &storage);

#ifdef USE_REALSENSE2
rs2::align align_to(RS2_STREAM_COLOR);
Expand Down
2 changes: 1 addition & 1 deletion example/reflex-takktile/yaml/motor_constants.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Motor information that stays relatively constant
motor_to_joint_inverted: [1, -1, 1, -1]
motor_to_joint_gear_ratio: [1.42, 1.42, 1.42, 1.5]
motor_to_joint_gear_ratio: [1.42, 1.42, 1.42, 1.5]
2 changes: 1 addition & 1 deletion example/servo-bebop2/servoBebop2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ int main(int argc, char **argv)
mdb.updateAll(m_obj); // All of the moments must be updated, not just an_d
mg.compute(); // Compute gravity center moment
mc.compute(); // Compute centered moments AFTER gravity center
man.setDesiredArea(area); // Desired area was init at 0 (unknow at contruction), need to be updated here
man.setDesiredArea(area); // Desired area was init at 0 (unknow at construction), need to be updated here
man.compute(); // Compute area normalized moment AFTER centered moment
mgn.compute(); // Compute gravity center normalized moment AFTER area normalized moment

Expand Down
2 changes: 1 addition & 1 deletion example/servo-pixhawk/servoPixhawkDroneIBVS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ int main(int argc, char **argv)
mdb.updateAll(m_obj); // All of the moments must be updated, not just an_d
mg.compute(); // Compute gravity center moment
mc.compute(); // Compute centered moments AFTER gravity center
man.setDesiredArea(area); // Desired area was init at 0 (unknow at contruction),
man.setDesiredArea(area); // Desired area was init at 0 (unknow at construction),
// need to be updated here
man.compute(); // Compute area normalized moment AFTER centered moment
mgn.compute(); // Compute gravity center normalized moment AFTER area normalized
Expand Down
Loading

0 comments on commit a108a15

Please sign in to comment.