Skip to content

Commit 7f0ea87

Browse files
authored
Merge pull request #9 from CMU-cabot/fix-lint-errors
Fix lint errors
2 parents d9310c1 + 4d90fed commit 7f0ea87

38 files changed

+1310
-939
lines changed

.github/workflows/run-test.yaml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Run Unittest
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches:
7+
- main
8+
types:
9+
- opened
10+
- reopened
11+
- synchronize
12+
13+
jobs:
14+
run_unittest:
15+
runs-on: ubuntu-20.04
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install vcs
20+
run: pip3 install vcstool
21+
22+
- name: Prepare thirdparty repos
23+
run: ./setup-dependency.sh
24+
25+
- name: Pull images and build workspace
26+
shell: bash
27+
run: ./manage-docker-image.sh -a pull -i "ble_scan" -o cmucal -t ros2-dev-latest
28+
29+
- name: Build
30+
shell: bash
31+
run: ./build-docker.sh -w driver
32+
33+
- name: Run unittest
34+
shell: bash
35+
run: docker compose run --rm driver ./script/unittest.sh -a

cabot_base/CMakeLists.txt

+14-8
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,20 @@ ament_target_dependencies(cabot_handle_v3_lib
4545
)
4646

4747
if(BUILD_TESTING)
48-
find_package(ament_lint_auto REQUIRED)
49-
# the following line skips the linter which checks for copyrights
50-
# uncomment the line when a copyright and license is not present in all source files
51-
#set(ament_cmake_copyright_FOUND TRUE)
52-
# the following line skips cpplint (only works in a git repo)
53-
# uncomment the line when this package is not in a git repo
54-
#set(ament_cmake_cpplint_FOUND TRUE)
55-
ament_lint_auto_find_test_dependencies()
48+
find_package(ament_cmake_copyright REQUIRED)
49+
find_package(ament_cmake_cpplint REQUIRED)
50+
find_package(ament_cmake_flake8 REQUIRED)
51+
find_package(ament_cmake_lint_cmake REQUIRED)
52+
find_package(ament_cmake_uncrustify REQUIRED)
53+
find_package(ament_cmake_xmllint REQUIRED)
54+
55+
set(MAX_LINE_LENGTH 200)
56+
ament_copyright()
57+
ament_cpplint(MAX_LINE_LENGTH ${MAX_LINE_LENGTH})
58+
ament_flake8(MAX_LINE_LENGTH ${MAX_LINE_LENGTH})
59+
ament_lint_cmake()
60+
ament_uncrustify(MAX_LINE_LENGTH ${MAX_LINE_LENGTH})
61+
ament_xmllint()
5662
endif()
5763

5864
# Install Python modules

cabot_base/cabot_base/handle_v2.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def _button_check(self, msg, key, index):
9999
now - self.lastUp[index] < self.ignore_interval):
100100
event = {"button": key, "up": False}
101101
self.btnDwn[index] = True
102-
self.lastDwn[index] = now # for holddown detection
102+
self.lastDwn[index] = now # for holddown detection
103103
# detect change from button down to button up to emit a button up event
104104
if not msg.data and self.btnDwn[index]:
105105
event = {"button": key, "up": True}
@@ -117,9 +117,9 @@ def _button_check(self, msg, key, index):
117117
self.upCount[index] = 0
118118
# detect button hold down to emit a holddown event
119119
if msg.data and self.btnDwn[index] and \
120-
(self.lastDwn[index] is not None and \
120+
(self.lastDwn[index] is not None and
121121
now - self.lastDwn[index] > self.holddown_interval):
122-
event = {"holddown":key}
122+
event = {"holddown": key}
123123
# clear lastDwn[index] after holddown event emission to prevent multiple event emissions
124124
self.lastDwn[index] = None
125125

cabot_base/launch/cabot2-remote.launch.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def generate_launch_description():
133133
parameters=[*param_files],
134134
remappings=[
135135
('/imu', '/cabot/imu/data'),
136-
('/cmd_vel', '/cabot/cmd_vel'), # /cabot/cmd_vel is directly input to motor_adapter in remote mode
136+
('/cmd_vel', '/cabot/cmd_vel'), # /cabot/cmd_vel is directly input to motor_adapter in remote mode
137137
],
138138
),
139139

@@ -186,7 +186,7 @@ def generate_launch_description():
186186
package='joy_linux',
187187
executable='joy_linux_node',
188188
namespace='cabot',
189-
name='joy_node', # keep the node name joy_node to keep using the same parameters
189+
name='joy_node', # keep the node name joy_node to keep using the same parameters
190190
parameters=[*param_files],
191191
condition=IfCondition(use_joy_linux),
192192
),

cabot_base/launch/cabot2.launch.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ def generate_launch_description():
293293
]
294294
),
295295
LoadComposableNodes(
296-
target_container= '/cabot_nodes_container',
297-
condition=IfCondition(use_sim_time) ,
296+
target_container='/cabot_nodes_container',
297+
condition=IfCondition(use_sim_time),
298298
composable_node_descriptions=[
299299
# Microcontroller (Arduino - gt1/gtm or ESP32 - ace)
300300
ComposableNode(
@@ -313,8 +313,8 @@ def generate_launch_description():
313313
]
314314
),
315315
LoadComposableNodes(
316-
target_container= '/cabot_nodes_container',
317-
condition=UnlessCondition(use_sim_time) ,
316+
target_container='/cabot_nodes_container',
317+
condition=UnlessCondition(use_sim_time),
318318
composable_node_descriptions=[
319319
ComposableNode(
320320
package='cabot_serial',
@@ -339,16 +339,16 @@ def generate_launch_description():
339339
]
340340
),
341341
LoadComposableNodes(
342-
target_container= '/cabot_nodes_container',
343-
condition=IfCondition(use_standalone_wifi_scanner) ,
342+
target_container='/cabot_nodes_container',
343+
condition=IfCondition(use_standalone_wifi_scanner),
344344
composable_node_descriptions=[
345345
# optional wifi scanner with ESP32
346346
ComposableNode(
347347
package='cabot_serial',
348348
plugin='CaBotSerialNode',
349349
namespace='/cabot',
350350
name='serial_esp32_wifi_scanner',
351-
parameters=[*param_files,{'use_sim_time': use_sim_time}],
351+
parameters=[*param_files, {'use_sim_time': use_sim_time}],
352352
remappings=[('wifi_scan_str', '/esp32/wifi_scan_str')],
353353
),
354354
]

cabot_base/launch/cabot3-remote.launch.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def generate_launch_description():
143143
parameters=[*param_files],
144144
remappings=[
145145
('/imu', '/cabot/imu/data'),
146-
('/cmd_vel', '/cabot/cmd_vel'), # /cabot/cmd_vel is directly input to motor_adapter in remote mode
146+
('/cmd_vel', '/cabot/cmd_vel'), # /cabot/cmd_vel is directly input to motor_adapter in remote mode
147147
],
148148
),
149149

@@ -201,7 +201,7 @@ def generate_launch_description():
201201
package='joy_linux',
202202
executable='joy_linux_node',
203203
namespace='cabot',
204-
name='joy_node', # keep the node name joy_node to keep using the same parameters
204+
name='joy_node', # keep the node name joy_node to keep using the same parameters
205205
parameters=[*param_files],
206206
condition=IfCondition(use_joy_linux),
207207
),

cabot_base/launch/include/livox_lidar_msg.launch.py

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
# SOFTWARE.
2020

21-
import os
2221
from ament_index_python.packages import get_package_share_directory
2322
from launch import LaunchDescription
2423
from launch.actions import DeclareLaunchArgument

cabot_base/src/cabot/button.hpp

+19-21
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
/*******************************************************************************
2-
* Copyright (c) 2023 Miraikan and Carnegie Mellon University
3-
*
4-
* Permission is hereby granted, free of charge, to any person obtaining a copy
5-
* of this software and associated documentation files (the "Software"), to deal
6-
* in the Software without restriction, including without limitation the rights
7-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8-
* copies of the Software, and to permit persons to whom the Software is
9-
* furnished to do so, subject to the following conditions:
10-
*
11-
* The above copyright notice and this permission notice shall be included in
12-
* all copies or substantial portions of the Software.
13-
*
14-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20-
* THE SOFTWARE.
21-
*******************************************************************************/
1+
// Copyright (c) 2023 Miraikan and Carnegie Mellon University
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy
4+
// of this software and associated documentation files (the "Software"), to deal
5+
// in the Software without restriction, including without limitation the rights
6+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
// copies of the Software, and to permit persons to whom the Software is
8+
// furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in all
11+
// copies or substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
// SOFTWARE.
2220

2321
#ifndef CABOT__BUTTON_HPP_
2422
#define CABOT__BUTTON_HPP_

cabot_base/src/cabot/cabot_handle_v2_node.cpp

+19-21
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
/*******************************************************************************
2-
* Copyright (c) 2023 Miraikan and Carnegie Mellon University
3-
*
4-
* Permission is hereby granted, free of charge, to any person obtaining a copy
5-
* of this software and associated documentation files (the "Software"), to deal
6-
* in the Software without restriction, including without limitation the rights
7-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8-
* copies of the Software, and to permit persons to whom the Software is
9-
* furnished to do so, subject to the following conditions:
10-
*
11-
* The above copyright notice and this permission notice shall be included in
12-
* all copies or substantial portions of the Software.
13-
*
14-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20-
* THE SOFTWARE.
21-
*******************************************************************************/
1+
// Copyright (c) 2023 Miraikan and Carnegie Mellon University
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy
4+
// of this software and associated documentation files (the "Software"), to deal
5+
// in the Software without restriction, including without limitation the rights
6+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
// copies of the Software, and to permit persons to whom the Software is
8+
// furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in all
11+
// copies or substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
// SOFTWARE.
2220

2321
#include <memory>
2422
#include <vector>

cabot_base/src/cabot/cabot_handle_v2_node.hpp

+19-21
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
/*******************************************************************************
2-
* Copyright (c) 2023 Miraikan and Carnegie Mellon University
3-
*
4-
* Permission is hereby granted, free of charge, to any person obtaining a copy
5-
* of this software and associated documentation files (the "Software"), to deal
6-
* in the Software without restriction, including without limitation the rights
7-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8-
* copies of the Software, and to permit persons to whom the Software is
9-
* furnished to do so, subject to the following conditions:
10-
*
11-
* The above copyright notice and this permission notice shall be included in
12-
* all copies or substantial portions of the Software.
13-
*
14-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20-
* THE SOFTWARE.
21-
*******************************************************************************/
1+
// Copyright (c) 2023 Miraikan and Carnegie Mellon University
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy
4+
// of this software and associated documentation files (the "Software"), to deal
5+
// in the Software without restriction, including without limitation the rights
6+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
// copies of the Software, and to permit persons to whom the Software is
8+
// furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in all
11+
// copies or substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
// SOFTWARE.
2220

2321
#ifndef CABOT__CABOT_HANDLE_V2_NODE_HPP_
2422
#define CABOT__CABOT_HANDLE_V2_NODE_HPP_

cabot_base/src/cabot/cabot_handle_v3_node.cpp

+19-22
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
1-
/*******************************************************************************
2-
* Copyright (c) 2023 Miraikan and Carnegie Mellon University
3-
* Copyright (c) 2024 ALPS ALPINE CO., LTD.
4-
*
5-
* Permission is hereby granted, free of charge, to any person obtaining a copy
6-
* of this software and associated documentation files (the "Software"), to deal
7-
* in the Software without restriction, including without limitation the rights
8-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
* copies of the Software, and to permit persons to whom the Software is
10-
* furnished to do so, subject to the following conditions:
11-
*
12-
* The above copyright notice and this permission notice shall be included in
13-
* all copies or substantial portions of the Software.
14-
*
15-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
* THE SOFTWARE.
22-
*******************************************************************************/
1+
// Copyright (c) 2023, 2024 Miraikan, Carnegie Mellon University, and ALPS ALPINE CO., LTD.
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy
4+
// of this software and associated documentation files (the "Software"), to deal
5+
// in the Software without restriction, including without limitation the rights
6+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
// copies of the Software, and to permit persons to whom the Software is
8+
// furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in all
11+
// copies or substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
// SOFTWARE.
2320

2421
#include <memory>
2522
#include <vector>

cabot_base/src/cabot/cabot_handle_v3_node.hpp

+19-22
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
1-
/*******************************************************************************
2-
* Copyright (c) 2023 Miraikan and Carnegie Mellon University
3-
* Copyright (c) 2024 ALPS ALPINE CO., LTD.
4-
*
5-
* Permission is hereby granted, free of charge, to any person obtaining a copy
6-
* of this software and associated documentation files (the "Software"), to deal
7-
* in the Software without restriction, including without limitation the rights
8-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
* copies of the Software, and to permit persons to whom the Software is
10-
* furnished to do so, subject to the following conditions:
11-
*
12-
* The above copyright notice and this permission notice shall be included in
13-
* all copies or substantial portions of the Software.
14-
*
15-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
* THE SOFTWARE.
22-
*******************************************************************************/
1+
// Copyright (c) 2023, 2024 Miraikan, Carnegie Mellon University, and ALPS ALPINE CO., LTD.
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a copy
4+
// of this software and associated documentation files (the "Software"), to deal
5+
// in the Software without restriction, including without limitation the rights
6+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
// copies of the Software, and to permit persons to whom the Software is
8+
// furnished to do so, subject to the following conditions:
9+
//
10+
// The above copyright notice and this permission notice shall be included in all
11+
// copies or substantial portions of the Software.
12+
//
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
// SOFTWARE.
2320

2421
#ifndef CABOT__CABOT_HANDLE_V3_NODE_HPP_
2522
#define CABOT__CABOT_HANDLE_V3_NODE_HPP_

0 commit comments

Comments
 (0)