Skip to content
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

【auto_stabilizer】 merge origin/master #76

Open
wants to merge 23 commits into
base: auto-stabilizer
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5937f21
[ImpedanceController] fix sensor localPos rotation
YuyaNagamatsu Sep 4, 2021
606108c
Merge pull request #1307 from YuyaNagamatsu/nagamatsu/ic_fix_sensorpos
fkanehiro Sep 6, 2021
c4453f5
Fix util build on Ubuntu 20.04
gergondet Nov 16, 2021
bdbc4c8
Merge pull request #1308 from gergondet/topic/FixUtilFocalBuild
fkanehiro Nov 16, 2021
26dbe87
[hrpEC/hroEC-common] fix memory leak
Naoki-Hiraoka Dec 12, 2021
5fb77b0
[cmake] Remove unnecessary add_subdirectory
gergondet Feb 14, 2022
bf592f3
[cmake] Correctly set file-level dependencies
gergondet Feb 14, 2022
89d8ac4
[cmake] Change USE_HRPSYSUTIL into an option
gergondet Feb 14, 2022
e78f533
[cmake] Remove the FindEigen module
gergondet Feb 14, 2022
3706e7c
Merge pull request #1310 from gergondet/topic/FixCMakeIssue
fkanehiro Feb 15, 2022
c7b1809
Merge pull request #1309 from Naoki-Hiraoka/PR-get_component_profile
fkanehiro Feb 15, 2022
611baf6
Introduce an option to skip hrpsysext build
gergondet Feb 22, 2022
31229c3
Merge pull request #1311 from gergondet/topic/hrpsysext-option
fkanehiro Feb 23, 2022
1a8121a
Add an option to disable Irrlicht
arntanguy Apr 7, 2022
15429ce
Merge pull request #1312 from arntanguy/topic/irrlicht
fkanehiro Apr 7, 2022
d48a0eb
[ModifiedServo] Create InPorts for pdgains
rohanpsingh May 17, 2022
3322be6
[RobotHardware/robot.cpp] fix for robots which have a relay for each …
Naoki-Hiraoka May 17, 2022
973afe2
[ModifiedServo] Intialize m_pgains, m_dgains in onActivated
rohanpsingh May 18, 2022
cbad549
[ModifiedServo] Create OutPorts to Get + rename register name
rohanpsingh May 18, 2022
798b4c9
Merge pull request #1313 from rohanpsingh/create-pdgains-ports
fkanehiro May 18, 2022
3d05778
Merge pull request #1315 from kindsenior/kindsenior/PR-servo-error-li…
fkanehiro Jun 13, 2022
72af4f6
Merge pull request #1314 from Naoki-Hiraoka/PR-power
fkanehiro Jun 14, 2022
8f434b1
Merge remote-tracking branch 'origin/master' into auto-stabilizer
Naoki-Hiraoka Jun 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 28 additions & 46 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ include(FindPkgConfig)
include(CheckIncludeFiles)

option(ENABLE_INSTALL_RPATH "Enable RPATH setting for installed binary files" OFF)
option(USE_HRPSYSUTIL "Build hrpsysUtil" ON)
option(USE_IRRLICHT "Build Irrlicht components" OFF)
option(NO_DIGITAL_INPUT "Disable readDigitalInput and lengthDigitalInput" OFF)
option(USE_QPOASES "Build qpOASES" ON)
option(ENABLE_DOXYGEN "Use Doxygen" ON)


set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
Expand Down Expand Up @@ -142,51 +148,32 @@ include(CPack)

find_package(LibXml2 REQUIRED)
find_package(QuickHull REQUIRED)
find_package(SDL)
if ( NOT SDL_FOUND )
message(WARNING "Package SDL is not found!")
endif( NOT SDL_FOUND )
find_package(OpenGL)
if ( NOT OPENGL_FOUND )
message(WARNING "Package OpenGL is not found!")
endif( NOT OPENGL_FOUND )
find_package(GLUT)
if ( NOT GLUT_FOUND )
message(WARNING "Package GLUT is not found!")
endif( NOT GLUT_FOUND )
include(FindPkgConfig)
pkg_check_modules(OpenCV opencv)
if (NOT OpenCV_FOUND)
# pkg_check_modules(OpenCV opencv-2.3.1)
pkg_check_modules(OpenCV opencv-3.3.1-dev)

if(USE_HRPSYSUTIL)
find_package(SDL REQUIRED)
find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)
pkg_check_modules(OpenCV opencv)
if (NOT OpenCV_FOUND)
message(WARNING "opencv not found")
endif()
endif()
pkg_check_modules(GLEW glew)
if (NOT GLEW_FOUND)
message(WARNING "Package GLEW is not found")
endif()
find_package(PCL)
if(OpenCV_FOUND AND OPENGL_FOUND AND GLEW_FOUND AND GLUT_FOUND AND SDL_FOUND)
if(APPLE)
if(PCL_FOUND) # qhull is included in pcl
set(USE_HRPSYSUTIL true)
else()
set(USE_HRPSYSUTIL false)
# pkg_check_modules(OpenCV opencv-2.3.1)
pkg_check_modules(OpenCV opencv-3.3.1-dev)
if (NOT OpenCV_FOUND)
pkg_check_modules(OpenCV opencv4)
if (NOT OpenCV_FOUND)
message(FATAL_ERROR "OpenCV is required to build hrpsysUtil")
endif()
endif()
else()
set(USE_HRPSYSUTIL true)
endif()
else()
set(USE_HRPSYSUTIL false)
include_directories(${OpenCV_INCLUDE_DIRS})
link_directories(${OpenCV_LIBRARY_DIRS})
pkg_check_modules(GLEW glew)
if (NOT GLEW_FOUND)
message(FATAL_ERROR "GLEW is required to build hrpsysUtil")
endif()
endif()

include_directories(${OpenCV_INCLUDE_DIRS})
link_directories(${OpenCV_LIBRARY_DIRS})
if(NOT QNXNTO)
find_package(Eigen REQUIRED)
include_directories(${Eigen_INCLUDE_DIRS})
find_package(PCL)
if(USE_HRPSYSUTIL AND APPLE AND NOT PCL_FOUND)
message(FATAL_ERROR "PCL is required to build hrpsysUtil on Apple platform")
endif()

execute_process(
Expand All @@ -202,7 +189,6 @@ install(FILES

add_definitions(-DHRPSYS_PACKAGE_VERSION=\"\\"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}\\"\")

option(NO_DIGITAL_INPUT "Disable readDigitalInput and lengthDigitalInput" OFF)
if(NO_DIGITAL_INPUT)
add_definitions(-DNO_DIGITAL_INPUT)
message(STATUS "Disablng readDigitalInput and lengthDigitalInput")
Expand All @@ -219,19 +205,15 @@ add_subdirectory(python)
add_subdirectory(idl)
add_subdirectory(lib)
add_subdirectory(ec)
# option for 3rdparty
option(USE_QPOASES "Build qpOASES" ON)
add_subdirectory(3rdparty)
add_subdirectory(rtc)
option(ENABLE_DOXYGEN "Use Doxygen" ON)
if(ENABLE_DOXYGEN)
add_subdirectory(doc)
endif()
if (NOT QNXNTO)
add_subdirectory(util)
endif()
add_subdirectory(sample)
add_subdirectory(test)

#if catkin environment
string(REGEX MATCH "catkin" need_catkin "$ENV{_}")
Expand Down
26 changes: 0 additions & 26 deletions cmake_modules/FindEigen.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion ec/hrpEC/hrpEC-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ namespace RTC
#else
RTC::RTObject_var rtc = list[i];
#endif
rtc_names.push_back(std::string(rtc->get_component_profile()->instance_name));
rtc_names.push_back(std::string(RTC::ComponentProfile_var(rtc->get_component_profile())->instance_name));
}
}
printRTCProcessingTime(processes);
Expand Down
9 changes: 7 additions & 2 deletions lib/util/GLsceneBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
#include <map>
#include <sys/time.h>
//Open CV header
#include <cv.h>
#include <highgui.h>
#include <opencv2/core/core_c.h>
#include <opencv2/highgui/highgui_c.h>
#ifndef CV_VERSION_EPOCH
#if CV_VERSION_MAJOR > 3
#include <opencv2/videoio/videoio_c.h>
#endif
#endif
#include <SDL/SDL_thread.h>
#include <hrpCorba/ModelLoader.hh>
#include <hrpModel/ConstraintForceSolver.h>
Expand Down
8 changes: 5 additions & 3 deletions rtc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ if (NOT APPLE AND USE_HRPSYSUTIL)
add_subdirectory(VideoCapture)
endif()

find_package(Irrlicht)
if (IRRLICHT_FOUND AND USE_HRPSYSUTIL)
add_subdirectory(OGMap3DViewer)
if (USE_IRRLICHT AND USE_HRPSYSUTIL)
find_package(Irrlicht)
if(IRRLICHT_FOUND)
add_subdirectory(OGMap3DViewer)
endif()
endif()

# Octomap
Expand Down
34 changes: 19 additions & 15 deletions rtc/CameraImageLoader/CameraImageLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@
* $Id$
*/

#include <cv.h>
#include <highgui.h>
#ifndef CV_VERSION_EPOCH
#define CV_VERSION_EPOCH CV_VERSION_MAJOR
#endif
#if CV_VERSION_EPOCH > 3
#include <opencv2/imgcodecs/imgcodecs.hpp>
#else
#include <opencv2/highgui/highgui.hpp>
#endif
#include "CameraImageLoader.h"

// Module specification
Expand Down Expand Up @@ -116,26 +122,26 @@ RTC::ReturnCode_t CameraImageLoader::onExecute(RTC::UniqueId ec_id)
std::string filename;
std::cin >> filename;

IplImage *image = cvLoadImage(filename.c_str(), CV_LOAD_IMAGE_COLOR);
if (!image) {
cv::Mat image = cv::imread(filename.c_str(), cv::IMREAD_COLOR);
if (image.empty()) {
std::cerr << m_profile.instance_name << ": failed to load("
<< filename << ")" << std::endl;
return RTC::RTC_OK;
}

m_image.data.image.width = image->width;
m_image.data.image.height = image->height;
m_image.data.image.raw_data.length(image->imageSize);
switch(image->nChannels){
m_image.data.image.width = image.size().width;
m_image.data.image.height = image.size().height;
m_image.data.image.raw_data.length(image.size().area());
switch(image.channels()){
case 3:
m_image.data.image.format = Img::CF_RGB;
{
// BGR -> RGB
char *src;
unsigned char *src;
unsigned char *dst = m_image.data.image.raw_data.get_buffer();
for (int i=0; i<image->height; i++){
for (int j=0; j<image->width; j++){
src = image->imageData + image->widthStep*i + j*3;
for (int i=0; i<image.size().height; i++){
for (int j=0; j<image.size().width; j++){
src = image.data + image.step * i + j * 3;
dst[2] = src[0];
dst[1] = src[1];
dst[0] = src[2];
Expand All @@ -147,15 +153,13 @@ RTC::ReturnCode_t CameraImageLoader::onExecute(RTC::UniqueId ec_id)
case 1:
m_image.data.image.format = Img::CF_GRAY;
memcpy(m_image.data.image.raw_data.get_buffer(),
image->imageData,
image.data,
m_image.data.image.raw_data.length());
break;
default:
break;
}

cvReleaseImage (&image);

m_imageOut.write();

return RTC::RTC_OK;
Expand Down
15 changes: 12 additions & 3 deletions rtc/CameraImageSaver/CameraImageSaver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
* $Id$
*/

#include <cv.h>
#include <highgui.h>
#include <opencv2/core/core_c.h>
#include <opencv2/highgui/highgui_c.h>
#ifndef CV_VERSION_EPOCH
#define CV_VERSION_EPOCH CV_VERSION_MAJOR
#endif
#if CV_VERSION_EPOCH > 3
#include <opencv2/imgcodecs/imgcodecs.hpp>
#else
#include <opencv2/highgui/highgui.hpp>
#endif
#include "CameraImageSaver.h"

// Module specification
Expand Down Expand Up @@ -158,7 +166,8 @@ RTC::ReturnCode_t CameraImageSaver::onExecute(RTC::UniqueId ec_id)

char fname[256];
sprintf(fname, "%s%04d.png", m_basename.c_str(), m_count++);
cvSaveImage(fname, cvImage);
cv::Mat image = cv::cvarrToMat(cvImage);
cv::imwrite(fname, image);

cvReleaseImage(&cvImage);
}
Expand Down
4 changes: 2 additions & 2 deletions rtc/CameraImageViewer/CameraImageViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include <rtm/DataOutPort.h>
#include <rtm/idl/BasicDataTypeSkel.h>
#include <rtm/idl/InterfaceDataTypesSkel.h>
#include <cv.h>
#include <highgui.h>
#include <opencv2/core/core_c.h>
#include <opencv2/highgui/highgui_c.h>

// Service implementation headers
// <rtc-template block="service_impl_h">
Expand Down
6 changes: 5 additions & 1 deletion rtc/ColorExtractor/ColorExtractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
* $Id$
*/

#include <highgui.h>
#include <opencv2/highgui/highgui_c.h>
#include <opencv2/imgproc/imgproc_c.h>
#ifndef CV_RGB
#define CV_RGB( r, g, b ) cvScalar( (b), (g), (r), 0 )
#endif
#include "ColorExtractor.h"
#include "hrpsys/util/VectorConvert.h"

Expand Down
2 changes: 1 addition & 1 deletion rtc/ColorExtractor/ColorExtractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <rtm/DataInPort.h>
#include <rtm/DataOutPort.h>
#include <rtm/idl/BasicDataTypeSkel.h>
#include <cv.h>
#include <opencv2/core/core_c.h>

// Service implementation headers
// <rtc-template block="service_impl_h">
Expand Down
2 changes: 1 addition & 1 deletion rtc/ImpedanceController/ImpedanceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ void ImpedanceController::calcForceMoment ()
if ( sensor ) {
// real force sensor
sensorR = sensor->link->R * sensor->localR;
sensorPos = sensor->link->p + sensorR * sensor->localPos;
sensorPos = sensor->link->p + sensor->link->R * sensor->localPos;
} else if ( m_vfs.find(sensor_name) != m_vfs.end()) {
// virtual force sensor
if ( DEBUGP ) {
Expand Down
6 changes: 6 additions & 0 deletions rtc/JpegDecoder/JpegDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#ifndef CV_VERSION_EPOCH
#define CV_VERSION_EPOCH CV_VERSION_MAJOR
#endif
#if CV_VERSION_EPOCH > 3
#include <opencv2/imgcodecs/legacy/constants_c.h>
#endif
#include "JpegDecoder.h"

// Module specification
Expand Down
6 changes: 6 additions & 0 deletions rtc/JpegEncoder/JpegEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
#ifndef CV_VERSION_EPOCH
#define CV_VERSION_EPOCH CV_VERSION_MAJOR
#endif
#if CV_VERSION_EPOCH > 3
#include <opencv2/imgcodecs/legacy/constants_c.h>
#endif
#include "JpegEncoder.h"

// Module specification
Expand Down
Loading