Skip to content

Commit 54c1a64

Browse files
authored
Release 0.7.0 (ROS2)
2 parents 09d97b2 + d43d095 commit 54c1a64

20 files changed

+196
-121
lines changed

.github/workflows/jira-link.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: jira-link
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, reopened, synchronize]
6+
7+
jobs:
8+
jira-link:
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- name: check pull request title and source branch name
12+
run: |
13+
echo "Checking pull request with title ${{ github.event.pull_request.title }} from source branch ${{ github.event.pull_request.head.ref }}"
14+
if ! [[ "${{ github.event.pull_request.title }}" =~ ^AIRO-[0-9]+[[:space:]].*$ ]] && ! [[ "${{ github.event.pull_request.head.ref }}" =~ ^AIRO-[0-9]+.*$ ]]
15+
then
16+
echo -e "Please make sure one of the following is true:\n \
17+
1. the pull request title starts with 'AIRO-xxxx ', e.g. 'AIRO-1024 My Pull Request'\n \
18+
2. the source branch starts with 'AIRO-xxx', e.g. 'AIRO-1024-my-branch'"
19+
exit 1
20+
else
21+
echo "Completed checking"
22+
fi

.github/workflows/pre-commit.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ jobs:
1010
- uses: actions/checkout@v2
1111
- uses: actions/setup-python@v2
1212
with:
13-
python-version: 3.7.x
13+
python-version: 3.7.x
14+

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.DS_Store
22
*.pyc
33
.idea
4+
.coverage
5+
test-results/
46
*~
57
build
68
devel

.yamato/sonar.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Sonarqube Standard Scan
2+
agent:
3+
type: Unity::metal::macmini
4+
image: package-ci/mac
5+
flavor: m1.mac
6+
variables:
7+
SONARQUBE_PROJECT_KEY: ai-robotics-endpoint-ros2
8+
commands:
9+
- curl https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-macosx.zip -o sonar-scanner-macosx.zip -L
10+
- unzip sonar-scanner-macosx.zip -d ~/sonar-scanner
11+
- ~/sonar-scanner/sonar-scanner-4.6.2.2472-macosx/bin/sonar-scanner -Dsonar.projectKey=$SONARQUBE_PROJECT_KEY -Dsonar.sources=. -Dsonar.host.url=$SONARQUBE_ENDPOINT_URL_PRD -Dsonar.login=$SONARQUBE_TOKEN_PRD
12+
triggers:
13+
cancel_old_ci: true
14+
expression: |
15+
((pull_request.target eq "main" OR pull_request.target eq "dev-ros2")
16+
AND NOT pull_request.push.changes.all match "**/*.md") OR
17+
(push.branch eq "main" OR push.branch eq "dev-ros2")

.yamato/yamato-config.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
name: Endpoint Unit Tests
22
agent:
33
type: Unity::VM
4-
image: robotics/ci-ubuntu20:v0.1.0-795910
4+
image: robotics/ci-ros2-galactic-ubuntu20:v0.0.2-916903
55
flavor: i1.large
6+
variables:
7+
# Coverage measured as a percentage (out of 100)
8+
COVERAGE_EXPECTED: 3.5
69
commands:
710
# run unit tests and save test results in /home/bokken/build/output/Unity-Technologies/ROS-TCP-Endpoint
811
- command: |
9-
source /opt/ros/noetic/setup.bash && echo "ROS_DISTRO == $ROS_DISTRO"
10-
cd .. && mkdir -p catkin_ws/src && cp -r ./ROS-TCP-Endpoint catkin_ws/src
11-
cd catkin_ws && catkin_make && source devel/setup.bash
12+
source /opt/ros/galactic/setup.bash && echo "ROS_DISTRO == galactic"
13+
cd .. && mkdir -p ros_ws/src && cp -r ./ROS-TCP-Endpoint ros_ws/src
14+
cd ros_ws && colcon build && source install/local_setup.bash
1215
cd src/ROS-TCP-Endpoint
13-
python3 -m pytest --cov=. --cov-report xml:../../../ROS-TCP-Endpoint/test-results/coverage.xml --cov-report html:../../../ROS-TCP-Endpoint/test-results/coverage.html test/
16+
python3 -m pytest --cov=. --cov-report xml:./test-results/coverage.xml --cov-report html:./test-results/coverage.html test/
1417
# check the test coverage
1518
- command: |
1619
linecoverage=$(head -2 test-results/coverage.xml | grep -Eo 'line-rate="[0-9]+([.][0-9]+)?"' | grep -Eo "[0-9]+([.][0-9]+)?")
1720
echo "Line coverage: $linecoverage"
18-
if (( $(echo "$linecoverage < 0.3" | bc -l) )); then exit 1; fi
21+
if (( $(echo "$linecoverage * 100.0 < $COVERAGE_EXPECTED" | bc -l) ));
22+
then echo "ERROR: Code Coverage is under threshold of $COVERAGE_EXPECTED%" && exit 1
23+
fi
1924
triggers:
2025
cancel_old_ci: true
2126
expression: |
22-
(pull_request.target eq "main" AND
23-
NOT pull_request.push.changes.all match "**/*.md") OR
24-
(pull_request.target eq "dev" AND
25-
NOT pull_request.push.changes.all match "**/*.md")
27+
((pull_request.target eq "main-ros2" OR pull_request.target eq "dev-ros2")
28+
AND NOT pull_request.push.changes.all match "**/*.md") OR
29+
(push.branch eq "main-ros2" OR push.branch eq "dev-ros2")
2630
artifacts:
2731
logs:
2832
paths:

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
1212

1313
### Added
1414

15+
Added Sonarqube scanner
16+
1517
### Changed
1618

1719
### Deprecated
@@ -20,6 +22,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
2022

2123
### Fixed
2224

25+
26+
## [0.7.0] - 2022-02-01
27+
28+
### Added
29+
30+
Added Sonarqube scanner
31+
32+
Send information during hand shaking for ros and package version checks
33+
34+
Send service response as one queue item
35+
36+
2337
## [0.6.0] - 2021-09-30
2438

2539
Add the [Close Stale Issues](https://github.com/marketplace/actions/close-stale-issues) action
@@ -84,4 +98,4 @@ Improving the performance of the read_message in client.py, This is done by rece
8498

8599
Remove outdated handshake references
86100

87-
### Fixed
101+
### Fixed

launch/endpoint.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33

44

55
def generate_launch_description():
6-
return LaunchDescription([
7-
Node(
8-
package='ros_tcp_endpoint',
9-
executable='default_server_endpoint',
10-
emulate_tty=True,
11-
parameters=[
12-
{'ROS_IP': '0.0.0.0'},
13-
{'ROS_TCP_PORT': 10000},
14-
],
15-
),
16-
])
17-
6+
return LaunchDescription(
7+
[
8+
Node(
9+
package="ros_tcp_endpoint",
10+
executable="default_server_endpoint",
11+
emulate_tty=True,
12+
parameters=[{"ROS_IP": "0.0.0.0"}, {"ROS_TCP_PORT": 10000}],
13+
)
14+
]
15+
)

package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
44
<name>ros_tcp_endpoint</name>
5-
<version>0.6.0</version>
5+
<version>0.7.0</version>
66
<description>ROS TCP Endpoint Unity Integration (ROS2 version)
77
Acts as the bridge between Unity messages sent via TCP socket and ROS messages.
88
</description>

ros_tcp_endpoint/client.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def send_ros_service_request(self, srv_id, destination, data):
148148
destination, self.tcp_server.ros_services_table.keys()
149149
)
150150
self.tcp_server.send_unity_error(error_msg)
151-
self.logerr(error_msg)
151+
self.tcp_server.logerr(error_msg)
152152
# TODO: send a response to Unity anyway?
153153
return
154154
else:
@@ -165,18 +165,12 @@ def service_call_thread(self, srv_id, destination, data, ros_communicator):
165165
if not response:
166166
error_msg = "No response data from service '{}'!".format(destination)
167167
self.tcp_server.send_unity_error(error_msg)
168-
self.logerr(error_msg)
168+
self.tcp_server.logerr(error_msg)
169169
# TODO: send a response to Unity anyway?
170170
return
171171

172172
self.tcp_server.unity_tcp_sender.send_ros_service_response(srv_id, destination, response)
173173

174-
def loginfo(self, text):
175-
self.tcp_server.get_logger().info(text)
176-
177-
def logerr(self, text):
178-
self.tcp_server.get_logger().error(text)
179-
180174
def run(self):
181175
"""
182176
Receive a message from Unity and determine where to send it based on the publishers table
@@ -192,7 +186,7 @@ def run(self):
192186
msg: the ROS msg type as bytes
193187
194188
"""
195-
self.loginfo("Connection from {}".format(self.incoming_ip))
189+
self.tcp_server.loginfo("Connection from {}".format(self.incoming_ip))
196190
halt_event = threading.Event()
197191
self.tcp_server.unity_tcp_sender.start_sender(self.conn, halt_event)
198192
try:
@@ -225,10 +219,10 @@ def run(self):
225219
destination, self.tcp_server.publishers_table.keys()
226220
)
227221
self.tcp_server.send_unity_error(error_msg)
228-
self.logerr(error_msg)
222+
self.tcp_server.logerr(error_msg)
229223
except IOError as e:
230-
self.logerr("Exception: {}".format(e))
224+
self.tcp_server.logerr("Exception: {}".format(e))
231225
finally:
232226
halt_event.set()
233227
self.conn.close()
234-
self.loginfo("Disconnected from {}".format(self.incoming_ip))
228+
self.tcp_server.loginfo("Disconnected from {}".format(self.incoming_ip))

ros_tcp_endpoint/communication.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class RosSender(Node):
2020
"""
2121
Base class for ROS communication where data is sent to the ROS network.
2222
"""
23+
2324
def __init__(self, node_name):
2425
super().__init__(node_name)
2526
pass
@@ -32,6 +33,7 @@ class RosReceiver(Node):
3233
"""
3334
Base class for ROS communication where data is being sent outside of the ROS network.
3435
"""
36+
3537
def __init__(self, node_name):
3638
super().__init__(node_name)
3739
pass

0 commit comments

Comments
 (0)