controllers.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 # Copyright (c) 2010-2011 Vanadium Labs LLC. 
00004 # All right reserved.
00005 #
00006 # Redistribution and use in source and binary forms, with or without
00007 # modification, are permitted provided that the following conditions are met:
00008 #
00009 #   * Redistributions of source code must retain the above copyright
00010 #     notice, this list of conditions and the following disclaimer.
00011 #   * Redistributions in binary form must reproduce the above copyright
00012 #     notice, this list of conditions and the following disclaimer in the
00013 #     documentation and/or other materials provided with the distribution.
00014 #   * Neither the name of Vanadium Labs LLC nor the names of its 
00015 #     contributors may be used to endorse or promote products derived 
00016 #     from this software without specific prior written permission.
00017 #
00018 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00019 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00020 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00021 # DISCLAIMED. IN NO EVENT SHALL VANADIUM LABS BE LIABLE FOR ANY DIRECT, INDIRECT,
00022 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00023 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00024 # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00025 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
00026 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00027 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00028 
00029 ## @file controllers.py Base class and support functions for a controllers.
00030 
00031 ## @brief Controllers interact with ArbotiX hardware.
00032 class Controller:
00033 
00034     ## @brief Constructs a Controller instance.
00035     ##
00036     ## @param device The arbotix instance.
00037     ## 
00038     ## @param name The controller name.
00039     def __init__(self, device, name):
00040         self.name = name
00041         self.device = device
00042         self.fake = device.fake
00043         self.pause = False
00044 
00045         # output for joint states publisher
00046         self.joint_names = list()
00047         self.joint_positions = list()
00048         self.joint_velocities = list()
00049 
00050     ## @brief Start the controller, do any hardware setup needed.
00051     def startup(self):
00052         pass
00053 
00054     ## @brief Do any read/writes to device.
00055     def update(self):
00056         pass
00057 
00058     ## @brief Stop the controller, do any hardware shutdown needed.
00059     def shutdown(self):
00060         pass
00061 
00062     ## @brief Is the controller actively sending commands to joints?
00063     def active(self):
00064         return False
00065         
00066     ## @brief Get a diagnostics message for this joint.
00067     ##
00068     ## @return Diagnostics message. 
00069     def getDiagnostics(self):
00070         msg = DiagnosticStatus()
00071         msg.name = self.name
00072         msg.level = DiagnosticStatus.OK
00073         msg.message = "OK"
00074         return msg
00075 


arbotix_python
Author(s): Michael Ferguson
autogenerated on Sun Mar 6 2016 11:22:49