Skip to content

Commit a81119a

Browse files
committed
pre-commit run -a
1 parent a2326ad commit a81119a

21 files changed

+432
-440
lines changed

.gitlab-ci.yml.backup

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ variables:
1111
cache:
1212
paths:
1313
- ccache
14-
14+
1515
.robotpkg-roscontrol-sot: &robotpkg-roscontrol-sot
1616
variables:
1717
ROBOTPKG: roscontrol-sot
@@ -29,7 +29,7 @@ cache:
2929
- make install
3030
- cd work.$(hostname)/$(make show-var VARNAME=DISTNAME)
3131
- make test
32-
32+
3333
except:
3434
- gh-pages
3535

@@ -41,17 +41,17 @@ robotpkg-roscontrol-sot-14.04:
4141
- cd build
4242
- export CCACHE_BASEDIR=${PWD}
4343
- export CCACHE_DIR=${PWD}/ccache
44-
- apt-get update
45-
- apt-get install -y ros-indigo-twist-mux ros-indigo-joy-teleop ros-indigo-moveit-ros-move-group ros-indigo-humanoid-nav-msgs ros-indigo-four-wheel-steering-msgs
44+
- apt-get update
45+
- apt-get install -y ros-indigo-twist-mux ros-indigo-joy-teleop ros-indigo-moveit-ros-move-group ros-indigo-humanoid-nav-msgs ros-indigo-four-wheel-steering-msgs
4646
image: ${IMAGE}:14.04
47-
47+
4848
robotpkg-roscontrol-sot-16.04:
4949
before_script:
5050
- mkdir -p build/ccache
5151
- cd build
5252
- export CCACHE_BASEDIR=${PWD}
5353
- export CCACHE_DIR=${PWD}/ccache
54-
- apt-get update
54+
- apt-get update
5555
- apt-get install -y ros-kinetic-twist-mux ros-kinetic-joy-teleop ros-kinetic-moveit-ros-move-group ros-kinetic-humanoid-nav-msgs ros-kinetic-four-wheel-steering-msgs ros-kinetic-urdf-geometry-parser
5656
script:
5757
- cd /root/robotpkg
@@ -69,7 +69,7 @@ robotpkg-roscontrol-sot-16.04:
6969
except:
7070
- gh-pages
7171
image: ${IMAGE}:16.04
72-
72+
7373
robotpkg-roscontrol-sot-dubnium:
7474
<<: *robotpkg-roscontrol-sot
7575
before_script:
@@ -98,5 +98,5 @@ robotpkg-roscontrol-sot-dubnium:
9898
- make install
9999
- cd work.*/${PROJECT}*/
100100
except:
101-
- gh-pages
102-
image: ${IMAGE}:dubnium
101+
- gh-pages
102+
image: ${IMAGE}:dubnium

CMakeLists.txt

Lines changed: 70 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,57 @@
11
# Copyright (C) 2017-2020 LAAS-CNRS
22
#
3-
# Author: Olivier Stasse
4-
# Author: Guilhem Saurel
3+
# Author: Olivier Stasse Author: Guilhem Saurel
54
#
6-
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
5+
cmake_minimum_required(VERSION 3.1)
76

87
# Project properties
9-
SET(PROJECT_ORG stack-of-tasks)
10-
SET(PROJECT_DESCRIPTION roscontrol_sot)
11-
SET(PROJECT_NAME roscontrol_sot)
12-
SET(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
8+
set(PROJECT_ORG stack-of-tasks)
9+
set(PROJECT_DESCRIPTION roscontrol_sot)
10+
set(PROJECT_NAME roscontrol_sot)
11+
set(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
1312

1413
# Project options
1514

1615
# Project configuration
17-
SET(CXX_DISABLE_WERROR True)
18-
SET(PROJECT_USE_CMAKE_EXPORT TRUE)
16+
set(CXX_DISABLE_WERROR True)
17+
set(PROJECT_USE_CMAKE_EXPORT TRUE)
1918

2019
# JRL-cmakemodule setup
21-
INCLUDE(cmake/base.cmake)
22-
INCLUDE(cmake/boost.cmake)
23-
INCLUDE(cmake/python.cmake)
24-
INCLUDE(cmake/ros.cmake)
20+
include(cmake/base.cmake)
21+
include(cmake/boost.cmake)
22+
include(cmake/python.cmake)
23+
include(cmake/ros.cmake)
2524

2625
# Project definition
27-
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
28-
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
29-
CHECK_MINIMAL_CXX_STANDARD(11 ENFORCE)
26+
compute_project_args(PROJECT_ARGS LANGUAGES CXX)
27+
project(${PROJECT_NAME} ${PROJECT_ARGS})
28+
check_minimal_cxx_standard(11 ENFORCE)
3029

3130
# Project dependencies
32-
FINDPYTHON()
33-
SEARCH_FOR_BOOST_PYTHON()
31+
findpython()
32+
search_for_boost_python()
3433
add_required_dependency(bullet)
3534
add_required_dependency(urdfdom)
3635

37-
find_package(catkin REQUIRED COMPONENTS
38-
pal_hardware_interfaces
39-
controller_interface
40-
controller_manager
41-
pal_common_msgs
42-
roscpp
43-
std_msgs
44-
control_msgs
45-
sensor_msgs
46-
realtime_tools
47-
rospy
48-
)
36+
find_package(
37+
catkin REQUIRED
38+
COMPONENTS pal_hardware_interfaces
39+
controller_interface
40+
controller_manager
41+
pal_common_msgs
42+
roscpp
43+
std_msgs
44+
control_msgs
45+
sensor_msgs
46+
realtime_tools
47+
rospy)
4948
find_package(temperature_sensor_controller)
5049

51-
ADD_PROJECT_DEPENDENCY(dynamic-graph-python 4.0.0 REQUIRED)
52-
ADD_PROJECT_DEPENDENCY(dynamic_graph_bridge REQUIRED)
53-
ADD_PROJECT_DEPENDENCY(sot-core REQUIRED )
54-
ADD_PROJECT_DEPENDENCY(pinocchio REQUIRED)
55-
ADD_PROJECT_DEPENDENCY(control_toolbox REQUIRED)
50+
add_project_dependency(dynamic-graph-python 4.0.0 REQUIRED)
51+
add_project_dependency(dynamic_graph_bridge REQUIRED)
52+
add_project_dependency(sot-core REQUIRED)
53+
add_project_dependency(pinocchio REQUIRED)
54+
add_project_dependency(control_toolbox REQUIRED)
5655

5756
# Detect the controller interface version to switch code
5857
if(controller_interface_FOUND)
@@ -64,43 +63,50 @@ if(controller_interface_FOUND)
6463
endif()
6564
endif()
6665

67-
# Detect if temperature sensor controller package is found
68-
# if yes then it is a PAL Robotics Forked code.
66+
# Detect if temperature sensor controller package is found if yes then it is a
67+
# PAL Robotics Forked code.
6968

70-
add_library(rcsot_controller
71-
src/roscontrol-sot-controller.cpp
72-
src/log.cpp
73-
)
74-
target_include_directories(rcsot_controller SYSTEM PUBLIC
75-
${catkin_INCLUDE_DIRS}
76-
$<INSTALL_INTERFACE:include>)
77-
target_link_libraries(rcsot_controller
78-
${catkin_LIBRARIES}
79-
${bullet_LIBRARIES}
80-
sot-core::sot-core
81-
dynamic_graph_bridge::sot_loader
82-
${control_toolbox_LIBRARIES})
69+
add_library(rcsot_controller src/roscontrol-sot-controller.cpp src/log.cpp)
70+
target_include_directories(
71+
rcsot_controller SYSTEM PUBLIC ${catkin_INCLUDE_DIRS}
72+
$<INSTALL_INTERFACE:include>)
73+
target_link_libraries(
74+
rcsot_controller ${catkin_LIBRARIES} ${bullet_LIBRARIES} sot-core::sot-core
75+
dynamic_graph_bridge::sot_loader ${control_toolbox_LIBRARIES})
8376
if(temperature_sensor_controller_FOUND)
84-
target_compile_definitions(rcsot_controller PUBLIC TEMPERATURE_SENSOR_CONTROLLER)
85-
message("temperature_sensor_controller_LIBRARIES: ${temperature_sensor_controller_LIBRARIES}")
86-
target_include_directories(rcsot_controller SYSTEM PUBLIC ${temperature_sensor_controller_INCLUDE_DIRS})
87-
target_link_libraries(rcsot_controller ${temperature_sensor_controller_LIBRARIES})
77+
target_compile_definitions(rcsot_controller
78+
PUBLIC TEMPERATURE_SENSOR_CONTROLLER)
79+
message(
80+
"temperature_sensor_controller_LIBRARIES: ${temperature_sensor_controller_LIBRARIES}"
81+
)
82+
target_include_directories(
83+
rcsot_controller SYSTEM
84+
PUBLIC ${temperature_sensor_controller_INCLUDE_DIRS})
85+
target_link_libraries(rcsot_controller
86+
${temperature_sensor_controller_LIBRARIES})
8887
endif()
8988

90-
IF(SUFFIX_SO_VERSION)
91-
SET_TARGET_PROPERTIES(rcsot_controller PROPERTIES SOVERSION ${PROJECT_VERSION})
92-
ENDIF(SUFFIX_SO_VERSION)
89+
if(SUFFIX_SO_VERSION)
90+
set_target_properties(rcsot_controller PROPERTIES SOVERSION
91+
${PROJECT_VERSION})
92+
endif(SUFFIX_SO_VERSION)
9393

94-
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
95-
INSTALL(TARGETS rcsot_controller EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
96-
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
94+
if(NOT INSTALL_PYTHON_INTERFACE_ONLY)
95+
install(
96+
TARGETS rcsot_controller
97+
EXPORT ${TARGETS_EXPORT_NAME}
98+
DESTINATION lib)
99+
endif(NOT INSTALL_PYTHON_INTERFACE_ONLY)
97100

98-
ADD_EXECUTABLE(roscontrol-sot-parse-log src/roscontrol-sot-parse-log.cc)
99-
install(TARGETS roscontrol-sot-parse-log EXPORT ${TARGETS_EXPORT_NAME} DESTINATION bin)
101+
add_executable(roscontrol-sot-parse-log src/roscontrol-sot-parse-log.cc)
102+
install(
103+
TARGETS roscontrol-sot-parse-log
104+
EXPORT ${TARGETS_EXPORT_NAME}
105+
DESTINATION bin)
100106

101107
foreach(dir config launch)
102108
install(DIRECTORY ${dir} DESTINATION share/${PROJECT_NAME})
103109
endforeach(dir)
104110

105-
ADD_SUBDIRECTORY(tests)
106-
INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})
111+
add_subdirectory(tests)
112+
install(FILES package.xml DESTINATION share/${PROJECT_NAME})

config/roscontrol_sot_controller_plugins.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@
66
</description>
77
</class>
88
</library>
9-

config/sot_test_params.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ gains:
1010
joint_state_controller:
1111
type: joint_state_controller/JointStateController
1212
publish_rate: 50
13-
13+
1414
sot_controller:
1515
type: sot_controller/RCSotController
1616
libname: libsot-test-controller.so
@@ -39,4 +39,3 @@ sot_controller:
3939
dt: 0.001
4040
jitter: 0.0004
4141
verbosity_level: 25
42-

doc/additionalHeader/roscontrol-sot-doc.hh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ the SoT.
142142
The size of double vector and the map key are computed automatically depending
143143
on the number of sensors and actuators provided by the robot_hardware_interface.
144144
145-
\image html class-diagram.svg "Class diagram with implementation for Tiago robot (in sot-tiago)"
145+
\image html class-diagram.svg "Class diagram with implementation for Tiago robot
146+
(in sot-tiago)"
146147
147148
\section section_yamlfile Setting the YAML file.
148149

launch/roscontrol_sot_hardware.launch

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!-- Load URDF file -->
44
<param name="robot_description" command="$(find xacro)/xacro.py $(find roscontrol_sot)/urdf/test.urdf" />
5-
5+
66
<!-- Spawn simulated hardware -->
77
<node name="roscontrol_sot_hardware_spawner"
88
pkg="roscontrol_sot" type="roscontrol_sot_hardware" output="screen"
@@ -21,7 +21,6 @@
2121
<node name="sot_controller_spawner"
2222
pkg="controller_manager" type="spawner" output="screen"
2323
args="sot_controller" />
24-
2524

26-
</launch>
2725

26+
</launch>

src/log.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
Object to log the low-level informations of a robot.
55
*/
66
#include "log.hh"
7+
8+
#include <sys/time.h>
9+
710
#include <fstream>
811
#include <iomanip>
912
#include <sstream>
10-
#include <sys/time.h>
1113

1214
using namespace std;
1315
using namespace rc_sot_system;
@@ -24,28 +26,28 @@ void DataToLog::init(ProfileLog &aProfileLog) {
2426
orientation.resize(4 * aProfileLog.length);
2527
accelerometer.resize(3 * aProfileLog.length);
2628
gyrometer.resize(3 * aProfileLog.length);
27-
force_sensors.resize(aProfileLog.nbForceSensors*6*aProfileLog.length);
29+
force_sensors.resize(aProfileLog.nbForceSensors * 6 * aProfileLog.length);
2830
temperatures.resize(aProfileLog.nbDofs * aProfileLog.length);
2931
controls.resize(aProfileLog.nbDofs * aProfileLog.length);
3032
timestamp.resize(aProfileLog.length);
3133
duration.resize(aProfileLog.length);
3234

3335
for (unsigned int i = 0; i < aProfileLog.nbDofs * aProfileLog.length; i++) {
3436
motor_angle[i] = joint_angle[i] = velocities[i] = torques[i] =
35-
motor_currents[i] = temperatures[i] = controls[i] = 0.0;
37+
motor_currents[i] = temperatures[i] = controls[i] = 0.0;
3638
}
3739
for (unsigned int i = 0; i < 4 * aProfileLog.length; i++) {
3840
orientation[i] = 0;
3941
}
4042
for (unsigned int i = 0; i < 3 * aProfileLog.length; i++) {
4143
accelerometer[i] = gyrometer[i] = 0;
4244
}
43-
for (unsigned int i = 0; i < aProfileLog.nbForceSensors*6*aProfileLog.length;
44-
i++) {
45+
for (unsigned int i = 0;
46+
i < aProfileLog.nbForceSensors * 6 * aProfileLog.length; i++) {
4547
force_sensors[i] = 0;
4648
}
4749
for (unsigned int i = 0; i < aProfileLog.length; i++) {
48-
timestamp[i] = duration[i] = 0;
50+
timestamp[i] = duration[i] = 0;
4951
}
5052
}
5153

@@ -116,7 +118,7 @@ void Log::record(DataToLog &aDataToLog) {
116118
lref_ = 0;
117119
lrefts_ = 0;
118120
}
119-
assert(lref_ == lrefts_*profileLog_.nbDofs);
121+
assert(lref_ == lrefts_ * profileLog_.nbDofs);
120122
}
121123

122124
void Log::start_it() {
@@ -140,7 +142,7 @@ double Log::stop_it() {
140142
}
141143

142144
void Log::save(std::string &fileName) {
143-
assert(lref_ == lrefts_*profileLog_.nbDofs);
145+
assert(lref_ == lrefts_ * profileLog_.nbDofs);
144146

145147
std::string suffix("-mastate.log");
146148
saveVector(fileName, suffix, StoredData_.motor_angle, profileLog_.nbDofs);
@@ -162,7 +164,7 @@ void Log::save(std::string &fileName) {
162164
suffix = oss.str();
163165
if (profileLog_.nbForceSensors > 0) {
164166
saveVector(fileName, suffix, StoredData_.force_sensors,
165-
6 * profileLog_.nbForceSensors);
167+
6 * profileLog_.nbForceSensors);
166168
}
167169

168170
suffix = "-temperatures.log";

src/log.hh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct DataToLog {
5757
};
5858

5959
class Log {
60-
private:
60+
private:
6161
/// Profile Log
6262
ProfileLog profileLog_;
6363

@@ -79,10 +79,9 @@ private:
7979
// \note avector is a circular buffer. Data will be written from
8080
// start to N, and then from 0 to start.
8181
void saveVector(std::string &filename, std::string &suffix,
82-
const std::vector<double> &avector,
83-
std::size_t size);
82+
const std::vector<double> &avector, std::size_t size);
8483

85-
public:
84+
public:
8685
Log();
8786

8887
void init(ProfileLog &aProfileLog);
@@ -93,7 +92,7 @@ public:
9392
/// \return the elapsed time since the previous \ref start_it
9493
double stop_it();
9594
};
96-
} // namespace rc_sot_system
95+
} // namespace rc_sot_system
9796

9897
#pragma GCC diagnostic push
9998
#pragma GCC system_header

0 commit comments

Comments
 (0)