controllers.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Copyright (c) 2010-2011 Vanadium Labs LLC.
4 # All right reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are met:
8 #
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
14 # * Neither the name of Vanadium Labs LLC nor the names of its
15 # contributors may be used to endorse or promote products derived
16 # from this software without specific prior written permission.
17 #
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 # DISCLAIMED. IN NO EVENT SHALL VANADIUM LABS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24 # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 
29 ## @file controllers.py Base class and support functions for a controllers.
30 
31 ## @brief Controllers interact with ArbotiX hardware.
32 class Controller:
33 
34  ## @brief Constructs a Controller instance.
35 
39  def __init__(self, device, name):
40  self.name = name
41  self.device = device
42  self.fake = device.fake
43  self.pause = False
44 
45  # output for joint states publisher
46  self.joint_names = list()
47  self.joint_positions = list()
48  self.joint_velocities = list()
49 
50  ## @brief Start the controller, do any hardware setup needed.
51  def startup(self):
52  pass
53 
54  ## @brief Do any read/writes to device.
55  def update(self):
56  pass
57 
58  ## @brief Stop the controller, do any hardware shutdown needed.
59  def shutdown(self):
60  pass
61 
62  ## @brief Is the controller actively sending commands to joints?
63  def active(self):
64  return False
65 
66  ## @brief Get a diagnostics message for this joint.
67 
69  def getDiagnostics(self):
70  msg = DiagnosticStatus()
71  msg.name = self.name
72  msg.level = DiagnosticStatus.OK
73  msg.message = "OK"
74  return msg
75 
def __init__(self, device, name)
Constructs a Controller instance.
Definition: controllers.py:39
Controllers interact with ArbotiX hardware.
Definition: controllers.py:32
def shutdown(self)
Stop the controller, do any hardware shutdown needed.
Definition: controllers.py:59
def update(self)
Do any read/writes to device.
Definition: controllers.py:55
def startup(self)
Start the controller, do any hardware setup needed.
Definition: controllers.py:51
def active(self)
Is the controller actively sending commands to joints?
Definition: controllers.py:63
def getDiagnostics(self)
Get a diagnostics message for this joint.
Definition: controllers.py:69


arbotix_python
Author(s): Michael Ferguson
autogenerated on Fri Jun 7 2019 21:54:10