-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Robot existense test, with a planned failure to verify that it is run…
…ning Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
- Loading branch information
1 parent
1b4e8b9
commit c79371a
Showing
2 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
free_fleet_adapter/tests/integration/test_nav2_robot_adapter.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright 2024 Open Source Robotics Foundation, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import time | ||
|
||
from free_fleet_adapter.nav2_robot_adapter import Nav2RobotAdapter | ||
from tf2_ros import Buffer | ||
|
||
import zenoh | ||
|
||
|
||
def test_robot_does_not_exist(): | ||
zenoh.try_init_log_from_env() | ||
with zenoh.open(zenoh.Config()) as session: | ||
tf_buffer = Buffer() | ||
|
||
robot_adapter = Nav2RobotAdapter( | ||
name='missing_turtlebot3_1', | ||
configuration=None, | ||
robot_config_yaml={ | ||
'initial_map': 'L1', | ||
}, | ||
node=None, | ||
zenoh_session=session, | ||
fleet_handle=None, | ||
tf_buffer=tf_buffer | ||
) | ||
|
||
robot_exists = False | ||
for i in range(10): | ||
transform = robot_adapter.pose() | ||
if transform is not None: | ||
robot_exists = True | ||
break | ||
time.sleep(1) | ||
|
||
assert not robot_exists | ||
|
||
|
||
def test_robot_exists(): | ||
zenoh.try_init_log_from_env() | ||
with zenoh.open(zenoh.Config()) as session: | ||
tf_buffer = Buffer() | ||
|
||
robot_adapter = Nav2RobotAdapter( | ||
name='turtlebot3_1', | ||
configuration=None, | ||
robot_config_yaml={ | ||
'initial_map': 'L1', | ||
}, | ||
node=None, | ||
zenoh_session=session, | ||
fleet_handle=None, | ||
tf_buffer=tf_buffer | ||
) | ||
|
||
robot_exists = False | ||
for i in range(10): | ||
transform = robot_adapter.pose() | ||
if transform is not None: | ||
robot_exists = True | ||
break | ||
time.sleep(1) | ||
|
||
# To check that it is running | ||
assert not robot_exists | ||
|
||
|
||
# def test_robot_navigate(): |