本文整理汇总了Python中utils.loginfo函数的典型用法代码示例。如果您正苦于以下问题:Python loginfo函数的具体用法?Python loginfo怎么用?Python loginfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了loginfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_data
def get_data(self,bodies,body_id,time):
data = QuadPosition()
data.found_body = False
if bodies==[]:
utils.loginfo("Gazebo not started")
else:
if hasattr(bodies,'name'):
if body_id<len(bodies.name):
data.found_body=True
data.x=bodies.pose[body_id].position.x
data.y=bodies.pose[body_id].position.y
data.z=bodies.pose[body_id].position.z
x = bodies.pose[body_id].orientation.x
y = bodies.pose[body_id].orientation.y
z = bodies.pose[body_id].orientation.z
w = bodies.pose[body_id].orientation.w
dcm = quat_to_dcm(w,x,y,z)
(roll,pitch,yaw) = dcm.to_euler()
data.pitch=degrees(pitch)
data.roll=degrees(roll)
data.yaw=degrees(yaw)
else:
print 'Body not found'
return copy.deepcopy(data)
示例2: tool
def tool(request, appname):
# if we are here, we have been given a particular appname, e.g. "keyinfo", as part of the url
context = {'applayout': appLayout[appname]}
if request.method == 'POST':
form = forms.Form(request.POST)
elif request.method == 'GET':
form = forms.Form(request.GET)
else:
form = forms.Form()
if form.is_valid():
loginfo(appname, context, request)
context = dispatch(context, request, appname)
#context['form'] = form
context = setconstants(request, context, appname)
loginfo(appname, context, request)
# special case: the data endpoint returns JSON
if appname == 'data':
return HttpResponse(json.dumps(context['data']))
else:
return render(request, 'toolbox.html', context)
示例3: Set_Flight_Mode
def Set_Flight_Mode(NODE_NAME,MODE):
return_value=True
#Change the flight mode on the Pixhawk flight controller
try:
rospy.wait_for_service('/mavros/set_mode',10)
except:
utils.logerr('Mavros is not available')
return_value=False
utils.loginfo('Changing flight mode to '+MODE+' ...')
rospy.sleep(2)
try:
change_param=rospy.ServiceProxy('/mavros/set_mode',SetMode)
param=change_param(0,MODE)
except:
utils.logerr('Cannot change flight mode')
return_value=False
if param.success:
utils.loginfo('Flight mode changed to '+MODE)
else:
utils.logerr('Cannot change flight mode')
return_value=False
return return_value
示例4: get_data
def get_data(self,body):
data = QuadPosition()
body_id = body
data.found_body = False
if self.bodies==[]:
utils.loginfo("Gazebo not started")
else:
if hasattr(self.bodies,'name'):
if body_id<len(self.bodies.name):
data.found_body=True
data.x=self.bodies.pose[body_id].position.x
data.y=self.bodies.pose[body_id].position.y
data.z=self.bodies.pose[body_id].position.z
x = self.bodies.pose[body_id].orientation.x
y = self.bodies.pose[body_id].orientation.y
z = self.bodies.pose[body_id].orientation.z
w = self.bodies.pose[body_id].orientation.w
dcm = quat_to_dcm(w,x,y,z)
(roll,pitch,yaw) = dcm.to_euler()
data.pitch=degrees(pitch)
data.roll=degrees(roll)
data.yaw=degrees(yaw)
print "Sending data for the body with id: "+str(body_id)
else:
print 'Body not found'
return(data)
示例5: Set_Flight_Mode
def Set_Flight_Mode(MODE):
"""This function sets the flight mode of the drone to MODE."""
return_value=True
#Change the flight mode on the Pixhawk flight controller
try:
rospy.wait_for_service('mavros/set_mode',10)
except:
utils.logerr('Mavros is not available')
return_value=False
utils.loginfo('Changing flight mode to '+MODE+' ...')
rospy.sleep(2)
try:
change_param=rospy.ServiceProxy('mavros/set_mode',SetMode)
param=change_param(0,MODE)
while param.success==False:
param=change_param(0,MODE)
if param.success==False:
utils.logerr('Cannot change flight mode')
if param.success:
utils.loginfo('Flight mode changed to '+MODE)
else:
utils.logerr('Cannot change flight mode')
return_value=False
except:
utils.logerr('Cannot change flight mode')
return_value=False
return return_value
示例6: prepareFiles
def prepareFiles(request, validateonly):
tricoder_fileinfo = {}
tricoder_files = []
numProblems = 0
for lineno, afile in enumerate(request.FILES.getlist('tricoderfiles')):
# print afile
# we gotta do this for now!
if 'barcode.' not in afile.name: afile.name = 'barcode.' + afile.name
fileinfo = {'id': lineno, 'name': afile.name, 'status': '', 'date': time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime())}
# always use the current date as the date for the filename checking
today = time.strftime("%Y-%m-%d", time.localtime())
filenamepattern = r'^barcode.TRIDATA_' + re.escape(today) + r'_[\w_\.]+\.DAT$'
if not re.match(filenamepattern, afile.name):
fileinfo['status'] = 'filename is not valid'
numProblems += 1
else:
try:
print "%s %s: %s %s (%s %s)" % ('id', lineno, 'name', afile.name, 'size', afile.size)
if not validateonly:
handle_uploaded_file(afile)
fileinfo['status'] = 'OK'
except:
if validateonly:
fileinfo['status'] = 'validation failed'
else:
fileinfo['status'] = 'file handling problem, not uploaded'
numProblems += 1
tricoder_files.append(fileinfo)
if numProblems > 0:
errormsg = 'Errors found, abandoning upload. Please fix and try again.'
else:
tricoder_filenumber = time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime())
tricoder_fileinfo['tricoder_filenumber'] = tricoder_filenumber
tricoder_fileinfo['estimatedtime'] = '%8.1f' % (len(tricoder_files) * 10 / 60.0)
if 'createtricoder' in request.POST:
tricoder_fileinfo['status'] = 'createtricoder'
if not validateonly:
loginfo('start', get_tricoder_file('input',tricoder_filenumber), request)
try:
retcode = subprocess.call(
[POSTBLOBPATH, get_tricoder_file('input',tricoder_filenumber)])
if retcode < 0:
loginfo('process', tricoder_filenumber + " Child was terminated by signal %s" % -retcode,
request)
else:
loginfo('process', tricoder_filenumber + ": Child returned %s" % retcode, request)
except OSError as e:
loginfo('error', "Execution failed: %s" % e, request)
loginfo('finish', get_tricoder_file('input',tricoder_filenumber), request)
elif 'uploadtricoder' in request.POST:
tricoder_fileinfo['status'] = 'uploadtricoder'
else:
tricoder_fileinfo['status'] = 'No status possible'
return tricoder_fileinfo, tricoder_files, numProblems
示例7: Get_Parameter
def Get_Parameter(NODE_NAME,PARAMETER_NAME,DEFAULT_VALUE):
param=rospy.get_param(PARAMETER_NAME,DEFAULT_VALUE)
if rospy.has_param(PARAMETER_NAME):
utils.loginfo(''+PARAMETER_NAME+' found: '+str(param))
else:
utils.logwarn(''+PARAMETER_NAME+' not found. Default: '+str(DEFAULT_VALUE))
return param
示例8: Terminate
def Terminate(self):
inputstring = 'rosnode kill `rosnode list | grep ' + self.name + '`'
self.execute(inputstring)
try:
delete_model = rospy.ServiceProxy("gazebo/delete_model", DeleteModel)
delete_model(self.name)
except rospy.ServiceException as exc:
utils.loginfo('Failed to delete model ' + str(exc))
示例9: adjust_gravity_cancel
def adjust_gravity_cancel(self):
self.name = self._widget.IrisInputBox.currentText()
rospy.set_param("/" + self.name + "/CONTROL_CANCEL_GRAVITY", int(self._widget.GravitySpinBox.value()))
try:
params_load = rospy.ServiceProxy("/%s/blender/update_parameters" % (self.name), Empty)
params_load_PID = rospy.ServiceProxy("/%s/PID_controller/update_parameters" % (self.name), Empty)
params_load()
params_load_PID()
except rospy.ServiceException as exc:
utils.loginfo("PID not reachable " + str(exc))
示例10: search
def search(request):
if request.method == 'GET' and request.GET != {}:
context = {'searchValues': dict(request.GET.iteritems())}
context = doSearch(context)
else:
context = setConstants({})
loginfo('start search', context, request)
context['additionalInfo'] = AdditionalInfo.objects.filter(live=True)
return render(request, 'search.html', context)
示例11: bmapper
def bmapper(request):
if request.method == 'POST' and request.POST != {}:
requestObject = request.POST
form = forms.Form(requestObject)
if form.is_valid():
context = SEARCHRESULTS
context = setupBMapper(requestObject, context)
loginfo('bmapper', context, request)
return HttpResponse(context['bmapperurl'])
示例12: retrieveResults
def retrieveResults(request):
if request.method == 'POST' and request.POST != {}:
requestObject = dict(request.POST.iteritems())
form = forms.Form(requestObject)
if form.is_valid():
context = {'searchValues': requestObject}
context = doSearch(context)
loginfo('results.%s' % context['displayType'], context, request)
return render(request, 'searchResults.html', context)
示例13: bmapper
def bmapper(request):
if request.method == 'POST' and request.POST != {}:
requestObject = dict(request.POST.iteritems())
form = forms.Form(requestObject)
if form.is_valid():
context = {'searchValues': requestObject}
context = setupBMapper(requestObject, context)
loginfo('bmapper', context, request)
return HttpResponse(context['bmapperurl'])
示例14: gmapper
def gmapper(request):
if request.method == 'POST' and request.POST != {}:
requestObject = request.POST
form = forms.Form(requestObject)
if form.is_valid():
context = SEARCHRESULTS
context = setupGoogleMap(requestObject, context)
loginfo('gmapper', context, request)
return render(request, 'maps.html', context)
示例15: gmapper
def gmapper(request):
if request.method == 'POST' and request.POST != {}:
requestObject = dict(request.POST.iteritems())
form = forms.Form(requestObject)
if form.is_valid():
context = {'searchValues': requestObject}
context = setupGoogleMap(requestObject, context)
loginfo('gmapper', context, request)
return render(request, 'maps.html', context)