Skip to content

Commit bb2f33f

Browse files
author
Vatan Aksoy Tezer
committed
Merged in pr-ci_setup (pull request #3)
Add CI and pre-commit and apply relevant formatting fixes * Add CI, pre commit and clang-format * pre-commit fixes * Add pre-commit docs Approved-by: Andy Zelenak
1 parent daea015 commit bb2f33f

File tree

887 files changed

+71184
-57581
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

887 files changed

+71184
-57581
lines changed

.clang-format

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
BasedOnStyle: Google
3+
ColumnLimit: 120
4+
MaxEmptyLinesToKeep: 1
5+
SortIncludes: false
6+
7+
Standard: Auto
8+
IndentWidth: 2
9+
TabWidth: 2
10+
UseTab: Never
11+
AccessModifierOffset: -2
12+
ConstructorInitializerIndentWidth: 2
13+
NamespaceIndentation: None
14+
ContinuationIndentWidth: 4
15+
IndentCaseLabels: true
16+
IndentFunctionDeclarationAfterType: false
17+
18+
AlignEscapedNewlinesLeft: false
19+
AlignTrailingComments: true
20+
21+
AllowAllParametersOfDeclarationOnNextLine: false
22+
ExperimentalAutoDetectBinPacking: false
23+
ObjCSpaceBeforeProtocolList: true
24+
Cpp11BracedListStyle: false
25+
26+
AllowShortBlocksOnASingleLine: true
27+
AllowShortIfStatementsOnASingleLine: false
28+
AllowShortLoopsOnASingleLine: false
29+
AllowShortFunctionsOnASingleLine: None
30+
AllowShortCaseLabelsOnASingleLine: false
31+
32+
AlwaysBreakTemplateDeclarations: true
33+
AlwaysBreakBeforeMultilineStrings: false
34+
BreakBeforeBinaryOperators: false
35+
BreakBeforeTernaryOperators: false
36+
BreakConstructorInitializersBeforeComma: true
37+
38+
BinPackParameters: true
39+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
40+
DerivePointerBinding: false
41+
PointerBindsToType: true
42+
43+
PenaltyExcessCharacter: 50
44+
PenaltyBreakBeforeFirstCallParameter: 30
45+
PenaltyBreakComment: 1000
46+
PenaltyBreakFirstLessLess: 10
47+
PenaltyBreakString: 100
48+
PenaltyReturnTypeOnItsOwnLine: 50
49+
50+
SpacesBeforeTrailingComments: 2
51+
SpacesInParentheses: false
52+
SpacesInAngles: false
53+
SpaceInEmptyParentheses: false
54+
SpacesInCStyleCastParentheses: false
55+
SpaceAfterCStyleCast: false
56+
SpaceAfterControlStatementKeyword: true
57+
SpaceBeforeAssignmentOperators: true
58+
59+
# Configure each individual brace in BraceWrapping
60+
BreakBeforeBraces: Custom
61+
62+
# Control of individual brace wrapping cases
63+
BraceWrapping:
64+
AfterCaseLabel: true
65+
AfterClass: true
66+
AfterControlStatement: true
67+
AfterEnum: true
68+
AfterFunction: true
69+
AfterNamespace: true
70+
AfterStruct: true
71+
AfterUnion: true
72+
BeforeCatch: true
73+
BeforeElse: true
74+
IndentBraces: false
75+
...

.pre-commit-config.yaml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# To use:
2+
#
3+
# pre-commit run -a
4+
#
5+
# Or:
6+
#
7+
# pre-commit install # (runs every time you commit in git)
8+
#
9+
# To update this file:
10+
#
11+
# pre-commit autoupdate
12+
#
13+
# See https://github.com/pre-commit/pre-commit
14+
15+
repos:
16+
# Standard hooks
17+
- repo: https://github.com/pre-commit/pre-commit-hooks
18+
rev: v3.4.0
19+
hooks:
20+
- id: check-added-large-files
21+
- id: check-case-conflict
22+
- id: check-json
23+
- id: check-merge-conflict
24+
- id: check-symlinks
25+
- id: check-toml
26+
- id: check-yaml
27+
- id: debug-statements
28+
- id: destroyed-symlinks
29+
- id: detect-private-key
30+
- id: end-of-file-fixer
31+
- id: mixed-line-ending
32+
- id: pretty-format-json
33+
- id: trailing-whitespace
34+
35+
- repo: https://github.com/psf/black
36+
rev: 20.8b1
37+
hooks:
38+
- id: black
39+
40+
- repo: local
41+
hooks:
42+
- id: clang-format
43+
name: clang-format
44+
description: Format files with ClangFormat.
45+
entry: clang-format
46+
language: system
47+
files: \.(c|cc|cxx|cpp|frag|glsl|h|hpp|hxx|ih|ispc|ipp|java|js|m|proto|vert)$
48+
args: ['-fallback-style=none', '-i']

LICENSE

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ and/or other materials provided with the distribution.
1010
* Neither the name of the copyright holder nor the names of its contributors
1111
may be used to endorse or promote products derived from this software
1212
without specific prior written permission.
13-
13+
1414
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1515
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1616
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -59,4 +59,4 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5959
Code generated by the Protocol Buffer compiler is owned by the owner
6060
of the input file used when generating it. This code is not
6161
standalone and requires a support library to be linked with it. This
62-
support library is itself covered by the above license.
62+
support library is itself covered by the above license.

bitbucket-pipelines.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
image: docker:git
2+
3+
pipelines:
4+
pull-requests:
5+
'**':
6+
- step:
7+
name: Formatting (pre-commit) (PR)
8+
services:
9+
- docker
10+
script:
11+
- apk add --update py3-pip gcc python3 python3-dev musl-dev
12+
- pip3 install pre-commit
13+
- pre-commit run -a
14+
- step:
15+
name: Industrial CI (PR)
16+
services:
17+
- docker
18+
script:
19+
- apk add --update bash coreutils tar
20+
- git clone --quiet --depth 1 https://github.com/ros-industrial/industrial_ci .industrial_ci -b master
21+
- .industrial_ci/bitbucket.sh ROS_DISTRO=foxy
22+
branches:
23+
"master":
24+
- step:
25+
name: Formatting (pre-commit) (Master)
26+
services:
27+
- docker
28+
script:
29+
- apk add --update py3-pip gcc python3 python3-dev musl-dev
30+
- pip3 install pre-commit
31+
- pre-commit run -a
32+
- step:
33+
name: Industrial CI (Master)
34+
services:
35+
- docker
36+
script:
37+
- apk add --update bash coreutils tar
38+
- git clone --quiet --depth 1 https://github.com/ros-industrial/industrial_ci .industrial_ci -b master
39+
- .industrial_ci/bitbucket.sh ROS_DISTRO=foxy
40+
custom:
41+
"Build and Test":
42+
- step:
43+
name: Industrial CI (Manual Trigger)
44+
services:
45+
- docker
46+
script:
47+
- apk add --update bash coreutils tar
48+
- git clone --quiet --depth 1 https://github.com/ros-industrial/industrial_ci .industrial_ci -b master
49+
- .industrial_ci/bitbucket.sh ROS_DISTRO=foxy
50+
"Formatting (pre-commit) (Manual Trigger)":
51+
- step:
52+
name: Formatting (pre-commit)
53+
services:
54+
- docker
55+
script:
56+
- apk add --update py3-pip gcc python3 python3-dev musl-dev
57+
- pip3 install pre-commit
58+
- pre-commit run -a
59+
60+
definitions:
61+
services:
62+
docker:
63+
memory: 2048

kortex2_bringup/launch/kortex_control.launch.py

+17-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717
from launch import LaunchDescription
1818
from launch.actions import DeclareLaunchArgument
1919
from launch.conditions import IfCondition
20-
from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution
20+
from launch.substitutions import (
21+
Command,
22+
FindExecutable,
23+
LaunchConfiguration,
24+
PathJoinSubstitution,
25+
)
2126
from launch_ros.actions import Node
2227
from launch_ros.substitutions import FindPackageShare
2328

@@ -106,7 +111,9 @@ def generate_launch_description():
106111
)
107112
)
108113
declared_arguments.append(
109-
DeclareLaunchArgument("launch_rviz", default_value="true", description="Launch RViz?")
114+
DeclareLaunchArgument(
115+
"launch_rviz", default_value="true", description="Launch RViz?"
116+
)
110117
)
111118

112119
# Initialize Arguments
@@ -128,7 +135,9 @@ def generate_launch_description():
128135
[
129136
PathJoinSubstitution([FindExecutable(name="xacro")]),
130137
" ",
131-
PathJoinSubstitution([FindPackageShare(description_package), "robots", description_file]),
138+
PathJoinSubstitution(
139+
[FindPackageShare(description_package), "robots", description_file]
140+
),
132141
" ",
133142
"robot_ip:=",
134143
robot_ip,
@@ -186,7 +195,11 @@ def generate_launch_description():
186195
joint_state_broadcaster_spawner = Node(
187196
package="controller_manager",
188197
executable="spawner.py",
189-
arguments=["joint_state_broadcaster", "--controller-manager", "/controller_manager"],
198+
arguments=[
199+
"joint_state_broadcaster",
200+
"--controller-manager",
201+
"/controller_manager",
202+
],
190203
)
191204

192205
robot_controller_spawner = Node(

kortex2_bringup/launch/kortex_moveit.launch.py

+20-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@
2121
from launch import LaunchDescription
2222
from launch.actions import DeclareLaunchArgument
2323
from launch.conditions import IfCondition
24-
from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution
24+
from launch.substitutions import (
25+
Command,
26+
FindExecutable,
27+
LaunchConfiguration,
28+
PathJoinSubstitution,
29+
)
2530
from launch_ros.actions import Node
2631
from launch_ros.substitutions import FindPackageShare
2732

@@ -106,7 +111,9 @@ def generate_launch_description():
106111
)
107112
)
108113
declared_arguments.append(
109-
DeclareLaunchArgument("launch_rviz", default_value="true", description="Launch RViz?")
114+
DeclareLaunchArgument(
115+
"launch_rviz", default_value="true", description="Launch RViz?"
116+
)
110117
)
111118

112119
# Initialize Arguments
@@ -122,12 +129,13 @@ def generate_launch_description():
122129
fake_sensor_commands = LaunchConfiguration("fake_sensor_commands")
123130
launch_rviz = LaunchConfiguration("launch_rviz")
124131

125-
126132
robot_description_content = Command(
127133
[
128134
PathJoinSubstitution([FindExecutable(name="xacro")]),
129135
" ",
130-
PathJoinSubstitution([FindPackageShare(description_package), "robots", description_file]),
136+
PathJoinSubstitution(
137+
[FindPackageShare(description_package), "robots", description_file]
138+
),
131139
" ",
132140
"robot_ip:=",
133141
robot_ip,
@@ -154,15 +162,21 @@ def generate_launch_description():
154162
PathJoinSubstitution([FindExecutable(name="xacro")]),
155163
" ",
156164
PathJoinSubstitution(
157-
[FindPackageShare(moveit_config_package), "config/7dof", moveit_config_file]
165+
[
166+
FindPackageShare(moveit_config_package),
167+
"config/7dof",
168+
moveit_config_file,
169+
]
158170
),
159171
" ",
160172
"prefix:=",
161173
prefix,
162174
" ",
163175
]
164176
)
165-
robot_description_semantic = {"robot_description_semantic": robot_description_semantic_content}
177+
robot_description_semantic = {
178+
"robot_description_semantic": robot_description_semantic_content
179+
}
166180

167181
kinematics_yaml = load_yaml("gen3_move_it_config", "config/kinematics.yaml")
168182
robot_description_kinematics = {"robot_description_kinematics": kinematics_yaml}
+31-28
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef _I_ROUTER_CLIENT_H_
22
#define _I_ROUTER_CLIENT_H_
33

4-
54
#include <string>
65
#include <future>
76
#include <functional>
@@ -18,38 +17,42 @@ namespace Kinova
1817
{
1918
namespace Api
2019
{
21-
typedef std::function<void (const Kinova::Api::Frame&)> MessageCallback;
20+
typedef std::function<void(const Kinova::Api::Frame&)> MessageCallback;
21+
22+
typedef struct
23+
{
24+
bool andForget;
25+
uint32_t delay_ms;
26+
uint32_t timeout_ms;
2227

23-
typedef struct
24-
{
25-
bool andForget;
26-
uint32_t delay_ms;
27-
uint32_t timeout_ms;
28-
29-
} RouterClientSendOptions;
28+
} RouterClientSendOptions;
3029

31-
class IRouterClient
32-
{
33-
public:
34-
virtual ~IRouterClient() {}
30+
class IRouterClient
31+
{
32+
public:
33+
virtual ~IRouterClient()
34+
{
35+
}
3536

36-
virtual void reset() = 0;
37-
virtual void registerBridgingCallback(std::function<void (Frame &)> bridgingCallback) = 0;
38-
virtual void registerNotificationCallback( uint32_t serviceId, function<Error (Frame&)> ) = 0;
39-
virtual void registerErrorCallback( function<void(KError)> callback ) = 0;
40-
virtual void registerHitCallback(std::function<void (FrameTypes)> hitSessionCallback) = 0;
37+
virtual void reset() = 0;
38+
virtual void registerBridgingCallback(std::function<void(Frame&)> bridgingCallback) = 0;
39+
virtual void registerNotificationCallback(uint32_t serviceId, function<Error(Frame&)>) = 0;
40+
virtual void registerErrorCallback(function<void(KError)> callback) = 0;
41+
virtual void registerHitCallback(std::function<void(FrameTypes)> hitSessionCallback) = 0;
4142

42-
virtual future<Frame> send(const std::string& txPayload, uint32_t serviceVersion, uint32_t funcId, uint32_t deviceId, const RouterClientSendOptions& options ) = 0;
43-
virtual Error sendWithCallback(const std::string& txPayload, uint32_t serviceVersion, uint32_t funcId, uint32_t deviceId, MessageCallback callback) = 0;
44-
virtual Error sendMsgFrame(const Frame& msgFrame) = 0;
43+
virtual future<Frame> send(const std::string& txPayload, uint32_t serviceVersion, uint32_t funcId, uint32_t deviceId,
44+
const RouterClientSendOptions& options) = 0;
45+
virtual Error sendWithCallback(const std::string& txPayload, uint32_t serviceVersion, uint32_t funcId,
46+
uint32_t deviceId, MessageCallback callback) = 0;
47+
virtual Error sendMsgFrame(const Frame& msgFrame) = 0;
4548

46-
virtual uint16_t getConnectionId() = 0;
47-
virtual void SetActivationStatus(bool isActive) = 0;
49+
virtual uint16_t getConnectionId() = 0;
50+
virtual void SetActivationStatus(bool isActive) = 0;
4851

49-
virtual ITransportClient* getTransport() = 0;
50-
};
52+
virtual ITransportClient* getTransport() = 0;
53+
};
5154

52-
} // namespace Api
53-
} // namespace Kinova
55+
} // namespace Api
56+
} // namespace Kinova
5457

55-
#endif // _I_ROUTER_CLIENT_H_
58+
#endif // _I_ROUTER_CLIENT_H_

0 commit comments

Comments
 (0)