Package intera_interface :: Module lights
[hide private]
[frames] | no frames]

Source Code for Module intera_interface.lights

 1  # Copyright (c) 2013-2017, Rethink Robotics Inc. 
 2  # 
 3  # Licensed under the Apache License, Version 2.0 (the "License"); 
 4  # you may not use this file except in compliance with the License. 
 5  # You may obtain a copy of the License at 
 6  # 
 7  #     http://www.apache.org/licenses/LICENSE-2.0 
 8  # 
 9  # Unless required by applicable law or agreed to in writing, software 
10  # distributed under the License is distributed on an "AS IS" BASIS, 
11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
12  # See the License for the specific language governing permissions and 
13  # limitations under the License. 
14   
15  import rospy 
16  from intera_io import IODeviceInterface 
17   
18   
19 -class Lights(object):
20 """ 21 Interface class for the lights on the Intera robots. 22 """ 23
24 - def __init__(self):
25 """ 26 Constructor. 27 28 """ 29 self._lights_io = IODeviceInterface("robot", "robot")
30
31 - def list_all_lights(self):
32 """ 33 Returns a list of strings describing all available lights 34 35 @rtype: list [str] 36 @return: a list of string representing light names 37 Each light name of the following format: 38 '<assembly>_<color>_light' 39 """ 40 return [name for name in self._lights_io.list_signal_names() if "light" in name]
41
42 - def set_light_state(self, name, on=True):
43 """ 44 Sets the named light the desired state (on=True, off=False) 45 46 @type name: str 47 @param name: Light name of the following format: 48 '<assembly>_<color>_light' 49 @type on: bool 50 @param on: value to set the light (on=True, off=False) 51 52 @rtype: bool 53 @return: True if the light state is set, False otherwise 54 """ 55 return self._lights_io.set_signal_value(name, on)
56
57 - def get_light_state(self, name):
58 """ 59 Returns a boolean describing whether the requested light is 'ON'. 60 (True: on, False: off) 61 62 @type name: str 63 @param name: Light name of the following format: 64 '<assembly>_<color>_light' 65 @rtype: bool 66 @return: a variable representing light state: (True: on, False: off) 67 """ 68 return self._lights_io.get_signal_value(name)
69