本文整理汇总了Python中rospy.myargv方法的典型用法代码示例。如果您正苦于以下问题:Python rospy.myargv方法的具体用法?Python rospy.myargv怎么用?Python rospy.myargv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rospy
的用法示例。
在下文中一共展示了rospy.myargv方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import myargv [as 别名]
def main():
"""SDK Navigator Example
Demonstrates Navigator by echoing input values from wheels and
buttons.
Uses the intera_interface.Navigator class to demonstrate an
example of using the register_callback feature.
Shows Navigator input of the arm for 10 seconds.
"""
arg_fmt = argparse.ArgumentDefaultsHelpFormatter
parser = argparse.ArgumentParser(formatter_class=arg_fmt)
parser.add_argument(
"-n", "--navigator", dest="nav_name", default="right",
choices=["right", "head"],
help='Navigator on which to run example'
)
args = parser.parse_args(rospy.myargv()[1:])
rospy.init_node('sdk_navigator', anonymous=True)
echo_input(args.nav_name)
return 0
示例2: main
# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import myargv [as 别名]
def main():
"""RSDK Head Example: Wobbler
Nods the head and pans side-to-side towards random angles.
Demonstrates the use of the intera_interface.Head class.
"""
arg_fmt = argparse.RawDescriptionHelpFormatter
parser = argparse.ArgumentParser(formatter_class=arg_fmt,
description=main.__doc__)
parser.parse_args(rospy.myargv()[1:])
print("Initializing node... ")
rospy.init_node("rsdk_head_wobbler")
wobbler = Wobbler()
rospy.on_shutdown(wobbler.clean_shutdown)
print("Wobbling... ")
wobbler.wobble()
print("Done.")
示例3: main
# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import myargv [as 别名]
def main():
"""Intera RSDK Joint Velocity Example: Wobbler
Commands joint velocities of randomly parameterized cosine waves
to each joint. Demonstrates Joint Velocity Control Mode.
"""
arg_fmt = argparse.RawDescriptionHelpFormatter
parser = argparse.ArgumentParser(formatter_class=arg_fmt,
description=main.__doc__)
parser.parse_args(rospy.myargv()[1:])
print("Initializing node... ")
rospy.init_node("rsdk_joint_velocity_wobbler")
wobbler = Wobbler()
rospy.on_shutdown(wobbler.clean_shutdown)
wobbler.wobble()
print("Done.")
示例4: main
# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import myargv [as 别名]
def main():
arg_fmt = argparse.RawDescriptionHelpFormatter
parser = argparse.ArgumentParser(formatter_class=arg_fmt,
description=main.__doc__)
required = parser.add_argument_group('required arguments')
required.add_argument(
'-l', '--limb', required=True, choices=['left', 'right'],
help='send joint trajectory to which limb'
)
args = parser.parse_args(rospy.myargv()[1:])
limb = args.limb
rospy.init_node("gripper")
gripper = GripMover(limb)
#Wait on signal from visual_servo
while not rospy.is_shutdown() and not gripper.done:
pass
示例5: main
# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import myargv [as 别名]
def main():
"""RSDK Gripper Example: send a command to control the grippers.
Run this example to command various gripper movements while
adjusting gripper parameters, including calibration, and velocity:
Uses the intera_interface.Gripper class and the
helper function, intera_external_devices.getch.
"""
epilog = """
See help inside the example with the '?' key for key bindings.
"""
rp = intera_interface.RobotParams()
valid_limbs = rp.get_limb_names()
if not valid_limbs:
rp.log_message(("Cannot detect any limb parameters on this robot. "
"Exiting."), "ERROR")
return
limb = valid_limbs[0]
print("Using limb: {}.".format(limb))
arg_fmt = argparse.RawDescriptionHelpFormatter
parser = argparse.ArgumentParser(formatter_class=arg_fmt,
description=main.__doc__,
epilog=epilog)
parser.add_argument(
"-a", "--action", dest="action", default="open",
choices=["open", "close"],
help="Action to perform with the gripper. Options: close or open"
)
args = parser.parse_args(rospy.myargv()[1:])
print("Initializing node... ")
rospy.init_node("sdk_gripper_keyboard")
move_gripper(limb, args.action)
示例6: main
# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import myargv [as 别名]
def main():
rp = intera_interface.RobotParams()
valid_limbs = rp.get_limb_names()
if not valid_limbs:
rp.log_message(("Cannot detect any limb parameters on this robot. "
"Exiting."), "ERROR")
return
# Add an option for starting a server for all valid limbs
all_limbs = valid_limbs
all_limbs.append("all_limbs")
arg_fmt = argparse.ArgumentDefaultsHelpFormatter
parser = argparse.ArgumentParser(formatter_class=arg_fmt)
parser.add_argument(
"-l", "--limb", dest="limb", default=valid_limbs[0],
choices=all_limbs,
help="joint trajectory action server limb"
)
parser.add_argument(
"-r", "--rate", dest="rate", default=100.0,
type=float, help="trajectory control rate (Hz)"
)
parser.add_argument(
"-m", "--mode", default='position_w_id',
choices=['position_w_id', 'position', 'velocity'],
help="control mode for trajectory execution"
)
args = parser.parse_args(rospy.myargv()[1:])
start_server(args.limb, args.rate, args.mode, valid_limbs)
示例7: main
# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import myargv [as 别名]
def main():
arg_fmt = argparse.ArgumentDefaultsHelpFormatter
parser = argparse.ArgumentParser(formatter_class=arg_fmt)
parser.add_argument("-g", "--gripper", dest="gripper", default="both",
choices=['both', 'left', 'right'],
help="gripper action server limb", )
args = parser.parse_args(rospy.myargv()[1:])
start_server(args.gripper)
示例8: main
# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import myargv [as 别名]
def main():
"""RSDK URDF Fragment Example:
This example shows a proof of concept for
adding your URDF fragment to the robot's
onboard URDF (which is currently in use).
"""
arg_fmt = argparse.RawDescriptionHelpFormatter
parser = argparse.ArgumentParser(formatter_class=arg_fmt,
description=main.__doc__)
required = parser.add_argument_group('required arguments')
required.add_argument(
'-f', '--file', metavar='PATH', required=True,
help='Path to URDF file to send'
)
required.add_argument(
'-l', '--link', required=False, default="right_hand", #parent
help='URDF Link already to attach fragment to (usually <left/right>_hand)'
)
required.add_argument(
'-j', '--joint', required=False, default="right_gripper_base",
help='Root joint for fragment (usually <left/right>_gripper_base)'
)
parser.add_argument("-d", "--duration", type=lambda t:abs(float(t)),
default=5.0, help="[in seconds] Duration to publish fragment")
args = parser.parse_args(rospy.myargv()[1:])
rospy.init_node('rsdk_configure_urdf', anonymous=True)
if not os.access(args.file, os.R_OK):
rospy.logerr("Cannot read file at '%s'" % (args.file,))
return 1
send_urdf(args.link, args.joint, args.file, args.duration)
return 0
示例9: main
# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import myargv [as 别名]
def main():
"""Save / Load EndEffector Config utility
Read current config off of ClickSmart and save to file.
Or load config from file and reconfigure and save it to ClickSmart device.
"""
arg_fmt = argparse.RawDescriptionHelpFormatter
parser = argparse.ArgumentParser(formatter_class=arg_fmt,
description=main.__doc__)
parser.add_argument(
'-s', '--save', metavar='PATH',
help='save current EE config to given file'
)
parser.add_argument(
'-l', '--load', metavar='PATH',
help='load config from given file onto EE'
)
args = parser.parse_args(rospy.myargv()[1:])
print("Initializing node... ")
rospy.init_node('ee_config_editor', anonymous=True)
ee = intera_interface.get_current_gripper_interface()
if not ee:
rospy.logerr("Could not detect an attached EndEffector!")
return
if args.save:
rospy.loginfo("Saving EE config to {}".format(args.save))
save_config(ee, args.save)
if args.load:
rospy.loginfo("Loading config and writing config to ClickSmart from {}".format(args.load))
load_config(ee, args.load)
def clean_shutdown():
print("\nExiting example...")
rospy.on_shutdown(clean_shutdown)
示例10: main
# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import myargv [as 别名]
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-l', '--limb',
choices=['left', 'right'], default="right",
help="Calibrate the specified arm")
args = parser.parse_args(rospy.myargv()[1:])
arm = args.limb
print("Initializing node...")
rospy.init_node('sdk_calibrate_arm_{0}'.format(arm), disable_signals=True)
rospy.loginfo("Preparing to Calibrate...")
gripper_warn = ("IMPORTANT: Make sure to remove grippers and other"
" attachments before running Calibrate.")
rospy.loginfo(gripper_warn)
if not is_gripper_removed():
return 1
ca = CalibrateArm(arm)
error = None
goal_state = "unreported error"
rospy.loginfo("Running Calibrate on {0} arm".format(arm))
try:
goal_state = ca.start_calibration()
except KeyboardInterrupt, e:
error = e
goal_state = ca.stop_calibration()
示例11: main
# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import myargv [as 别名]
def main():
"""RSDK URDF Fragment Example:
This example shows a proof of concept for
adding your URDF fragment to the robot's
onboard URDF (which is currently in use).
"""
arg_fmt = argparse.RawDescriptionHelpFormatter
parser = argparse.ArgumentParser(formatter_class=arg_fmt,
description=main.__doc__)
required = parser.add_argument_group('required arguments')
required.add_argument(
'-f', '--file', metavar='PATH', required=True,
help='Path to URDF file to send'
)
required.add_argument(
'-l', '--link', required=False, default="right_hand",
help='URDF Link already to attach fragment to (usually <left/right>_hand)'
)
required.add_argument(
'-j', '--joint', required=False, default="right_gripper_base",
help='Root joint for fragment (usually <left/right>_gripper_base)'
)
parser.add_argument("-d", "--duration", type=lambda t:abs(float(t)),
default=5.0, help="[in seconds] Duration to publish fragment")
args = parser.parse_args(rospy.myargv()[1:])
rospy.init_node('rsdk_configure_urdf', anonymous=True)
if not os.access(args.file, os.R_OK):
rospy.logerr("Cannot read file at '%s'" % (args.file,))
return 1
send_urdf(args.link, args.joint, args.file, args.duration)
return 0
示例12: main
# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import myargv [as 别名]
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--state', const='state',
dest='actions', action='append_const',
help='Print current robot state')
parser.add_argument('-e', '--enable', const='enable',
dest='actions', action='append_const',
help='Enable the robot')
parser.add_argument('-d', '--disable', const='disable',
dest='actions', action='append_const',
help='Disable the robot')
parser.add_argument('-r', '--reset', const='reset',
dest='actions', action='append_const',
help='Reset the robot')
parser.add_argument('-S', '--stop', const='stop',
dest='actions', action='append_const',
help='Stop the robot')
args = parser.parse_args(rospy.myargv()[1:])
if args.actions == None:
parser.print_usage()
parser.exit(0, "No action defined")
rospy.init_node('sdk_robot_enable')
rs = intera_interface.RobotEnable(intera_interface.CHECK_VERSION)
try:
for act in args.actions:
if act == 'state':
print rs.state()
elif act == 'enable':
rs.enable()
elif act == 'disable':
rs.disable()
elif act == 'reset':
rs.reset()
elif act == 'stop':
rs.stop()
except Exception, e:
rospy.logerr(e.strerror)
示例13: main
# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import myargv [as 别名]
def main():
rp = intera_interface.RobotParams()
valid_limbs = rp.get_limb_names()
if not valid_limbs:
rp.log_message(("Cannot detect any limb parameters on this robot. "
"Exiting."), "ERROR")
return
# Add an option for starting a server for all valid limbs
all_limbs = valid_limbs
all_limbs.append("all_limbs")
arg_fmt = argparse.ArgumentDefaultsHelpFormatter
parser = argparse.ArgumentParser(formatter_class=arg_fmt)
parser.add_argument(
"-l", "--limb", dest="limb", default=valid_limbs[0],
choices=all_limbs,
help="joint trajectory action server limb"
)
parser.add_argument(
"-r", "--rate", dest="rate", default=100.0,
type=float, help="trajectory control rate (Hz)"
)
parser.add_argument(
"-m", "--mode", default='position_w_id',
choices=['position_w_id', 'position', 'velocity'],
help="control mode for trajectory execution"
)
args = parser.parse_args(rospy.myargv()[1:])
start_server(args.limb, args.rate, args.mode, valid_limbs)
示例14: main
# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import myargv [as 别名]
def main():
"""RSDK Gripper Example: Keyboard Control
Use your dev machine's keyboard to control and configure grippers.
Run this example to command various gripper movements while
adjusting gripper parameters, including calibration, and velocity:
Uses the intera_interface.Gripper class and the
helper function, intera_external_devices.getch.
"""
epilog = """
See help inside the example with the '?' key for key bindings.
"""
rp = intera_interface.RobotParams()
valid_limbs = rp.get_limb_names()
if not valid_limbs:
rp.log_message(("Cannot detect any limb parameters on this robot. "
"Exiting."), "ERROR")
return
arg_fmt = argparse.RawDescriptionHelpFormatter
parser = argparse.ArgumentParser(formatter_class=arg_fmt,
description=main.__doc__,
epilog=epilog)
parser.add_argument(
"-l", "--limb", dest="limb", default=valid_limbs[0],
choices=valid_limbs,
help="Limb on which to run the gripper keyboard example"
)
args = parser.parse_args(rospy.myargv()[1:])
print("Initializing node... ")
rospy.init_node("sdk_gripper_keyboard")
map_keyboard(args.limb)
示例15: main
# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import myargv [as 别名]
def main():
"""SDK Joint Position Waypoints Example
Records joint positions each time the navigator 'OK/wheel'
button is pressed.
Upon pressing the navigator 'Rethink' button, the recorded joint positions
will begin playing back in a loop.
"""
arg_fmt = argparse.RawDescriptionHelpFormatter
parser = argparse.ArgumentParser(formatter_class=arg_fmt,
description=main.__doc__)
parser.add_argument(
'-s', '--speed', default=0.3, type=float,
help='joint position motion speed ratio [0.0-1.0] (default:= 0.3)'
)
parser.add_argument(
'-a', '--accuracy',
default=intera_interface.settings.JOINT_ANGLE_TOLERANCE, type=float,
help='joint position accuracy (rad) at which waypoints must achieve'
)
args = parser.parse_args(rospy.myargv()[1:])
print("Initializing node... ")
rospy.init_node("sdk_joint_position_waypoints", anonymous=True)
waypoints = Waypoints(args.speed, args.accuracy)
# Register clean shutdown
rospy.on_shutdown(waypoints.clean_shutdown)
# Begin example program
waypoints.record()
waypoints.playback()