Main Page
Namespaces
Classes
Files
File List
File Members
scripts
set_simulation_timer.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
# Copyright (c) 2016 The UUV Simulator Authors.
3
# All rights reserved.
4
#
5
# Licensed under the Apache License, Version 2.0 (the "License");
6
# you may not use this file except in compliance with the License.
7
# You may obtain a copy of the License at
8
#
9
# http://www.apache.org/licenses/LICENSE-2.0
10
#
11
# Unless required by applicable law or agreed to in writing, software
12
# distributed under the License is distributed on an "AS IS" BASIS,
13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
# See the License for the specific language governing permissions and
15
# limitations under the License.
16
from
__future__
import
print_function
17
import
rospy
18
19
20
if
__name__ ==
'__main__'
:
21
rospy.init_node(
'set_simulation_timer'
)
22
23
if
rospy.is_shutdown():
24
rospy.ROSException(
'ROS master is not running!'
)
25
26
timeout = 0.0
27
if
rospy.has_param(
'~timeout'
):
28
timeout = rospy.get_param(
'~timeout'
)
29
if
timeout <= 0:
30
raise
rospy.ROSException(
'Termination time must be a positive floating point value'
)
31
32
print(
'Starting simulation timer - Timeout = {} s'
.format(timeout))
33
rate = rospy.Rate(100)
34
while
rospy.get_time() < timeout:
35
rate.sleep()
36
37
print(
'Simulation timeout - Killing simulation...'
)
uuv_assistants
Author(s): Musa Morena Marcusso Manhaes
, Sebastian Scherer
, Luiz Ricardo Douat
autogenerated on Mon Jul 1 2019 19:39:08