本文整理汇总了Python中rospy.search_param函数的典型用法代码示例。如果您正苦于以下问题:Python search_param函数的具体用法?Python search_param怎么用?Python search_param使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了search_param函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: listener
def listener(self):
# setup call back for lgging
print "Starting listener..."
rospy.init_node('log_listener', anonymous=True)
print "Looking for ros params..."
print rospy.search_param('logging_location')
print rospy.search_param('to_log')
if rospy.has_param('~logger_name'):
print("This logger is named")
self.logger_name = rospy.get_param('~logger_name')
print self.logger_name
if rospy.has_param('~to_log'):
print "logging the following topics..."
self.toLog = rospy.get_param('~to_log')
print self.toLog
else:
print "Failed to find topics to log."
if rospy.has_param('~enable_Log_grabbing'):
self.enableBDILogging = rospy.get_param('~enable_Log_grabbing')
else:
print "Not setting up log grabbing"
if rospy.has_param("~logging_location"):
print "logging to the following location..."
self.logLocation = rospy.get_param('~logging_location')
print self.logLocation
else:
print "Using default logging location"
rospy.Subscriber('/vigir_logging', OCSLogging, self.callback)
rospy.Subscriber('/vigir_logging_query', String, self.state)
self.pub = rospy.Publisher('/vigir_logging_responce', String, queue_size=1)
rospy.spin()
开发者ID:team-vigir,项目名称:vigir_logging,代码行数:32,代码来源:logger.py
示例2: listener
def listener(self):
# setup call back for lgging
print "Starting listener..."
rospy.init_node('log_listener', anonymous=True)
print "Looking for ros params..."
print rospy.search_param('logging_location')
if rospy.has_param("~logging_location"):
print "logging to the following location..."
self.logLocation = rospy.get_param('~logging_location')
print self.logLocation
else:
print "Using default logging location"
if rospy.has_param("~onboard"):
print "logging instance is onboard?"
self.onboard = rospy.get_param("~onboard")
print self.onboard
print "Subscribe to logging messages ..."
rospy.Subscriber('/vigir_logging', OCSLogging, self.callback)
rospy.Subscriber('/vigir_logging_query', String, self.state)
print "Publish topic ..."
self.pub = rospy.Publisher('/vigir_logging_responce', String, queue_size=1)
self.query = "desktop_"
print "Now spin ..."
rospy.spin()
print "Shutdown the desktop logger!"
开发者ID:team-vigir,项目名称:vigir_logging,代码行数:30,代码来源:recorder.py
示例3: gazebo_world_state_handler
def gazebo_world_state_handler(self, data):
# Retrieve the static world & robot descriptions once on first run
if self.gazebo_world == None:
world_param = rospy.search_param('gazebo_world_description')
world_description = rospy.get_param(world_param, '')
robot_param = rospy.search_param('robot_description')
robot_description = str(rospy.get_param(robot_param, ''))
self.gazebo_world = GazeboDescriptionParser(world_description, robot_description)
# Begin parsing icarus world state
icarus_state = '(list'
regex = re.compile('(env|obj)_(.*?)_(.*?)_(.*?)_body')
for i in range(len(data.name)):
pos = data.pose[i].position
ori = data.pose[i].orientation
lin = data.twist[i].linear
ang = data.twist[i].angular
frc = data.wrench[i].force
trq = data.wrench[i].torque
# Only publish recognizable objects from the world & robot desscriptions
if self.gazebo_world != None and self.gazebo_world.has_object(data.name[i].strip()):
match = re.search(regex, data.name[i])
if match:
if match.group(1) == 'env':
icarus_state += ' \'(environment %s' % (data.name[i])
else:
icarus_state += ' \'(object %s' % (data.name[i])
icarus_state += ' type %s' % (match.group(2))
icarus_state += ' color %s' % (match.group(4))
else:
icarus_state += ' \'(object %s' % (data.name[i])
if data.name[i].strip() == 'base_link':
icarus_state += ' type self'
else:
icarus_state += ' type empty'
icarus_state += ' color empty'
icarus_state += ' role empty'
icarus_state += ' status empty'
icarus_state += ' xpos %s ypos %s zpos %s' % (pos.x, pos.y, pos.z)
icarus_state += ' xori %s yori %s zori %s wori %s' % (ori.x, ori.y, ori.z, ori.w)
icarus_state += ' xlin %s ylin %s zlin %s' % (lin.x, lin.y, lin.z)
icarus_state += ' xang %s yang %s zang %s' % (ang.x, ang.y, ang.z)
icarus_state += ' xtrq %s ytrq %s ztrq %s' % (trq.x, trq.y, trq.z)
obj = self.gazebo_world.get_object(data.name[i].strip())
icarus_state += ' xsiz %s ysiz %s zsiz %s srad %s)' % (obj.size.x, obj.size.y, obj.size.z, obj.s_radius)
icarus_state += ')'
self.icarus_world_state = icarus_state
self.icarus_world_state_pub.publish(icarus_state)
开发者ID:Kenkoko,项目名称:ua-ros-pkg,代码行数:55,代码来源:icarus_world_state_server.py
示例4: __init__
def __init__(self):
'''Initialize ros publisher, ros subscriber'''
# topic where we publish
self.bridge = CvBridge()
out_image = rospy.get_param(rospy.search_param('out'))
image = rospy.get_param(rospy.search_param('image'))
# subscribed Topic
self.image_pub = rospy.Publisher(out_image, Image)
self.subscriber = rospy.Subscriber(image, CompressedImage, self.callback, queue_size = 1000)
开发者ID:sameeptandon,项目名称:sail-car-log,代码行数:11,代码来源:ov_image_converter.py
示例5: main
def main():
rospy.init_node("robospect_laser_assembler_node")
_name = rospy.get_name().replace('/','')
arg_defaults = {
'topic_state': 'state',
'desired_freq': DEFAULT_FREQ,
'assembly_scans_service_name': '/assemble_scans2',
'point_cloud_publisher_topic_name': '/assembled_cloud',
'time_point_cloud_back': DEFAULT_TIME_PCLOUD_BACK,
}
args = {}
for name in arg_defaults:
try:
if rospy.search_param(name):
args[name] = rospy.get_param('~%s'%(name)) # Adding the name of the node, because the para has the namespace of the node
else:
args[name] = arg_defaults[name]
#print name
except rospy.ROSException, e:
rospy.logerr('%s: %s'%(e, _name))
开发者ID:RobospectEU,项目名称:robospect_common,代码行数:26,代码来源:robospect_laser_assembler_node.py
示例6: initialize
def initialize(self):
self.status_pub = rospy.Publisher(rospy.remap_name(self.ns)+"/status", GoalStatusArray, latch=True);
self.result_pub = rospy.Publisher(rospy.remap_name(self.ns)+"/result", self.ActionResult);
self.feedback_pub = rospy.Publisher(rospy.remap_name(self.ns)+"/feedback", self.ActionFeedback);
self.goal_sub = rospy.Subscriber(rospy.remap_name(self.ns)+"/goal", self.ActionGoal,self.internal_goal_callback);
self.cancel_sub = rospy.Subscriber(rospy.remap_name(self.ns)+"/cancel", GoalID,self.internal_cancel_callback);
#read the frequency with which to publish status from the parameter server
#if not specified locally explicitly, use search param to find actionlib_status_frequency
resolved_status_frequency_name = rospy.remap_name(self.ns)+"/status_frequency"
if rospy.has_param(resolved_status_frequency_name):
self.status_frequency = rospy.get_param(resolved_status_frequency_name, 5.0);
rospy.logwarn("You're using the deprecated status_frequency parameter, please switch to actionlib_status_frequency.")
else:
search_status_frequency_name = rospy.search_param("actionlib_status_frequency")
if search_status_frequency_name is None:
self.status_frequency = 5.0
else:
self.status_frequency = rospy.get_param(search_status_frequency_name, 5.0)
status_list_timeout = rospy.get_param(rospy.remap_name(self.ns)+"/status_list_timeout", 5.0);
self.status_list_timeout = rospy.Duration(status_list_timeout);
self.status_timer = threading.Thread( None, ros_timer, None, (self.publish_status_async,self.status_frequency) );
self.status_timer.start();
开发者ID:strawlab,项目名称:ros_common,代码行数:28,代码来源:action_server.py
示例7: load_config_from_param
def load_config_from_param():
# first, make sure parameter server is even loaded
while not rospy.search_param("/joints"):
rospy.loginfo("waiting for parameter server to load with joint definitions")
rospy.sleep(1)
rospy.sleep(1)
joints = rospy.get_param('/joints')
for name in joints:
rospy.loginfo( "found: " + name )
s = Servo()
key = '/joints/' + name + '/'
s.bus = rospy.get_param(key + 'bus')
s.servoPin = rospy.get_param(key + 'servoPin')
s.minPulse = rospy.get_param(key + 'minPulse')
s.maxPulse = rospy.get_param(key + 'maxPulse')
s.minGoal = rospy.get_param(key + 'minGoal')
s.maxGoal = rospy.get_param(key + 'maxGoal')
s.rest = rospy.get_param(key + 'rest')
s.maxSpeed = rospy.get_param(key + 'maxSpeed')
s.smoothing = rospy.get_param(key + 'smoothing')
s.sensorpin = rospy.get_param(key + 'sensorPin')
s.minSensor = rospy.get_param(key + 'minSensor')
s.maxSensor = rospy.get_param(key + 'maxSensor')
servos[name] = s
return servos
开发者ID:alansrobotlab,项目名称:inmoov_ros,代码行数:35,代码来源:load_config_from_param.py
示例8: getFixedTypeProperty
def getFixedTypeProperty(self, propertyName, valueType):
"""Main property getter receiving the property name and the value type
and returning the current value from the low level driver."""
propertyData = self.translator.interpret(propertyName)
if propertyData == None:
return None
#else:
if propertyData[PPTY_KIND] == "dynParam":
paramName = propertyTranslator.getBasename(propertyData[PPTY_REF])
resp1 = self.driverMgr.getParameter(paramName, self.translator.getDynServerPath(propertyName))
elif propertyData[PPTY_KIND] == "publishedTopic":
resp1 = self.driverMgr.getTopic(propertyData[PPTY_REF], valueType)
elif propertyData[PPTY_KIND] == "readOnlyParam":
paramName = propertyTranslator.getBasename(propertyData[PPTY_REF])
location = rospy.search_param(param_name)
resp1 = rospy.get_param(location)
elif propertyData[PPTY_KIND] == "topic":
##MICHI: 14Feb2012
if valueType == str:
resp1 = str(propertyData[PPTY_REF])
else: ## Special case for reading disparity images
valueType2 = DisparityImage
if propertyData[PPTY_TYPE].find("Disparity") < 0:
valueType2 = Image
resp1 = self.driverMgr.getTopic(propertyData[PPTY_REF], valueType2)
else:
rospy.logerr("Error: unable to get property %s of kind %s"%(propertyName, propertyData[PPTY_TYPE]))
resp1 = None
return resp1
开发者ID:Michi05,项目名称:my_adaptor,代码行数:29,代码来源:img_a_node.py
示例9: main
def main():
rospy.init_node("test_contact_marker")
_name = rospy.get_name().replace('/','')
arg_defaults = {
'topic_state': 'state',
'desired_freq': DEFAULT_FREQ,
'marker_frames': ['sw1', 'sw2', 'sw3', 'sw4'],
'marker_names': ['sw1', 'sw2', 'sw3', 'sw4'],
}
args = {}
for name in arg_defaults:
try:
if rospy.search_param(name):
args[name] = rospy.get_param('~%s'%(name)) # Adding the name of the node, because the para has the namespace of the node
else:
args[name] = arg_defaults[name]
#print name
except rospy.ROSException, e:
rospy.logerr('%s: %s'%(e, _name))
开发者ID:RobospectEU,项目名称:robospect_mission_planner,代码行数:25,代码来源:test_contact_marker.py
示例10: __init__
def __init__(self):
NaoNode.__init__(self, 'nao_sensors')
self.connectNaoQi()
# default sensor rate: 25 Hz (50 is max, stresses Nao's CPU)
self.sensorRate = rospy.Rate(rospy.get_param('~sensor_rate', 25.0))
self.dataNamesList = ["DCM/Time",
"Device/SubDeviceList/InertialSensor/AngleX/Sensor/Value","Device/SubDeviceList/InertialSensor/AngleY/Sensor/Value",
"Device/SubDeviceList/InertialSensor/AngleZ/Sensor/Value",
"Device/SubDeviceList/InertialSensor/GyroscopeX/Sensor/Value", "Device/SubDeviceList/InertialSensor/GyroscopeY/Sensor/Value",
"Device/SubDeviceList/InertialSensor/GyroscopeZ/Sensor/Value",
"Device/SubDeviceList/InertialSensor/AccelerometerX/Sensor/Value", "Device/SubDeviceList/InertialSensor/AccelerometerY/Sensor/Value",
"Device/SubDeviceList/InertialSensor/AccelerometerZ/Sensor/Value"]
tf_prefix_param_name = rospy.search_param('tf_prefix')
if tf_prefix_param_name:
self.tf_prefix = rospy.get_param(tf_prefix_param_name)
else:
self.tf_prefix = ""
# To stop odometry tf being broadcast
self.broadcast_odometry = rospy.get_param('~broadcast_odometry', True)
self.base_frameID = rospy.get_param('~base_frame_id', "base_link")
if not(self.base_frameID[0] == '/'):
self.base_frameID = self.tf_prefix + '/' + self.base_frameID
# use sensor values or commanded (open-loop) values for joint angles
self.useJointSensors = rospy.get_param('~use_joint_sensors', True) # (set to False in simulation!)
# init. messages:
self.torsoOdom = Odometry()
self.torsoOdom.header.frame_id = rospy.get_param('~odom_frame_id', "odom")
if not(self.torsoOdom.header.frame_id[0] == '/'):
self.torsoOdom.header.frame_id = self.tf_prefix + '/' + self.torsoOdom.header.frame_id
self.torsoIMU = Imu()
self.torsoIMU.header.frame_id = self.base_frameID
self.jointState = JointState()
self.jointState.name = self.motionProxy.getJointNames('Body')
# simluated model misses some joints, we need to fill:
if (len(self.jointState.name) == 22):
self.jointState.name.insert(6,"LWristYaw")
self.jointState.name.insert(7,"LHand")
self.jointState.name.append("RWristYaw")
self.jointState.name.append("RHand")
msg = "Nao joints found: "+ str(self.jointState.name)
rospy.logdebug(msg)
self.torsoOdomPub = rospy.Publisher("odom", Odometry, queue_size=10)
self.torsoIMUPub = rospy.Publisher("imu", Imu, queue_size=10)
self.jointStatePub = rospy.Publisher("joint_states", JointState, queue_size=10)
self.tf_br = tf.TransformBroadcaster()
rospy.loginfo("nao_sensors initialized")
开发者ID:furushchev,项目名称:nao_robot,代码行数:60,代码来源:nao_sensors.py
示例11: main
def main():
rospy.init_node("axis_twist")
arg_defaults = {
'hostname': '192.168.0.90',
'username': '',
'password': '',
'flip': False, # things get weird if flip=true
'speed_control': False
}
args = {}
# go through all arguments
for name in arg_defaults:
full_param_name = rospy.search_param(name)
# make sure argument was found (https://github.com/ros/ros_comm/issues/253)
if full_param_name == None:
args[name] = arg_defaults[name]
else:
args[name] = rospy.get_param(full_param_name, arg_defaults[name])
# create new PTZ object and start dynamic_reconfigure server
my_ptz = AxisPTZ(**args)
srv = Server(PTZConfig, my_ptz.dynamicReconfigCallback)
rospy.spin()
开发者ID:Tao2015,项目名称:axis_camera,代码行数:25,代码来源:axis_ptz.py
示例12: __get_parameter
def __get_parameter(pname):
param_full_name = rospy.search_param(pname)
if not param_full_name:
raise ParamNotFoundError("'{}'".format(pname))
p = Param(param_full_name, rospy.get_param(param_full_name))
rospy.loginfo("Param '{}'. Value: '{}'".format(p.name, p.value))
return p
开发者ID:jonyal,项目名称:rospy_utils,代码行数:7,代码来源:param_utils.py
示例13: load_config_from_param
def load_config_from_param(self):
# first, make sure parameter server is even loaded
while not rospy.search_param("/joints"):
rospy.loginfo("waiting for parameter server to load with joint definitions")
rospy.sleep(1)
rospy.sleep(1)
joints = rospy.get_param('/joints')
for name in joints:
rospy.loginfo( "found: " + name )
s = Servo()
key = '/joints/' + name + '/'
s.bus = int(rospy.get_param(key + 'bus'))
s.servo = int(rospy.get_param(key + 'servo'))
s.flip = int(rospy.get_param(key + 'flip'))
s.servopin = int(rospy.get_param(key + 'servopin'))
s.sensorpin = int(rospy.get_param(key + 'sensorpin'))
s.minpulse = int(rospy.get_param(key + 'minpulse'))
s.maxpulse = int(rospy.get_param(key + 'maxpulse'))
s.minangle = float(rospy.get_param(key + 'minangle'))
s.maxangle = float(rospy.get_param(key + 'maxangle'))
s.minsensor = int(rospy.get_param(key + 'minsensor'))
s.maxsensor = int(rospy.get_param(key + 'maxsensor'))
s.maxspeed = float(rospy.get_param(key + 'maxspeed'))
s.smoothing = int(rospy.get_param(key + 'smoothing'))
self.servos[name] = s
开发者ID:alansrobotlab,项目名称:inmoov_ros,代码行数:33,代码来源:trainer.py
示例14: search_param
def search_param(name, params_glob):
if params_glob and not any(fnmatch.fnmatch(str(v), glob) for glob in params_glob):
# If the glob list is not empty and there are no glob matches,
# stop the attempt to find the parameter.
return None
# If the glob list is empty (i.e. false) or the parameter matches
# one of the glob strings, continue to find the parameter.
return rospy.search_param(name)
开发者ID:hitrobotgroup,项目名称:release,代码行数:8,代码来源:params.py
示例15: start_exploration
def start_exploration(self):
'''Starts FlexBe behavior according to param "mission_behavior".'''
msg = BehaviorExecutionActionGoal()
#msg.goal.behavior_name = 'Search Victims'
mission_full_param_name = rospy.search_param('mission_behavior')
msg.goal.behavior_name = rospy.get_param(mission_full_param_name)
self._behavior_publisher.publish(msg)
rospy.loginfo("FlexBe exploration behavior "+ rospy.get_param(mission_full_param_name) +" activated.")
开发者ID:tu-darmstadt-ros-pkg,项目名称:exploration_evaluation,代码行数:8,代码来源:exploration_test_node.py
示例16: addTFPrefix
def addTFPrefix(frame_id):
prefix = ""
prefix_param = rospy.search_param("tf_prefix")
if prefix_param:
prefix = rospy.get_param(prefix_param)
if prefix[0] != "/":
prefix = "/%s" % prefix
return "%s/%s" % (prefix, frame_id)
开发者ID:Hi-Zed,项目名称:gnss,代码行数:9,代码来源:enu_to_pose.py
示例17: param_talker
def param_talker():
rospy.init_node('param_talker')
# Fetch values from the Parameter Server. In this example, we fetch
# parameters from three different namespaces:
#
# 1) global (/global_example)
# 2) parent (/foo/utterance)
# 3) private (/foo/param_talker/topic_name)
# fetch a /global parameter
global_example = rospy.get_param("/global_example")
rospy.loginfo("%s is %s", rospy.resolve_name('/global_example'), global_example)
# fetch the utterance parameter from our parent namespace
utterance = rospy.get_param('utterance')
rospy.loginfo("%s is %s", rospy.resolve_name('utterance'), utterance)
# fetch topic_name from the ~private namespace
topic_name = rospy.get_param('~topic_name')
rospy.loginfo("%s is %s", rospy.resolve_name('~topic_name'), topic_name)
# fetch a parameter, using 'default_value' if it doesn't exist
default_param = rospy.get_param('default_param', 'default_value')
rospy.loginfo('%s is %s', rospy.resolve_name('default_param'), default_param)
# fetch a group (dictionary) of parameters
gains = rospy.get_param('gains')
p, i, d = gains['P'], gains['I'], gains['D']
rospy.loginfo("gains are %s, %s, %s", p, i, d)
# set some parameters
rospy.loginfo('setting parameters...')
rospy.set_param('list_of_floats', [1., 2., 3., 4.])
rospy.set_param('bool_True', True)
rospy.set_param('~private_bar', 1+2)
rospy.set_param('to_delete', 'baz')
rospy.loginfo('...parameters have been set')
# delete a parameter
if rospy.has_param('to_delete'):
rospy.delete_param('to_delete')
rospy.loginfo("deleted %s parameter"%rospy.resolve_name('to_delete'))
else:
rospy.loginfo('parameter %s was already deleted'%rospy.resolve_name('to_delete'))
# search for a parameter
param_name = rospy.search_param('global_example')
rospy.loginfo('found global_example parameter under key: %s'%param_name)
# publish the value of utterance repeatedly
pub = rospy.Publisher(topic_name, String)
while not rospy.is_shutdown():
pub.publish(utterance)
rospy.loginfo(utterance)
rospy.sleep(1)
开发者ID:Pumpel,项目名称:ros_tutorials,代码行数:56,代码来源:param_talker.py
示例18: __init__
def __init__(self):
param_name = rospy.search_param('restamped_topics')
print "Param name"
print param_name
self.topic_names = rospy.get_param(param_name)
self.subscribers = {}
self.publishers = {}
self.setup_topics()
开发者ID:CURG,项目名称:calibration,代码行数:10,代码来源:restamp_msg.py
示例19: main
def main():
rospy.init_node("axis")
arg_defaults = {"hostname": "192.168.0.90", "username": "", "password": ""}
args = {}
for name in arg_defaults:
args[name] = rospy.get_param(rospy.search_param(name), arg_defaults[name])
AxisPTZ(**args)
rospy.spin()
开发者ID:meliaspl,项目名称:clearpath-ros-pkg,代码行数:10,代码来源:axis_ptz.py
示例20: get_frame_id
def get_frame_id():
frame_id = rospy.get_param('~frame_id', 'gps')
"""Add the TF prefix"""
prefix = ""
prefix_param = rospy.search_param('tf_prefix')
if prefix_param:
prefix = rospy.get_param(prefix_param)
return "%s/%s" % (prefix, frame_id)
else:
return frame_id
开发者ID:ros-drivers,项目名称:nmea_navsat_driver,代码行数:10,代码来源:driver.py
注:本文中的rospy.search_param函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论