-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from cpaxton/cpaxton/refactor
Refactor gripper and documentation
- Loading branch information
Showing
36 changed files
with
320 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...per/costar_gripper_manager/CMakeLists.txt → ...ar_gripper/gripper_manager/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ripper/costar_gripper_manager/package.xml → costar_gripper/gripper_manager/package.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
costar_gripper/gripper_manager/src/gripper_manager/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This is the equivalent of the CostarArm component. | ||
from costar_gripper import CostarGripper | ||
|
||
__all__ = ["CostarGripper"] |
77 changes: 77 additions & 0 deletions
77
costar_gripper/gripper_manager/src/gripper_manager/costar_gripper.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
from costar_component import CostarComponent | ||
from os.path import join | ||
import rospy | ||
from std_srvs.srv import Empty | ||
|
||
# The CoSTAR Gripper component contains a lot less special logic than the | ||
# CoSTAR Arm does. It mostly just has a few tools. | ||
class CostarGripper(CostarComponent): | ||
def __init__(self, | ||
name, #name of the gripper | ||
input_topic, # topic on which we receive messages from the gripper | ||
output_topic, # topic on which we send messages to the gripper | ||
InputMsgType, # type of input message | ||
OutputMsgType, # tpye of output message | ||
GripperPredicatorType, # construct a predicator node to send status info | ||
ns, # operating namespace | ||
verbose, # verbose or not | ||
*args, **kwargs): | ||
|
||
self.verbose = verbose | ||
self.predicator = GripperPredicatorType( | ||
start_subscriber=False, | ||
publish_predicates=True, | ||
gripper_name=name) | ||
|
||
self.sub = rospy.Subscriber(input_topic, InputMsgType, self.status_cb) | ||
self.pub = rospy.Publisher(output_topic, OutputMsgType, queue_size = 100) | ||
self.open = rospy.Service(join(ns,"open"), Empty, self.open_gripper) | ||
self.close = rospy.Service(join(ns,"close"), Empty, self.close_gripper) | ||
self.wide_mode_srv = rospy.Service(join(ns,"wide_mode"), Empty, self.wide_mode) | ||
self.pinch_mode_srv = rospy.Service(join(ns,"pinch_mode"), Empty, self.pinch_mode) | ||
self.basic_mode_srv = rospy.Service(join(ns,"basic_mode"), Empty, self.basic_mode) | ||
self.scissor_mode_srv = rospy.Service(join(ns,"scissor_mode"), Empty, self.scissor_mode) | ||
self.reactivate_srv = rospy.Service(join(ns,"activate"), Empty, self.activate) | ||
self.reset_srv = rospy.Service(join(ns,"reset"), Empty, self.reset) | ||
self.command = self.getDefaultMsg() | ||
|
||
self.activated = True; | ||
|
||
self.activate() | ||
|
||
def getDefaultMsg(self): | ||
raise NotImplementedError('not implemented in CostarGripper base class!') | ||
|
||
def activate(self,msg=None): | ||
raise NotImplementedError('not implemented in CostarGripper base class!') | ||
|
||
def reset(self, msg=None): | ||
raise NotImplementedError('not implemented in CostarGripper base class!') | ||
|
||
def open_gripper(self,msg=None): | ||
raise NotImplementedError('not implemented in CostarGripper base class!') | ||
|
||
def close_gripper(self,msg=None): | ||
raise NotImplementedError('not implemented in CostarGripper base class!') | ||
|
||
def wide_mode(self,msg=None): | ||
raise NotImplementedError('not implemented in CostarGripper base class!') | ||
|
||
def pinch_mode(self,msg=None): | ||
raise NotImplementedError('not implemented in CostarGripper base class!') | ||
|
||
def basic_mode(self,msg=None): | ||
raise NotImplementedError('not implemented in CostarGripper base class!') | ||
|
||
def scissor_mode(self,msg=None): | ||
raise NotImplementedError('not implemented in CostarGripper base class!') | ||
|
||
def statusInterpreter(self,status): | ||
raise NotImplementedError('not implemented in CostarGripper base class!') | ||
|
||
def status_cb(self,msg): | ||
if self.verbose: | ||
rospy.loginfo(self.statusInterpreter(msg)) | ||
self.predicator.handle(msg) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...costar_gripper_manager/scripts/c_model.py → ...ripper/gripper_robotiq/scripts/c_model.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...costar_gripper_manager/scripts/s_model.py → ...ripper/gripper_robotiq/scripts/s_model.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env python | ||
|
||
from distutils.core import setup | ||
from catkin_pkg.python_setup import generate_distutils_setup | ||
|
||
d = generate_distutils_setup( | ||
## don't do this unless you want a globally visible script | ||
packages=['gripper_robotiq'], | ||
package_dir={'': 'src'}, | ||
) | ||
|
||
setup(**d) | ||
|
File renamed without changes.
Oops, something went wrong.