robotiq_3f_gripper_diagnostics.cpp
Go to the documentation of this file.
1 // Copyright (c) 2016, Toyota Research Institute. All rights reserved.
2 
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are met:
5 
6 // 1. Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 
9 // 2. Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the
11 // documentation and/or other materials provided with the distribution.
12 
13 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
17 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23 // POSSIBILITY OF SUCH DAMAGE.
24 
26 
27 using namespace robotiq_3f_gripper_control;
28 
30  :driver_(driver)
31 {
34 }
35 
37 {
39 }
40 
42 {
44  driver_->getFaultStatus(&fs);
45 
46  switch (fs)
47  {
49  stat.summary(diagnostic_msgs::DiagnosticStatus::OK, "No faults. ");
50  break;
52  stat.summary(diagnostic_msgs::DiagnosticStatus::OK, "Action delayed, activation (reactivation) must be completed prior to renewed action. ");
53  break;
55  stat.summary(diagnostic_msgs::DiagnosticStatus::OK, "Action delayed, mode change must be completed prior t continuing action. ");
56  break;
58  stat.summary(diagnostic_msgs::DiagnosticStatus::OK, "The activation bit must be set prior to action. ");
59  break;
61  stat.summary(diagnostic_msgs::DiagnosticStatus::WARN, "The communication chip is not ready (may be booting). ");
62  break;
64  stat.summary(diagnostic_msgs::DiagnosticStatus::WARN, "Changing mode fault interference detected on scissor (for less than 20 sec). ");
65  break;
67  stat.summary(diagnostic_msgs::DiagnosticStatus::WARN, "Automatic release is in progress. ");
68  break;
70  stat.summary(diagnostic_msgs::DiagnosticStatus::ERROR, "Activation fault, verify that no interference or other error occurred. ");
71  break;
73  stat.summary(diagnostic_msgs::DiagnosticStatus::ERROR, "Changing mode fault, interference detected on Scissor (for more than 20 sec). ");
74  break;
76  stat.summary(diagnostic_msgs::DiagnosticStatus::ERROR, "Automatic release completed. Reset and activation is required. ");
77  break;
78  default:
79  stat.summary(diagnostic_msgs::DiagnosticStatus::ERROR, "Unknown fault");
80  break;
81  }
82 
88 
89  driver_->getGripperStatus(&gACT, &gMOD, &gGTO, &gIMC, &gSTA);
90 
91  stat.add("Initialization Status", toString(gACT));
92  stat.add("Grasping Operation Mode Status", toString(gMOD));
93  stat.add("Action Status", toString(gGTO));
94  stat.add("Gripper Status", toString(gIMC));
95  stat.add("Motion Status", toString(gSTA));
96 }
97 
99 {
100  switch(status)
101  {
102  case robotiq::INIT_RESET:
103  return "Gripper reset. ";
105  return "Gripper activation. ";
106  default:
107  return "Unknown. ";
108  }
109 }
110 
112 {
113  switch(status)
114  {
116  return "Basic mode. ";
118  return "Pinch mode. ";
119  case robotiq::GRASP_WIDE:
120  return "Wide mode. ";
122  return "Scissor mode. ";
123  default:
124  return "Unknown. ";
125 
126  }
127 }
128 
130 {
131  switch(status)
132  {
134  return "Stopped (or performing activation / grasping mode change / automatic release). ";
135  case robotiq::ACTION_GO:
136  return "Go to Position Request. ";
137  default:
138  return "Unknown. ";
139 
140  }
141 }
142 
144 {
145  switch(status)
146  {
148  return "Gripper is in reset (or automatic release) state. See Fault status if Gripper is activated. ";
150  return "Activation is in progress. ";
152  return "Mode change is in progress. ";
154  return "Activation and Mode change are complete. ";
155  default:
156  return "Unknown. ";
157  }
158 }
159 
161 {
162  switch(status)
163  {
165  return "Gripper is in motion towards requested position (only meaningful if ActionMode enabled). ";
167  return "Gripper is stopped. One or two fingers stopped before requested position. ";
169  return "Gripper is stopped. All fingers stopped before requested position. ";
171  return "Gripper is stopped. All fingers reached requested position." ;
172  default:
173  return "Unknown. ";
174  }
175 }
176 
178 {
179  switch (status)
180  {
181  case robotiq::FAULT_NONE:
182  return "No fault. ";
184  return "Action delayed, activation (reactivation) must be completed prior to renewed action. ";
186  return "Action delayed, mode change must be completed prior t continuing action. ";
188  return "The activation bit must be set prior to action. ";
190  return "The communication chip is not ready (may be booting). ";
192  return "Changing mode fault interference detected on scissor (for less than 20 sec). ";
194  return "Automatic release is in progress. ";
196  return "Activation fault, verify that no interference or other error occurred. ";
198  return "Changing mode fault, interference detected on Scissor (for more than 20 sec). ";
200  return "Automatic release completed. Reset and activation is required. ";
201  default:
202  return "Unknown fault. ";
203  }
204 }
void summary(unsigned char lvl, const std::string s)
void setHardwareID(const std::string &hwid)
void add(const std::string &name, TaskFunction f)
Robotiq3FGripperDiagnostics(boost::shared_ptr< robotiq_3f_gripper_control::Robotiq3FGripperAPI > driver, std::string name)
void getStatus(diagnostic_updater::DiagnosticStatusWrapper &stat)
void add(const std::string &key, const T &val)
std::string toString(robotiq::InitializationMode status)
boost::shared_ptr< robotiq_3f_gripper_control::Robotiq3FGripperAPI > driver_


robotiq_3f_gripper_control
Author(s): Nicolas Lauzier (Robotiq inc.), Allison Thackston
autogenerated on Tue Jun 1 2021 02:29:58