code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
"""
The MIT License
Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""
import oauth2
import smtplib
import base64
class SMTP(smtplib.SMTP):
"""SMTP wrapper for smtplib.SMTP that implements XOAUTH."""
def authenticate(self, url, consumer, token):
if consumer is not None and not isinstance(consumer, oauth2.Consumer):
raise ValueError("Invalid consumer.")
if token is not None and not isinstance(token, oauth2.Token):
raise ValueError("Invalid token.")
self.docmd('AUTH', 'XOAUTH %s' % \
base64.b64encode(oauth2.build_xoauth_string(url, consumer, token)))
| [
[
8,
0,
0.2927,
0.561,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.6098,
0.0244,
0,
0.66,
0.25,
311,
0,
1,
0,
0,
311,
0,
0
],
[
1,
0,
0.6341,
0.0244,
0,
0.66,
... | [
"\"\"\"\nThe MIT License\n\nCopyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including withou... |
# Copyright 2011 Google Inc. All Rights Reserved.
"""Multi-credential file store with lock support.
This module implements a JSON credential store where multiple
credentials can be stored in one file. That file supports locking
both in a single process and across processes.
The credential themselves are keyed off of:
* client_id
* user_agent
* scope
The format of the stored data is like so:
{
'file_version': 1,
'data': [
{
'key': {
'clientId': '<client id>',
'userAgent': '<user agent>',
'scope': '<scope>'
},
'credential': {
# JSON serialized Credentials.
}
}
]
}
"""
__author__ = 'jbeda@google.com (Joe Beda)'
import base64
import errno
import logging
import os
import threading
from anyjson import simplejson
from client import Storage as BaseStorage
from client import Credentials
from locked_file import LockedFile
logger = logging.getLogger(__name__)
# A dict from 'filename'->_MultiStore instances
_multistores = {}
_multistores_lock = threading.Lock()
class Error(Exception):
"""Base error for this module."""
pass
class NewerCredentialStoreError(Error):
"""The credential store is a newer version that supported."""
pass
def get_credential_storage(filename, client_id, user_agent, scope,
warn_on_readonly=True):
"""Get a Storage instance for a credential.
Args:
filename: The JSON file storing a set of credentials
client_id: The client_id for the credential
user_agent: The user agent for the credential
scope: string or list of strings, Scope(s) being requested
warn_on_readonly: if True, log a warning if the store is readonly
Returns:
An object derived from client.Storage for getting/setting the
credential.
"""
filename = os.path.realpath(os.path.expanduser(filename))
_multistores_lock.acquire()
try:
multistore = _multistores.setdefault(
filename, _MultiStore(filename, warn_on_readonly))
finally:
_multistores_lock.release()
if type(scope) is list:
scope = ' '.join(scope)
return multistore._get_storage(client_id, user_agent, scope)
class _MultiStore(object):
"""A file backed store for multiple credentials."""
def __init__(self, filename, warn_on_readonly=True):
"""Initialize the class.
This will create the file if necessary.
"""
self._file = LockedFile(filename, 'r+b', 'rb')
self._thread_lock = threading.Lock()
self._read_only = False
self._warn_on_readonly = warn_on_readonly
self._create_file_if_needed()
# Cache of deserialized store. This is only valid after the
# _MultiStore is locked or _refresh_data_cache is called. This is
# of the form of:
#
# (client_id, user_agent, scope) -> OAuth2Credential
#
# If this is None, then the store hasn't been read yet.
self._data = None
class _Storage(BaseStorage):
"""A Storage object that knows how to read/write a single credential."""
def __init__(self, multistore, client_id, user_agent, scope):
self._multistore = multistore
self._client_id = client_id
self._user_agent = user_agent
self._scope = scope
def acquire_lock(self):
"""Acquires any lock necessary to access this Storage.
This lock is not reentrant.
"""
self._multistore._lock()
def release_lock(self):
"""Release the Storage lock.
Trying to release a lock that isn't held will result in a
RuntimeError.
"""
self._multistore._unlock()
def locked_get(self):
"""Retrieve credential.
The Storage lock must be held when this is called.
Returns:
oauth2client.client.Credentials
"""
credential = self._multistore._get_credential(
self._client_id, self._user_agent, self._scope)
if credential:
credential.set_store(self)
return credential
def locked_put(self, credentials):
"""Write a credential.
The Storage lock must be held when this is called.
Args:
credentials: Credentials, the credentials to store.
"""
self._multistore._update_credential(credentials, self._scope)
def locked_delete(self):
"""Delete a credential.
The Storage lock must be held when this is called.
Args:
credentials: Credentials, the credentials to store.
"""
self._multistore._delete_credential(self._client_id, self._user_agent,
self._scope)
def _create_file_if_needed(self):
"""Create an empty file if necessary.
This method will not initialize the file. Instead it implements a
simple version of "touch" to ensure the file has been created.
"""
if not os.path.exists(self._file.filename()):
old_umask = os.umask(0177)
try:
open(self._file.filename(), 'a+b').close()
finally:
os.umask(old_umask)
def _lock(self):
"""Lock the entire multistore."""
self._thread_lock.acquire()
self._file.open_and_lock()
if not self._file.is_locked():
self._read_only = True
if self._warn_on_readonly:
logger.warn('The credentials file (%s) is not writable. Opening in '
'read-only mode. Any refreshed credentials will only be '
'valid for this run.' % self._file.filename())
if os.path.getsize(self._file.filename()) == 0:
logger.debug('Initializing empty multistore file')
# The multistore is empty so write out an empty file.
self._data = {}
self._write()
elif not self._read_only or self._data is None:
# Only refresh the data if we are read/write or we haven't
# cached the data yet. If we are readonly, we assume is isn't
# changing out from under us and that we only have to read it
# once. This prevents us from whacking any new access keys that
# we have cached in memory but were unable to write out.
self._refresh_data_cache()
def _unlock(self):
"""Release the lock on the multistore."""
self._file.unlock_and_close()
self._thread_lock.release()
def _locked_json_read(self):
"""Get the raw content of the multistore file.
The multistore must be locked when this is called.
Returns:
The contents of the multistore decoded as JSON.
"""
assert self._thread_lock.locked()
self._file.file_handle().seek(0)
return simplejson.load(self._file.file_handle())
def _locked_json_write(self, data):
"""Write a JSON serializable data structure to the multistore.
The multistore must be locked when this is called.
Args:
data: The data to be serialized and written.
"""
assert self._thread_lock.locked()
if self._read_only:
return
self._file.file_handle().seek(0)
simplejson.dump(data, self._file.file_handle(), sort_keys=True, indent=2)
self._file.file_handle().truncate()
def _refresh_data_cache(self):
"""Refresh the contents of the multistore.
The multistore must be locked when this is called.
Raises:
NewerCredentialStoreError: Raised when a newer client has written the
store.
"""
self._data = {}
try:
raw_data = self._locked_json_read()
except Exception:
logger.warn('Credential data store could not be loaded. '
'Will ignore and overwrite.')
return
version = 0
try:
version = raw_data['file_version']
except Exception:
logger.warn('Missing version for credential data store. It may be '
'corrupt or an old version. Overwriting.')
if version > 1:
raise NewerCredentialStoreError(
'Credential file has file_version of %d. '
'Only file_version of 1 is supported.' % version)
credentials = []
try:
credentials = raw_data['data']
except (TypeError, KeyError):
pass
for cred_entry in credentials:
try:
(key, credential) = self._decode_credential_from_json(cred_entry)
self._data[key] = credential
except:
# If something goes wrong loading a credential, just ignore it
logger.info('Error decoding credential, skipping', exc_info=True)
def _decode_credential_from_json(self, cred_entry):
"""Load a credential from our JSON serialization.
Args:
cred_entry: A dict entry from the data member of our format
Returns:
(key, cred) where the key is the key tuple and the cred is the
OAuth2Credential object.
"""
raw_key = cred_entry['key']
client_id = raw_key['clientId']
user_agent = raw_key['userAgent']
scope = raw_key['scope']
key = (client_id, user_agent, scope)
credential = None
credential = Credentials.new_from_json(simplejson.dumps(cred_entry['credential']))
return (key, credential)
def _write(self):
"""Write the cached data back out.
The multistore must be locked.
"""
raw_data = {'file_version': 1}
raw_creds = []
raw_data['data'] = raw_creds
for (cred_key, cred) in self._data.items():
raw_key = {
'clientId': cred_key[0],
'userAgent': cred_key[1],
'scope': cred_key[2]
}
raw_cred = simplejson.loads(cred.to_json())
raw_creds.append({'key': raw_key, 'credential': raw_cred})
self._locked_json_write(raw_data)
def _get_credential(self, client_id, user_agent, scope):
"""Get a credential from the multistore.
The multistore must be locked.
Args:
client_id: The client_id for the credential
user_agent: The user agent for the credential
scope: A string for the scope(s) being requested
Returns:
The credential specified or None if not present
"""
key = (client_id, user_agent, scope)
return self._data.get(key, None)
def _update_credential(self, cred, scope):
"""Update a credential and write the multistore.
This must be called when the multistore is locked.
Args:
cred: The OAuth2Credential to update/set
scope: The scope(s) that this credential covers
"""
key = (cred.client_id, cred.user_agent, scope)
self._data[key] = cred
self._write()
def _delete_credential(self, client_id, user_agent, scope):
"""Delete a credential and write the multistore.
This must be called when the multistore is locked.
Args:
client_id: The client_id for the credential
user_agent: The user agent for the credential
scope: The scope(s) that this credential covers
"""
key = (client_id, user_agent, scope)
try:
del self._data[key]
except KeyError:
pass
self._write()
def _get_storage(self, client_id, user_agent, scope):
"""Get a Storage object to get/set a credential.
This Storage is a 'view' into the multistore.
Args:
client_id: The client_id for the credential
user_agent: The user agent for the credential
scope: A string for the scope(s) being requested
Returns:
A Storage object that can be used to get/set this cred
"""
return self._Storage(self, client_id, user_agent, scope)
| [
[
8,
0,
0.0437,
0.0741,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0847,
0.0026,
0,
0.66,
0.0588,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0899,
0.0026,
0,
0.66,... | [
"\"\"\"Multi-credential file store with lock support.\n\nThis module implements a JSON credential store where multiple\ncredentials can be stored in one file. That file supports locking\nboth in a single process and across processes.\n\nThe credential themselves are keyed off of:\n* client_id",
"__author__ = 'jb... |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""An OAuth 2.0 client.
Tools for interacting with OAuth 2.0 protected resources.
"""
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
import base64
import clientsecrets
import copy
import datetime
import httplib2
import logging
import os
import sys
import time
import urllib
import urlparse
from anyjson import simplejson
HAS_OPENSSL = False
try:
from oauth2client.crypt import Signer
from oauth2client.crypt import make_signed_jwt
from oauth2client.crypt import verify_signed_jwt_with_certs
HAS_OPENSSL = True
except ImportError:
pass
try:
from urlparse import parse_qsl
except ImportError:
from cgi import parse_qsl
logger = logging.getLogger(__name__)
# Expiry is stored in RFC3339 UTC format
EXPIRY_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
# Which certs to use to validate id_tokens received.
ID_TOKEN_VERIFICATON_CERTS = 'https://www.googleapis.com/oauth2/v1/certs'
# Constant to use for the out of band OAuth 2.0 flow.
OOB_CALLBACK_URN = 'urn:ietf:wg:oauth:2.0:oob'
class Error(Exception):
"""Base error for this module."""
pass
class FlowExchangeError(Error):
"""Error trying to exchange an authorization grant for an access token."""
pass
class AccessTokenRefreshError(Error):
"""Error trying to refresh an expired access token."""
pass
class UnknownClientSecretsFlowError(Error):
"""The client secrets file called for an unknown type of OAuth 2.0 flow. """
pass
class AccessTokenCredentialsError(Error):
"""Having only the access_token means no refresh is possible."""
pass
class VerifyJwtTokenError(Error):
"""Could on retrieve certificates for validation."""
pass
def _abstract():
raise NotImplementedError('You need to override this function')
class MemoryCache(object):
"""httplib2 Cache implementation which only caches locally."""
def __init__(self):
self.cache = {}
def get(self, key):
return self.cache.get(key)
def set(self, key, value):
self.cache[key] = value
def delete(self, key):
self.cache.pop(key, None)
class Credentials(object):
"""Base class for all Credentials objects.
Subclasses must define an authorize() method that applies the credentials to
an HTTP transport.
Subclasses must also specify a classmethod named 'from_json' that takes a JSON
string as input and returns an instaniated Credentials object.
"""
NON_SERIALIZED_MEMBERS = ['store']
def authorize(self, http):
"""Take an httplib2.Http instance (or equivalent) and
authorizes it for the set of credentials, usually by
replacing http.request() with a method that adds in
the appropriate headers and then delegates to the original
Http.request() method.
"""
_abstract()
def refresh(self, http):
"""Forces a refresh of the access_token.
Args:
http: httplib2.Http, an http object to be used to make the refresh
request.
"""
_abstract()
def apply(self, headers):
"""Add the authorization to the headers.
Args:
headers: dict, the headers to add the Authorization header to.
"""
_abstract()
def _to_json(self, strip):
"""Utility function for creating a JSON representation of an instance of Credentials.
Args:
strip: array, An array of names of members to not include in the JSON.
Returns:
string, a JSON representation of this instance, suitable to pass to
from_json().
"""
t = type(self)
d = copy.copy(self.__dict__)
for member in strip:
if member in d:
del d[member]
if 'token_expiry' in d and isinstance(d['token_expiry'], datetime.datetime):
d['token_expiry'] = d['token_expiry'].strftime(EXPIRY_FORMAT)
# Add in information we will need later to reconsistitue this instance.
d['_class'] = t.__name__
d['_module'] = t.__module__
return simplejson.dumps(d)
def to_json(self):
"""Creating a JSON representation of an instance of Credentials.
Returns:
string, a JSON representation of this instance, suitable to pass to
from_json().
"""
return self._to_json(Credentials.NON_SERIALIZED_MEMBERS)
@classmethod
def new_from_json(cls, s):
"""Utility class method to instantiate a Credentials subclass from a JSON
representation produced by to_json().
Args:
s: string, JSON from to_json().
Returns:
An instance of the subclass of Credentials that was serialized with
to_json().
"""
data = simplejson.loads(s)
# Find and call the right classmethod from_json() to restore the object.
module = data['_module']
try:
m = __import__(module)
except ImportError:
# In case there's an object from the old package structure, update it
module = module.replace('.apiclient', '')
m = __import__(module)
m = __import__(module, fromlist=module.split('.')[:-1])
kls = getattr(m, data['_class'])
from_json = getattr(kls, 'from_json')
return from_json(s)
@classmethod
def from_json(cls, s):
"""Instantiate a Credentials object from a JSON description of it.
The JSON should have been produced by calling .to_json() on the object.
Args:
data: dict, A deserialized JSON object.
Returns:
An instance of a Credentials subclass.
"""
return Credentials()
class Flow(object):
"""Base class for all Flow objects."""
pass
class Storage(object):
"""Base class for all Storage objects.
Store and retrieve a single credential. This class supports locking
such that multiple processes and threads can operate on a single
store.
"""
def acquire_lock(self):
"""Acquires any lock necessary to access this Storage.
This lock is not reentrant.
"""
pass
def release_lock(self):
"""Release the Storage lock.
Trying to release a lock that isn't held will result in a
RuntimeError.
"""
pass
def locked_get(self):
"""Retrieve credential.
The Storage lock must be held when this is called.
Returns:
oauth2client.client.Credentials
"""
_abstract()
def locked_put(self, credentials):
"""Write a credential.
The Storage lock must be held when this is called.
Args:
credentials: Credentials, the credentials to store.
"""
_abstract()
def locked_delete(self):
"""Delete a credential.
The Storage lock must be held when this is called.
"""
_abstract()
def get(self):
"""Retrieve credential.
The Storage lock must *not* be held when this is called.
Returns:
oauth2client.client.Credentials
"""
self.acquire_lock()
try:
return self.locked_get()
finally:
self.release_lock()
def put(self, credentials):
"""Write a credential.
The Storage lock must be held when this is called.
Args:
credentials: Credentials, the credentials to store.
"""
self.acquire_lock()
try:
self.locked_put(credentials)
finally:
self.release_lock()
def delete(self):
"""Delete credential.
Frees any resources associated with storing the credential.
The Storage lock must *not* be held when this is called.
Returns:
None
"""
self.acquire_lock()
try:
return self.locked_delete()
finally:
self.release_lock()
class OAuth2Credentials(Credentials):
"""Credentials object for OAuth 2.0.
Credentials can be applied to an httplib2.Http object using the authorize()
method, which then adds the OAuth 2.0 access token to each request.
OAuth2Credentials objects may be safely pickled and unpickled.
"""
def __init__(self, access_token, client_id, client_secret, refresh_token,
token_expiry, token_uri, user_agent, id_token=None):
"""Create an instance of OAuth2Credentials.
This constructor is not usually called by the user, instead
OAuth2Credentials objects are instantiated by the OAuth2WebServerFlow.
Args:
access_token: string, access token.
client_id: string, client identifier.
client_secret: string, client secret.
refresh_token: string, refresh token.
token_expiry: datetime, when the access_token expires.
token_uri: string, URI of token endpoint.
user_agent: string, The HTTP User-Agent to provide for this application.
id_token: object, The identity of the resource owner.
Notes:
store: callable, A callable that when passed a Credential
will store the credential back to where it came from.
This is needed to store the latest access_token if it
has expired and been refreshed.
"""
self.access_token = access_token
self.client_id = client_id
self.client_secret = client_secret
self.refresh_token = refresh_token
self.store = None
self.token_expiry = token_expiry
self.token_uri = token_uri
self.user_agent = user_agent
self.id_token = id_token
# True if the credentials have been revoked or expired and can't be
# refreshed.
self.invalid = False
def authorize(self, http):
"""Authorize an httplib2.Http instance with these credentials.
The modified http.request method will add authentication headers to each
request and will refresh access_tokens when a 401 is received on a
request. In addition the http.request method has a credentials property,
http.request.credentials, which is the Credentials object that authorized
it.
Args:
http: An instance of httplib2.Http
or something that acts like it.
Returns:
A modified instance of http that was passed in.
Example:
h = httplib2.Http()
h = credentials.authorize(h)
You can't create a new OAuth subclass of httplib2.Authenication
because it never gets passed the absolute URI, which is needed for
signing. So instead we have to overload 'request' with a closure
that adds in the Authorization header and then calls the original
version of 'request()'.
"""
request_orig = http.request
# The closure that will replace 'httplib2.Http.request'.
def new_request(uri, method='GET', body=None, headers=None,
redirections=httplib2.DEFAULT_MAX_REDIRECTS,
connection_type=None):
if not self.access_token:
logger.info('Attempting refresh to obtain initial access_token')
self._refresh(request_orig)
# Modify the request headers to add the appropriate
# Authorization header.
if headers is None:
headers = {}
self.apply(headers)
if self.user_agent is not None:
if 'user-agent' in headers:
headers['user-agent'] = self.user_agent + ' ' + headers['user-agent']
else:
headers['user-agent'] = self.user_agent
resp, content = request_orig(uri, method, body, headers,
redirections, connection_type)
if resp.status == 401:
logger.info('Refreshing due to a 401')
self._refresh(request_orig)
self.apply(headers)
return request_orig(uri, method, body, headers,
redirections, connection_type)
else:
return (resp, content)
# Replace the request method with our own closure.
http.request = new_request
# Set credentials as a property of the request method.
setattr(http.request, 'credentials', self)
return http
def refresh(self, http):
"""Forces a refresh of the access_token.
Args:
http: httplib2.Http, an http object to be used to make the refresh
request.
"""
self._refresh(http.request)
def apply(self, headers):
"""Add the authorization to the headers.
Args:
headers: dict, the headers to add the Authorization header to.
"""
headers['Authorization'] = 'Bearer ' + self.access_token
def to_json(self):
return self._to_json(Credentials.NON_SERIALIZED_MEMBERS)
@classmethod
def from_json(cls, s):
"""Instantiate a Credentials object from a JSON description of it. The JSON
should have been produced by calling .to_json() on the object.
Args:
data: dict, A deserialized JSON object.
Returns:
An instance of a Credentials subclass.
"""
data = simplejson.loads(s)
if 'token_expiry' in data and not isinstance(data['token_expiry'],
datetime.datetime):
try:
data['token_expiry'] = datetime.datetime.strptime(
data['token_expiry'], EXPIRY_FORMAT)
except:
data['token_expiry'] = None
retval = OAuth2Credentials(
data['access_token'],
data['client_id'],
data['client_secret'],
data['refresh_token'],
data['token_expiry'],
data['token_uri'],
data['user_agent'],
data.get('id_token', None))
retval.invalid = data['invalid']
return retval
@property
def access_token_expired(self):
"""True if the credential is expired or invalid.
If the token_expiry isn't set, we assume the token doesn't expire.
"""
if self.invalid:
return True
if not self.token_expiry:
return False
now = datetime.datetime.utcnow()
if now >= self.token_expiry:
logger.info('access_token is expired. Now: %s, token_expiry: %s',
now, self.token_expiry)
return True
return False
def set_store(self, store):
"""Set the Storage for the credential.
Args:
store: Storage, an implementation of Stroage object.
This is needed to store the latest access_token if it
has expired and been refreshed. This implementation uses
locking to check for updates before updating the
access_token.
"""
self.store = store
def _updateFromCredential(self, other):
"""Update this Credential from another instance."""
self.__dict__.update(other.__getstate__())
def __getstate__(self):
"""Trim the state down to something that can be pickled."""
d = copy.copy(self.__dict__)
del d['store']
return d
def __setstate__(self, state):
"""Reconstitute the state of the object from being pickled."""
self.__dict__.update(state)
self.store = None
def _generate_refresh_request_body(self):
"""Generate the body that will be used in the refresh request."""
body = urllib.urlencode({
'grant_type': 'refresh_token',
'client_id': self.client_id,
'client_secret': self.client_secret,
'refresh_token': self.refresh_token,
})
return body
def _generate_refresh_request_headers(self):
"""Generate the headers that will be used in the refresh request."""
headers = {
'content-type': 'application/x-www-form-urlencoded',
}
if self.user_agent is not None:
headers['user-agent'] = self.user_agent
return headers
def _refresh(self, http_request):
"""Refreshes the access_token.
This method first checks by reading the Storage object if available.
If a refresh is still needed, it holds the Storage lock until the
refresh is completed.
Args:
http_request: callable, a callable that matches the method signature of
httplib2.Http.request, used to make the refresh request.
Raises:
AccessTokenRefreshError: When the refresh fails.
"""
if not self.store:
self._do_refresh_request(http_request)
else:
self.store.acquire_lock()
try:
new_cred = self.store.locked_get()
if (new_cred and not new_cred.invalid and
new_cred.access_token != self.access_token):
logger.info('Updated access_token read from Storage')
self._updateFromCredential(new_cred)
else:
self._do_refresh_request(http_request)
finally:
self.store.release_lock()
def _do_refresh_request(self, http_request):
"""Refresh the access_token using the refresh_token.
Args:
http_request: callable, a callable that matches the method signature of
httplib2.Http.request, used to make the refresh request.
Raises:
AccessTokenRefreshError: When the refresh fails.
"""
body = self._generate_refresh_request_body()
headers = self._generate_refresh_request_headers()
logger.info('Refreshing access_token')
resp, content = http_request(
self.token_uri, method='POST', body=body, headers=headers)
if resp.status == 200:
# TODO(jcgregorio) Raise an error if loads fails?
d = simplejson.loads(content)
self.access_token = d['access_token']
self.refresh_token = d.get('refresh_token', self.refresh_token)
if 'expires_in' in d:
self.token_expiry = datetime.timedelta(
seconds=int(d['expires_in'])) + datetime.datetime.utcnow()
else:
self.token_expiry = None
if self.store:
self.store.locked_put(self)
else:
# An {'error':...} response body means the token is expired or revoked,
# so we flag the credentials as such.
logger.info('Failed to retrieve access token: %s' % content)
error_msg = 'Invalid response %s.' % resp['status']
try:
d = simplejson.loads(content)
if 'error' in d:
error_msg = d['error']
self.invalid = True
if self.store:
self.store.locked_put(self)
except:
pass
raise AccessTokenRefreshError(error_msg)
class AccessTokenCredentials(OAuth2Credentials):
"""Credentials object for OAuth 2.0.
Credentials can be applied to an httplib2.Http object using the
authorize() method, which then signs each request from that object
with the OAuth 2.0 access token. This set of credentials is for the
use case where you have acquired an OAuth 2.0 access_token from
another place such as a JavaScript client or another web
application, and wish to use it from Python. Because only the
access_token is present it can not be refreshed and will in time
expire.
AccessTokenCredentials objects may be safely pickled and unpickled.
Usage:
credentials = AccessTokenCredentials('<an access token>',
'my-user-agent/1.0')
http = httplib2.Http()
http = credentials.authorize(http)
Exceptions:
AccessTokenCredentialsExpired: raised when the access_token expires or is
revoked.
"""
def __init__(self, access_token, user_agent):
"""Create an instance of OAuth2Credentials
This is one of the few types if Credentials that you should contrust,
Credentials objects are usually instantiated by a Flow.
Args:
access_token: string, access token.
user_agent: string, The HTTP User-Agent to provide for this application.
Notes:
store: callable, a callable that when passed a Credential
will store the credential back to where it came from.
"""
super(AccessTokenCredentials, self).__init__(
access_token,
None,
None,
None,
None,
None,
user_agent)
@classmethod
def from_json(cls, s):
data = simplejson.loads(s)
retval = AccessTokenCredentials(
data['access_token'],
data['user_agent'])
return retval
def _refresh(self, http_request):
raise AccessTokenCredentialsError(
"The access_token is expired or invalid and can't be refreshed.")
class AssertionCredentials(OAuth2Credentials):
"""Abstract Credentials object used for OAuth 2.0 assertion grants.
This credential does not require a flow to instantiate because it
represents a two legged flow, and therefore has all of the required
information to generate and refresh its own access tokens. It must
be subclassed to generate the appropriate assertion string.
AssertionCredentials objects may be safely pickled and unpickled.
"""
def __init__(self, assertion_type, user_agent,
token_uri='https://accounts.google.com/o/oauth2/token',
**unused_kwargs):
"""Constructor for AssertionFlowCredentials.
Args:
assertion_type: string, assertion type that will be declared to the auth
server
user_agent: string, The HTTP User-Agent to provide for this application.
token_uri: string, URI for token endpoint. For convenience
defaults to Google's endpoints but any OAuth 2.0 provider can be used.
"""
super(AssertionCredentials, self).__init__(
None,
None,
None,
None,
None,
token_uri,
user_agent)
self.assertion_type = assertion_type
def _generate_refresh_request_body(self):
assertion = self._generate_assertion()
body = urllib.urlencode({
'assertion_type': self.assertion_type,
'assertion': assertion,
'grant_type': 'assertion',
})
return body
def _generate_assertion(self):
"""Generate the assertion string that will be used in the access token
request.
"""
_abstract()
if HAS_OPENSSL:
# PyOpenSSL is not a prerequisite for oauth2client, so if it is missing then
# don't create the SignedJwtAssertionCredentials or the verify_id_token()
# method.
class SignedJwtAssertionCredentials(AssertionCredentials):
"""Credentials object used for OAuth 2.0 Signed JWT assertion grants.
This credential does not require a flow to instantiate because it
represents a two legged flow, and therefore has all of the required
information to generate and refresh its own access tokens.
"""
MAX_TOKEN_LIFETIME_SECS = 3600 # 1 hour in seconds
def __init__(self,
service_account_name,
private_key,
scope,
private_key_password='notasecret',
user_agent=None,
token_uri='https://accounts.google.com/o/oauth2/token',
**kwargs):
"""Constructor for SignedJwtAssertionCredentials.
Args:
service_account_name: string, id for account, usually an email address.
private_key: string, private key in P12 format.
scope: string or list of strings, scope(s) of the credentials being
requested.
private_key_password: string, password for private_key.
user_agent: string, HTTP User-Agent to provide for this application.
token_uri: string, URI for token endpoint. For convenience
defaults to Google's endpoints but any OAuth 2.0 provider can be used.
kwargs: kwargs, Additional parameters to add to the JWT token, for
example prn=joe@xample.org."""
super(SignedJwtAssertionCredentials, self).__init__(
'http://oauth.net/grant_type/jwt/1.0/bearer',
user_agent,
token_uri=token_uri,
)
if type(scope) is list:
scope = ' '.join(scope)
self.scope = scope
self.private_key = private_key
self.private_key_password = private_key_password
self.service_account_name = service_account_name
self.kwargs = kwargs
@classmethod
def from_json(cls, s):
data = simplejson.loads(s)
retval = SignedJwtAssertionCredentials(
data['service_account_name'],
data['private_key'],
data['private_key_password'],
data['scope'],
data['user_agent'],
data['token_uri'],
data['kwargs']
)
retval.invalid = data['invalid']
return retval
def _generate_assertion(self):
"""Generate the assertion that will be used in the request."""
now = long(time.time())
payload = {
'aud': self.token_uri,
'scope': self.scope,
'iat': now,
'exp': now + SignedJwtAssertionCredentials.MAX_TOKEN_LIFETIME_SECS,
'iss': self.service_account_name
}
payload.update(self.kwargs)
logger.debug(str(payload))
return make_signed_jwt(
Signer.from_string(self.private_key, self.private_key_password),
payload)
# Only used in verify_id_token(), which is always calling to the same URI
# for the certs.
_cached_http = httplib2.Http(MemoryCache())
def verify_id_token(id_token, audience, http=None,
cert_uri=ID_TOKEN_VERIFICATON_CERTS):
"""Verifies a signed JWT id_token.
Args:
id_token: string, A Signed JWT.
audience: string, The audience 'aud' that the token should be for.
http: httplib2.Http, instance to use to make the HTTP request. Callers
should supply an instance that has caching enabled.
cert_uri: string, URI of the certificates in JSON format to
verify the JWT against.
Returns:
The deserialized JSON in the JWT.
Raises:
oauth2client.crypt.AppIdentityError if the JWT fails to verify.
"""
if http is None:
http = _cached_http
resp, content = http.request(cert_uri)
if resp.status == 200:
certs = simplejson.loads(content)
return verify_signed_jwt_with_certs(id_token, certs, audience)
else:
raise VerifyJwtTokenError('Status code: %d' % resp.status)
def _urlsafe_b64decode(b64string):
# Guard against unicode strings, which base64 can't handle.
b64string = b64string.encode('ascii')
padded = b64string + '=' * (4 - len(b64string) % 4)
return base64.urlsafe_b64decode(padded)
def _extract_id_token(id_token):
"""Extract the JSON payload from a JWT.
Does the extraction w/o checking the signature.
Args:
id_token: string, OAuth 2.0 id_token.
Returns:
object, The deserialized JSON payload.
"""
segments = id_token.split('.')
if (len(segments) != 3):
raise VerifyJwtTokenError(
'Wrong number of segments in token: %s' % id_token)
return simplejson.loads(_urlsafe_b64decode(segments[1]))
def credentials_from_code(client_id, client_secret, scope, code,
redirect_uri = 'postmessage',
http=None, user_agent=None,
token_uri='https://accounts.google.com/o/oauth2/token'):
"""Exchanges an authorization code for an OAuth2Credentials object.
Args:
client_id: string, client identifier.
client_secret: string, client secret.
scope: string or list of strings, scope(s) to request.
code: string, An authroization code, most likely passed down from
the client
redirect_uri: string, this is generally set to 'postmessage' to match the
redirect_uri that the client specified
http: httplib2.Http, optional http instance to use to do the fetch
token_uri: string, URI for token endpoint. For convenience
defaults to Google's endpoints but any OAuth 2.0 provider can be used.
Returns:
An OAuth2Credentials object.
Raises:
FlowExchangeError if the authorization code cannot be exchanged for an
access token
"""
flow = OAuth2WebServerFlow(client_id, client_secret, scope, user_agent,
'https://accounts.google.com/o/oauth2/auth',
token_uri)
# We primarily make this call to set up the redirect_uri in the flow object
uriThatWeDontReallyUse = flow.step1_get_authorize_url(redirect_uri)
credentials = flow.step2_exchange(code, http)
return credentials
def credentials_from_clientsecrets_and_code(filename, scope, code,
message = None,
redirect_uri = 'postmessage',
http=None):
"""Returns OAuth2Credentials from a clientsecrets file and an auth code.
Will create the right kind of Flow based on the contents of the clientsecrets
file or will raise InvalidClientSecretsError for unknown types of Flows.
Args:
filename: string, File name of clientsecrets.
scope: string or list of strings, scope(s) to request.
code: string, An authroization code, most likely passed down from
the client
message: string, A friendly string to display to the user if the
clientsecrets file is missing or invalid. If message is provided then
sys.exit will be called in the case of an error. If message in not
provided then clientsecrets.InvalidClientSecretsError will be raised.
redirect_uri: string, this is generally set to 'postmessage' to match the
redirect_uri that the client specified
http: httplib2.Http, optional http instance to use to do the fetch
Returns:
An OAuth2Credentials object.
Raises:
FlowExchangeError if the authorization code cannot be exchanged for an
access token
UnknownClientSecretsFlowError if the file describes an unknown kind of Flow.
clientsecrets.InvalidClientSecretsError if the clientsecrets file is
invalid.
"""
flow = flow_from_clientsecrets(filename, scope, message)
# We primarily make this call to set up the redirect_uri in the flow object
uriThatWeDontReallyUse = flow.step1_get_authorize_url(redirect_uri)
credentials = flow.step2_exchange(code, http)
return credentials
class OAuth2WebServerFlow(Flow):
"""Does the Web Server Flow for OAuth 2.0.
OAuth2Credentials objects may be safely pickled and unpickled.
"""
def __init__(self, client_id, client_secret, scope, user_agent=None,
auth_uri='https://accounts.google.com/o/oauth2/auth',
token_uri='https://accounts.google.com/o/oauth2/token',
**kwargs):
"""Constructor for OAuth2WebServerFlow.
Args:
client_id: string, client identifier.
client_secret: string client secret.
scope: string or list of strings, scope(s) of the credentials being
requested.
user_agent: string, HTTP User-Agent to provide for this application.
auth_uri: string, URI for authorization endpoint. For convenience
defaults to Google's endpoints but any OAuth 2.0 provider can be used.
token_uri: string, URI for token endpoint. For convenience
defaults to Google's endpoints but any OAuth 2.0 provider can be used.
**kwargs: dict, The keyword arguments are all optional and required
parameters for the OAuth calls.
"""
self.client_id = client_id
self.client_secret = client_secret
if type(scope) is list:
scope = ' '.join(scope)
self.scope = scope
self.user_agent = user_agent
self.auth_uri = auth_uri
self.token_uri = token_uri
self.params = {
'access_type': 'offline',
}
self.params.update(kwargs)
self.redirect_uri = None
def step1_get_authorize_url(self, redirect_uri=OOB_CALLBACK_URN):
"""Returns a URI to redirect to the provider.
Args:
redirect_uri: string, Either the string 'urn:ietf:wg:oauth:2.0:oob' for
a non-web-based application, or a URI that handles the callback from
the authorization server.
If redirect_uri is 'urn:ietf:wg:oauth:2.0:oob' then pass in the
generated verification code to step2_exchange,
otherwise pass in the query parameters received
at the callback uri to step2_exchange.
"""
self.redirect_uri = redirect_uri
query = {
'response_type': 'code',
'client_id': self.client_id,
'redirect_uri': redirect_uri,
'scope': self.scope,
}
query.update(self.params)
parts = list(urlparse.urlparse(self.auth_uri))
query.update(dict(parse_qsl(parts[4]))) # 4 is the index of the query part
parts[4] = urllib.urlencode(query)
return urlparse.urlunparse(parts)
def step2_exchange(self, code, http=None):
"""Exhanges a code for OAuth2Credentials.
Args:
code: string or dict, either the code as a string, or a dictionary
of the query parameters to the redirect_uri, which contains
the code.
http: httplib2.Http, optional http instance to use to do the fetch
Returns:
An OAuth2Credentials object that can be used to authorize requests.
Raises:
FlowExchangeError if a problem occured exchanging the code for a
refresh_token.
"""
if not (isinstance(code, str) or isinstance(code, unicode)):
if 'code' not in code:
if 'error' in code:
error_msg = code['error']
else:
error_msg = 'No code was supplied in the query parameters.'
raise FlowExchangeError(error_msg)
else:
code = code['code']
body = urllib.urlencode({
'grant_type': 'authorization_code',
'client_id': self.client_id,
'client_secret': self.client_secret,
'code': code,
'redirect_uri': self.redirect_uri,
'scope': self.scope,
})
headers = {
'content-type': 'application/x-www-form-urlencoded',
}
if self.user_agent is not None:
headers['user-agent'] = self.user_agent
if http is None:
http = httplib2.Http()
resp, content = http.request(self.token_uri, method='POST', body=body,
headers=headers)
if resp.status == 200:
# TODO(jcgregorio) Raise an error if simplejson.loads fails?
d = simplejson.loads(content)
access_token = d['access_token']
refresh_token = d.get('refresh_token', None)
token_expiry = None
if 'expires_in' in d:
token_expiry = datetime.datetime.utcnow() + datetime.timedelta(
seconds=int(d['expires_in']))
if 'id_token' in d:
d['id_token'] = _extract_id_token(d['id_token'])
logger.info('Successfully retrieved access token: %s' % content)
return OAuth2Credentials(access_token, self.client_id,
self.client_secret, refresh_token, token_expiry,
self.token_uri, self.user_agent,
id_token=d.get('id_token', None))
else:
logger.info('Failed to retrieve access token: %s' % content)
error_msg = 'Invalid response %s.' % resp['status']
try:
d = simplejson.loads(content)
if 'error' in d:
error_msg = d['error']
except:
pass
raise FlowExchangeError(error_msg)
def flow_from_clientsecrets(filename, scope, message=None):
"""Create a Flow from a clientsecrets file.
Will create the right kind of Flow based on the contents of the clientsecrets
file or will raise InvalidClientSecretsError for unknown types of Flows.
Args:
filename: string, File name of client secrets.
scope: string or list of strings, scope(s) to request.
message: string, A friendly string to display to the user if the
clientsecrets file is missing or invalid. If message is provided then
sys.exit will be called in the case of an error. If message in not
provided then clientsecrets.InvalidClientSecretsError will be raised.
Returns:
A Flow object.
Raises:
UnknownClientSecretsFlowError if the file describes an unknown kind of Flow.
clientsecrets.InvalidClientSecretsError if the clientsecrets file is
invalid.
"""
try:
client_type, client_info = clientsecrets.loadfile(filename)
if client_type in [clientsecrets.TYPE_WEB, clientsecrets.TYPE_INSTALLED]:
return OAuth2WebServerFlow(
client_info['client_id'],
client_info['client_secret'],
scope,
None, # user_agent
client_info['auth_uri'],
client_info['token_uri'])
except clientsecrets.InvalidClientSecretsError:
if message:
sys.exit(message)
else:
raise
else:
raise UnknownClientSecretsFlowError(
'This OAuth 2.0 flow is unsupported: "%s"' * client_type)
| [
[
8,
0,
0.0145,
0.0035,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0176,
0.0009,
0,
0.66,
0.0244,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0193,
0.0009,
0,
0.66,... | [
"\"\"\"An OAuth 2.0 client.\n\nTools for interacting with OAuth 2.0 protected resources.\n\"\"\"",
"__author__ = 'jcgregorio@google.com (Joe Gregorio)'",
"import base64",
"import clientsecrets",
"import copy",
"import datetime",
"import httplib2",
"import logging",
"import os",
"import sys",
"im... |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Utilities for OAuth.
Utilities for making it easier to work with OAuth 2.0
credentials.
"""
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
import os
import stat
import threading
from anyjson import simplejson
from client import Storage as BaseStorage
from client import Credentials
class Storage(BaseStorage):
"""Store and retrieve a single credential to and from a file."""
def __init__(self, filename):
self._filename = filename
self._lock = threading.Lock()
def acquire_lock(self):
"""Acquires any lock necessary to access this Storage.
This lock is not reentrant."""
self._lock.acquire()
def release_lock(self):
"""Release the Storage lock.
Trying to release a lock that isn't held will result in a
RuntimeError.
"""
self._lock.release()
def locked_get(self):
"""Retrieve Credential from file.
Returns:
oauth2client.client.Credentials
"""
credentials = None
try:
f = open(self._filename, 'rb')
content = f.read()
f.close()
except IOError:
return credentials
try:
credentials = Credentials.new_from_json(content)
credentials.set_store(self)
except ValueError:
pass
return credentials
def _create_file_if_needed(self):
"""Create an empty file if necessary.
This method will not initialize the file. Instead it implements a
simple version of "touch" to ensure the file has been created.
"""
if not os.path.exists(self._filename):
old_umask = os.umask(0177)
try:
open(self._filename, 'a+b').close()
finally:
os.umask(old_umask)
def locked_put(self, credentials):
"""Write Credentials to file.
Args:
credentials: Credentials, the credentials to store.
"""
self._create_file_if_needed()
f = open(self._filename, 'wb')
f.write(credentials.to_json())
f.close()
def locked_delete(self):
"""Delete Credentials file.
Args:
credentials: Credentials, the credentials to store.
"""
os.unlink(self._filename)
| [
[
8,
0,
0.1604,
0.0472,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1981,
0.0094,
0,
0.66,
0.125,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.217,
0.0094,
0,
0.66,
... | [
"\"\"\"Utilities for OAuth.\n\nUtilities for making it easier to work with OAuth 2.0\ncredentials.\n\"\"\"",
"__author__ = 'jcgregorio@google.com (Joe Gregorio)'",
"import os",
"import stat",
"import threading",
"from anyjson import simplejson",
"from client import Storage as BaseStorage",
"from clien... |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""OAuth 2.0 utilities for Django.
Utilities for using OAuth 2.0 in conjunction with
the Django datastore.
"""
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
import oauth2client
import base64
import pickle
from django.db import models
from oauth2client.client import Storage as BaseStorage
class CredentialsField(models.Field):
__metaclass__ = models.SubfieldBase
def get_internal_type(self):
return "TextField"
def to_python(self, value):
if value is None:
return None
if isinstance(value, oauth2client.client.Credentials):
return value
return pickle.loads(base64.b64decode(value))
def get_db_prep_value(self, value, connection, prepared=False):
if value is None:
return None
return base64.b64encode(pickle.dumps(value))
class FlowField(models.Field):
__metaclass__ = models.SubfieldBase
def get_internal_type(self):
return "TextField"
def to_python(self, value):
if value is None:
return None
if isinstance(value, oauth2client.client.Flow):
return value
return pickle.loads(base64.b64decode(value))
def get_db_prep_value(self, value, connection, prepared=False):
if value is None:
return None
return base64.b64encode(pickle.dumps(value))
class Storage(BaseStorage):
"""Store and retrieve a single credential to and from
the datastore.
This Storage helper presumes the Credentials
have been stored as a CredenialsField
on a db model class.
"""
def __init__(self, model_class, key_name, key_value, property_name):
"""Constructor for Storage.
Args:
model: db.Model, model class
key_name: string, key name for the entity that has the credentials
key_value: string, key value for the entity that has the credentials
property_name: string, name of the property that is an CredentialsProperty
"""
self.model_class = model_class
self.key_name = key_name
self.key_value = key_value
self.property_name = property_name
def locked_get(self):
"""Retrieve Credential from datastore.
Returns:
oauth2client.Credentials
"""
credential = None
query = {self.key_name: self.key_value}
entities = self.model_class.objects.filter(**query)
if len(entities) > 0:
credential = getattr(entities[0], self.property_name)
if credential and hasattr(credential, 'set_store'):
credential.set_store(self)
return credential
def locked_put(self, credentials):
"""Write a Credentials to the datastore.
Args:
credentials: Credentials, the credentials to store.
"""
args = {self.key_name: self.key_value}
entity = self.model_class(**args)
setattr(entity, self.property_name, credentials)
entity.save()
def locked_delete(self):
"""Delete Credentials from the datastore."""
query = {self.key_name: self.key_value}
entities = self.model_class.objects.filter(**query).delete()
| [
[
8,
0,
0.1371,
0.0403,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1694,
0.0081,
0,
0.66,
0.1111,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1855,
0.0081,
0,
0.66,... | [
"\"\"\"OAuth 2.0 utilities for Django.\n\nUtilities for using OAuth 2.0 in conjunction with\nthe Django datastore.\n\"\"\"",
"__author__ = 'jcgregorio@google.com (Joe Gregorio)'",
"import oauth2client",
"import base64",
"import pickle",
"from django.db import models",
"from oauth2client.client import St... |
#!/usr/bin/python2.4
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import base64
import hashlib
import logging
import time
from OpenSSL import crypto
from anyjson import simplejson
CLOCK_SKEW_SECS = 300 # 5 minutes in seconds
AUTH_TOKEN_LIFETIME_SECS = 300 # 5 minutes in seconds
MAX_TOKEN_LIFETIME_SECS = 86400 # 1 day in seconds
class AppIdentityError(Exception):
pass
class Verifier(object):
"""Verifies the signature on a message."""
def __init__(self, pubkey):
"""Constructor.
Args:
pubkey, OpenSSL.crypto.PKey, The public key to verify with.
"""
self._pubkey = pubkey
def verify(self, message, signature):
"""Verifies a message against a signature.
Args:
message: string, The message to verify.
signature: string, The signature on the message.
Returns:
True if message was singed by the private key associated with the public
key that this object was constructed with.
"""
try:
crypto.verify(self._pubkey, signature, message, 'sha256')
return True
except:
return False
@staticmethod
def from_string(key_pem, is_x509_cert):
"""Construct a Verified instance from a string.
Args:
key_pem: string, public key in PEM format.
is_x509_cert: bool, True if key_pem is an X509 cert, otherwise it is
expected to be an RSA key in PEM format.
Returns:
Verifier instance.
Raises:
OpenSSL.crypto.Error if the key_pem can't be parsed.
"""
if is_x509_cert:
pubkey = crypto.load_certificate(crypto.FILETYPE_PEM, key_pem)
else:
pubkey = crypto.load_privatekey(crypto.FILETYPE_PEM, key_pem)
return Verifier(pubkey)
class Signer(object):
"""Signs messages with a private key."""
def __init__(self, pkey):
"""Constructor.
Args:
pkey, OpenSSL.crypto.PKey, The private key to sign with.
"""
self._key = pkey
def sign(self, message):
"""Signs a message.
Args:
message: string, Message to be signed.
Returns:
string, The signature of the message for the given key.
"""
return crypto.sign(self._key, message, 'sha256')
@staticmethod
def from_string(key, password='notasecret'):
"""Construct a Signer instance from a string.
Args:
key: string, private key in P12 format.
password: string, password for the private key file.
Returns:
Signer instance.
Raises:
OpenSSL.crypto.Error if the key can't be parsed.
"""
pkey = crypto.load_pkcs12(key, password).get_privatekey()
return Signer(pkey)
def _urlsafe_b64encode(raw_bytes):
return base64.urlsafe_b64encode(raw_bytes).rstrip('=')
def _urlsafe_b64decode(b64string):
# Guard against unicode strings, which base64 can't handle.
b64string = b64string.encode('ascii')
padded = b64string + '=' * (4 - len(b64string) % 4)
return base64.urlsafe_b64decode(padded)
def _json_encode(data):
return simplejson.dumps(data, separators = (',', ':'))
def make_signed_jwt(signer, payload):
"""Make a signed JWT.
See http://self-issued.info/docs/draft-jones-json-web-token.html.
Args:
signer: crypt.Signer, Cryptographic signer.
payload: dict, Dictionary of data to convert to JSON and then sign.
Returns:
string, The JWT for the payload.
"""
header = {'typ': 'JWT', 'alg': 'RS256'}
segments = [
_urlsafe_b64encode(_json_encode(header)),
_urlsafe_b64encode(_json_encode(payload)),
]
signing_input = '.'.join(segments)
signature = signer.sign(signing_input)
segments.append(_urlsafe_b64encode(signature))
logging.debug(str(segments))
return '.'.join(segments)
def verify_signed_jwt_with_certs(jwt, certs, audience):
"""Verify a JWT against public certs.
See http://self-issued.info/docs/draft-jones-json-web-token.html.
Args:
jwt: string, A JWT.
certs: dict, Dictionary where values of public keys in PEM format.
audience: string, The audience, 'aud', that this JWT should contain. If
None then the JWT's 'aud' parameter is not verified.
Returns:
dict, The deserialized JSON payload in the JWT.
Raises:
AppIdentityError if any checks are failed.
"""
segments = jwt.split('.')
if (len(segments) != 3):
raise AppIdentityError(
'Wrong number of segments in token: %s' % jwt)
signed = '%s.%s' % (segments[0], segments[1])
signature = _urlsafe_b64decode(segments[2])
# Parse token.
json_body = _urlsafe_b64decode(segments[1])
try:
parsed = simplejson.loads(json_body)
except:
raise AppIdentityError('Can\'t parse token: %s' % json_body)
# Check signature.
verified = False
for (keyname, pem) in certs.items():
verifier = Verifier.from_string(pem, True)
if (verifier.verify(signed, signature)):
verified = True
break
if not verified:
raise AppIdentityError('Invalid token signature: %s' % jwt)
# Check creation timestamp.
iat = parsed.get('iat')
if iat is None:
raise AppIdentityError('No iat field in token: %s' % json_body)
earliest = iat - CLOCK_SKEW_SECS
# Check expiration timestamp.
now = long(time.time())
exp = parsed.get('exp')
if exp is None:
raise AppIdentityError('No exp field in token: %s' % json_body)
if exp >= now + MAX_TOKEN_LIFETIME_SECS:
raise AppIdentityError(
'exp field too far in future: %s' % json_body)
latest = exp + CLOCK_SKEW_SECS
if now < earliest:
raise AppIdentityError('Token used too early, %d < %d: %s' %
(now, earliest, json_body))
if now > latest:
raise AppIdentityError('Token used too late, %d > %d: %s' %
(now, latest, json_body))
# Check audience.
if audience is not None:
aud = parsed.get('aud')
if aud is None:
raise AppIdentityError('No aud field in token: %s' % json_body)
if aud != audience:
raise AppIdentityError('Wrong recipient, %s != %s: %s' %
(aud, audience, json_body))
return parsed
| [
[
1,
0,
0.0738,
0.0041,
0,
0.66,
0,
177,
0,
1,
0,
0,
177,
0,
0
],
[
1,
0,
0.0779,
0.0041,
0,
0.66,
0.0625,
154,
0,
1,
0,
0,
154,
0,
0
],
[
1,
0,
0.082,
0.0041,
0,
0... | [
"import base64",
"import hashlib",
"import logging",
"import time",
"from OpenSSL import crypto",
"from anyjson import simplejson",
"CLOCK_SKEW_SECS = 300 # 5 minutes in seconds",
"AUTH_TOKEN_LIFETIME_SECS = 300 # 5 minutes in seconds",
"MAX_TOKEN_LIFETIME_SECS = 86400 # 1 day in seconds",
"cla... |
# Copyright (C) 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Utilities for reading OAuth 2.0 client secret files.
A client_secrets.json file contains all the information needed to interact with
an OAuth 2.0 protected service.
"""
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
from anyjson import simplejson
# Properties that make a client_secrets.json file valid.
TYPE_WEB = 'web'
TYPE_INSTALLED = 'installed'
VALID_CLIENT = {
TYPE_WEB: {
'required': [
'client_id',
'client_secret',
'redirect_uris',
'auth_uri',
'token_uri'],
'string': [
'client_id',
'client_secret'
]
},
TYPE_INSTALLED: {
'required': [
'client_id',
'client_secret',
'redirect_uris',
'auth_uri',
'token_uri'],
'string': [
'client_id',
'client_secret'
]
}
}
class Error(Exception):
"""Base error for this module."""
pass
class InvalidClientSecretsError(Error):
"""Format of ClientSecrets file is invalid."""
pass
def _validate_clientsecrets(obj):
if obj is None or len(obj) != 1:
raise InvalidClientSecretsError('Invalid file format.')
client_type = obj.keys()[0]
if client_type not in VALID_CLIENT.keys():
raise InvalidClientSecretsError('Unknown client type: %s.' % client_type)
client_info = obj[client_type]
for prop_name in VALID_CLIENT[client_type]['required']:
if prop_name not in client_info:
raise InvalidClientSecretsError(
'Missing property "%s" in a client type of "%s".' % (prop_name,
client_type))
for prop_name in VALID_CLIENT[client_type]['string']:
if client_info[prop_name].startswith('[['):
raise InvalidClientSecretsError(
'Property "%s" is not configured.' % prop_name)
return client_type, client_info
def load(fp):
obj = simplejson.load(fp)
return _validate_clientsecrets(obj)
def loads(s):
obj = simplejson.loads(s)
return _validate_clientsecrets(obj)
def loadfile(filename):
try:
fp = file(filename, 'r')
try:
obj = simplejson.load(fp)
finally:
fp.close()
except IOError:
raise InvalidClientSecretsError('File not found: "%s"' % filename)
return _validate_clientsecrets(obj)
| [
[
8,
0,
0.1619,
0.0476,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2,
0.0095,
0,
0.66,
0.0909,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.2286,
0.0095,
0,
0.66,
... | [
"\"\"\"Utilities for reading OAuth 2.0 client secret files.\n\nA client_secrets.json file contains all the information needed to interact with\nan OAuth 2.0 protected service.\n\"\"\"",
"__author__ = 'jcgregorio@google.com (Joe Gregorio)'",
"from anyjson import simplejson",
"TYPE_WEB = 'web'",
"TYPE_INSTALL... |
__version__ = "1.0c2"
| [
[
14,
0,
1,
1,
0,
0.66,
0,
162,
1,
0,
0,
0,
0,
3,
0
]
] | [
"__version__ = \"1.0c2\""
] |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Utility module to import a JSON module
Hides all the messy details of exactly where
we get a simplejson module from.
"""
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
try: # pragma: no cover
# Should work for Python2.6 and higher.
import json as simplejson
except ImportError: # pragma: no cover
try:
import simplejson
except ImportError:
# Try to import from django, should work on App Engine
from django.utils import simplejson
| [
[
8,
0,
0.5312,
0.1562,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.6562,
0.0312,
0,
0.66,
0.5,
777,
1,
0,
0,
0,
0,
3,
0
],
[
7,
0,
0.875,
0.2812,
0,
0.66,
... | [
"\"\"\"Utility module to import a JSON module\n\nHides all the messy details of exactly where\nwe get a simplejson module from.\n\"\"\"",
"__author__ = 'jcgregorio@google.com (Joe Gregorio)'",
"try: # pragma: no cover\n # Should work for Python2.6 and higher.\n import json as simplejson\nexcept ImportError: #... |
import Cookie
import datetime
import time
import email.utils
import calendar
import base64
import hashlib
import hmac
import re
import logging
# Ripped from the Tornado Framework's web.py
# http://github.com/facebook/tornado/commit/39ac6d169a36a54bb1f6b9bf1fdebb5c9da96e09
#
# Tornado is licensed under the Apache Licence, Version 2.0
# (http://www.apache.org/licenses/LICENSE-2.0.html).
#
# Example:
# from vendor.prayls.lilcookies import LilCookies
# cookieutil = LilCookies(self, application_settings['cookie_secret'])
# cookieutil.set_secure_cookie(name = 'mykey', value = 'myvalue', expires_days= 365*100)
# cookieutil.get_secure_cookie(name = 'mykey')
class LilCookies:
@staticmethod
def _utf8(s):
if isinstance(s, unicode):
return s.encode("utf-8")
assert isinstance(s, str)
return s
@staticmethod
def _time_independent_equals(a, b):
if len(a) != len(b):
return False
result = 0
for x, y in zip(a, b):
result |= ord(x) ^ ord(y)
return result == 0
@staticmethod
def _signature_from_secret(cookie_secret, *parts):
""" Takes a secret salt value to create a signature for values in the `parts` param."""
hash = hmac.new(cookie_secret, digestmod=hashlib.sha1)
for part in parts: hash.update(part)
return hash.hexdigest()
@staticmethod
def _signed_cookie_value(cookie_secret, name, value):
""" Returns a signed value for use in a cookie.
This is helpful to have in its own method if you need to re-use this function for other needs. """
timestamp = str(int(time.time()))
value = base64.b64encode(value)
signature = LilCookies._signature_from_secret(cookie_secret, name, value, timestamp)
return "|".join([value, timestamp, signature])
@staticmethod
def _verified_cookie_value(cookie_secret, name, signed_value):
"""Returns the un-encrypted value given the signed value if it validates, or None."""
value = signed_value
if not value: return None
parts = value.split("|")
if len(parts) != 3: return None
signature = LilCookies._signature_from_secret(cookie_secret, name, parts[0], parts[1])
if not LilCookies._time_independent_equals(parts[2], signature):
logging.warning("Invalid cookie signature %r", value)
return None
timestamp = int(parts[1])
if timestamp < time.time() - 31 * 86400:
logging.warning("Expired cookie %r", value)
return None
try:
return base64.b64decode(parts[0])
except:
return None
def __init__(self, handler, cookie_secret):
"""You must specify the cookie_secret to use any of the secure methods.
It should be a long, random sequence of bytes to be used as the HMAC
secret for the signature.
"""
if len(cookie_secret) < 45:
raise ValueError("LilCookies cookie_secret should at least be 45 characters long, but got `%s`" % cookie_secret)
self.handler = handler
self.request = handler.request
self.response = handler.response
self.cookie_secret = cookie_secret
def cookies(self):
"""A dictionary of Cookie.Morsel objects."""
if not hasattr(self, "_cookies"):
self._cookies = Cookie.BaseCookie()
if "Cookie" in self.request.headers:
try:
self._cookies.load(self.request.headers["Cookie"])
except:
self.clear_all_cookies()
return self._cookies
def get_cookie(self, name, default=None):
"""Gets the value of the cookie with the given name, else default."""
if name in self.cookies():
return self._cookies[name].value
return default
def set_cookie(self, name, value, domain=None, expires=None, path="/",
expires_days=None, **kwargs):
"""Sets the given cookie name/value with the given options.
Additional keyword arguments are set on the Cookie.Morsel
directly.
See http://docs.python.org/library/cookie.html#morsel-objects
for available attributes.
"""
name = LilCookies._utf8(name)
value = LilCookies._utf8(value)
if re.search(r"[\x00-\x20]", name + value):
# Don't let us accidentally inject bad stuff
raise ValueError("Invalid cookie %r: %r" % (name, value))
if not hasattr(self, "_new_cookies"):
self._new_cookies = []
new_cookie = Cookie.BaseCookie()
self._new_cookies.append(new_cookie)
new_cookie[name] = value
if domain:
new_cookie[name]["domain"] = domain
if expires_days is not None and not expires:
expires = datetime.datetime.utcnow() + datetime.timedelta(days=expires_days)
if expires:
timestamp = calendar.timegm(expires.utctimetuple())
new_cookie[name]["expires"] = email.utils.formatdate(
timestamp, localtime=False, usegmt=True)
if path:
new_cookie[name]["path"] = path
for k, v in kwargs.iteritems():
new_cookie[name][k] = v
# The 2 lines below were not in Tornado. Instead, they output all their cookies to the headers at once before a response flush.
for vals in new_cookie.values():
self.response.headers._headers.append(('Set-Cookie', vals.OutputString(None)))
def clear_cookie(self, name, path="/", domain=None):
"""Deletes the cookie with the given name."""
expires = datetime.datetime.utcnow() - datetime.timedelta(days=365)
self.set_cookie(name, value="", path=path, expires=expires,
domain=domain)
def clear_all_cookies(self):
"""Deletes all the cookies the user sent with this request."""
for name in self.cookies().iterkeys():
self.clear_cookie(name)
def set_secure_cookie(self, name, value, expires_days=30, **kwargs):
"""Signs and timestamps a cookie so it cannot be forged.
To read a cookie set with this method, use get_secure_cookie().
"""
value = LilCookies._signed_cookie_value(self.cookie_secret, name, value)
self.set_cookie(name, value, expires_days=expires_days, **kwargs)
def get_secure_cookie(self, name, value=None):
"""Returns the given signed cookie if it validates, or None."""
if value is None: value = self.get_cookie(name)
return LilCookies._verified_cookie_value(self.cookie_secret, name, value)
def _cookie_signature(self, *parts):
return LilCookies._signature_from_secret(self.cookie_secret)
| [
[
1,
0,
0.006,
0.006,
0,
0.66,
0,
32,
0,
1,
0,
0,
32,
0,
0
],
[
1,
0,
0.0119,
0.006,
0,
0.66,
0.1,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0179,
0.006,
0,
0.66,
... | [
"import Cookie",
"import datetime",
"import time",
"import email.utils",
"import calendar",
"import base64",
"import hashlib",
"import hmac",
"import re",
"import logging",
"class LilCookies:\n\n @staticmethod\n def _utf8(s):\n if isinstance(s, unicode):\n return s.encode(\"utf-8\")\n ... |
# Copyright (C) 2007 Joe Gregorio
#
# Licensed under the MIT License
"""MIME-Type Parser
This module provides basic functions for handling mime-types. It can handle
matching mime-types against a list of media-ranges. See section 14.1 of the
HTTP specification [RFC 2616] for a complete explanation.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
Contents:
- parse_mime_type(): Parses a mime-type into its component parts.
- parse_media_range(): Media-ranges are mime-types with wild-cards and a 'q'
quality parameter.
- quality(): Determines the quality ('q') of a mime-type when
compared against a list of media-ranges.
- quality_parsed(): Just like quality() except the second parameter must be
pre-parsed.
- best_match(): Choose the mime-type with the highest quality ('q')
from a list of candidates.
"""
__version__ = '0.1.3'
__author__ = 'Joe Gregorio'
__email__ = 'joe@bitworking.org'
__license__ = 'MIT License'
__credits__ = ''
def parse_mime_type(mime_type):
"""Parses a mime-type into its component parts.
Carves up a mime-type and returns a tuple of the (type, subtype, params)
where 'params' is a dictionary of all the parameters for the media range.
For example, the media range 'application/xhtml;q=0.5' would get parsed
into:
('application', 'xhtml', {'q', '0.5'})
"""
parts = mime_type.split(';')
params = dict([tuple([s.strip() for s in param.split('=', 1)])\
for param in parts[1:]
])
full_type = parts[0].strip()
# Java URLConnection class sends an Accept header that includes a
# single '*'. Turn it into a legal wildcard.
if full_type == '*':
full_type = '*/*'
(type, subtype) = full_type.split('/')
return (type.strip(), subtype.strip(), params)
def parse_media_range(range):
"""Parse a media-range into its component parts.
Carves up a media range and returns a tuple of the (type, subtype,
params) where 'params' is a dictionary of all the parameters for the media
range. For example, the media range 'application/*;q=0.5' would get parsed
into:
('application', '*', {'q', '0.5'})
In addition this function also guarantees that there is a value for 'q'
in the params dictionary, filling it in with a proper default if
necessary.
"""
(type, subtype, params) = parse_mime_type(range)
if not params.has_key('q') or not params['q'] or \
not float(params['q']) or float(params['q']) > 1\
or float(params['q']) < 0:
params['q'] = '1'
return (type, subtype, params)
def fitness_and_quality_parsed(mime_type, parsed_ranges):
"""Find the best match for a mime-type amongst parsed media-ranges.
Find the best match for a given mime-type against a list of media_ranges
that have already been parsed by parse_media_range(). Returns a tuple of
the fitness value and the value of the 'q' quality parameter of the best
match, or (-1, 0) if no match was found. Just as for quality_parsed(),
'parsed_ranges' must be a list of parsed media ranges.
"""
best_fitness = -1
best_fit_q = 0
(target_type, target_subtype, target_params) =\
parse_media_range(mime_type)
for (type, subtype, params) in parsed_ranges:
type_match = (type == target_type or\
type == '*' or\
target_type == '*')
subtype_match = (subtype == target_subtype or\
subtype == '*' or\
target_subtype == '*')
if type_match and subtype_match:
param_matches = reduce(lambda x, y: x + y, [1 for (key, value) in \
target_params.iteritems() if key != 'q' and \
params.has_key(key) and value == params[key]], 0)
fitness = (type == target_type) and 100 or 0
fitness += (subtype == target_subtype) and 10 or 0
fitness += param_matches
if fitness > best_fitness:
best_fitness = fitness
best_fit_q = params['q']
return best_fitness, float(best_fit_q)
def quality_parsed(mime_type, parsed_ranges):
"""Find the best match for a mime-type amongst parsed media-ranges.
Find the best match for a given mime-type against a list of media_ranges
that have already been parsed by parse_media_range(). Returns the 'q'
quality parameter of the best match, 0 if no match was found. This function
bahaves the same as quality() except that 'parsed_ranges' must be a list of
parsed media ranges.
"""
return fitness_and_quality_parsed(mime_type, parsed_ranges)[1]
def quality(mime_type, ranges):
"""Return the quality ('q') of a mime-type against a list of media-ranges.
Returns the quality 'q' of a mime-type when compared against the
media-ranges in ranges. For example:
>>> quality('text/html','text/*;q=0.3, text/html;q=0.7,
text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5')
0.7
"""
parsed_ranges = [parse_media_range(r) for r in ranges.split(',')]
return quality_parsed(mime_type, parsed_ranges)
def best_match(supported, header):
"""Return mime-type with the highest quality ('q') from list of candidates.
Takes a list of supported mime-types and finds the best match for all the
media-ranges listed in header. The value of header must be a string that
conforms to the format of the HTTP Accept: header. The value of 'supported'
is a list of mime-types. The list of supported mime-types should be sorted
in order of increasing desirability, in case of a situation where there is
a tie.
>>> best_match(['application/xbel+xml', 'text/xml'],
'text/*;q=0.5,*/*; q=0.1')
'text/xml'
"""
split_header = _filter_blank(header.split(','))
parsed_header = [parse_media_range(r) for r in split_header]
weighted_matches = []
pos = 0
for mime_type in supported:
weighted_matches.append((fitness_and_quality_parsed(mime_type,
parsed_header), pos, mime_type))
pos += 1
weighted_matches.sort()
return weighted_matches[-1][0][1] and weighted_matches[-1][2] or ''
def _filter_blank(i):
for s in i:
if s.strip():
yield s
| [
[
8,
0,
0.0814,
0.1105,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1453,
0.0058,
0,
0.66,
0.0833,
162,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.1512,
0.0058,
0,
0.66... | [
"\"\"\"MIME-Type Parser\n\nThis module provides basic functions for handling mime-types. It can handle\nmatching mime-types against a list of media-ranges. See section 14.1 of the\nHTTP specification [RFC 2616] for a complete explanation.\n\n http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1",
"__v... |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Utilities for OAuth.
Utilities for making it easier to work with OAuth.
"""
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
import copy
import httplib2
import logging
import oauth2 as oauth
import urllib
import urlparse
from anyjson import simplejson
try:
from urlparse import parse_qsl
except ImportError:
from cgi import parse_qsl
class Error(Exception):
"""Base error for this module."""
pass
class RequestError(Error):
"""Error occurred during request."""
pass
class MissingParameter(Error):
pass
class CredentialsInvalidError(Error):
pass
def _abstract():
raise NotImplementedError('You need to override this function')
def _oauth_uri(name, discovery, params):
"""Look up the OAuth URI from the discovery
document and add query parameters based on
params.
name - The name of the OAuth URI to lookup, one
of 'request', 'access', or 'authorize'.
discovery - Portion of discovery document the describes
the OAuth endpoints.
params - Dictionary that is used to form the query parameters
for the specified URI.
"""
if name not in ['request', 'access', 'authorize']:
raise KeyError(name)
keys = discovery[name]['parameters'].keys()
query = {}
for key in keys:
if key in params:
query[key] = params[key]
return discovery[name]['url'] + '?' + urllib.urlencode(query)
class Credentials(object):
"""Base class for all Credentials objects.
Subclasses must define an authorize() method
that applies the credentials to an HTTP transport.
"""
def authorize(self, http):
"""Take an httplib2.Http instance (or equivalent) and
authorizes it for the set of credentials, usually by
replacing http.request() with a method that adds in
the appropriate headers and then delegates to the original
Http.request() method.
"""
_abstract()
class Flow(object):
"""Base class for all Flow objects."""
pass
class Storage(object):
"""Base class for all Storage objects.
Store and retrieve a single credential.
"""
def get(self):
"""Retrieve credential.
Returns:
apiclient.oauth.Credentials
"""
_abstract()
def put(self, credentials):
"""Write a credential.
Args:
credentials: Credentials, the credentials to store.
"""
_abstract()
class OAuthCredentials(Credentials):
"""Credentials object for OAuth 1.0a
"""
def __init__(self, consumer, token, user_agent):
"""
consumer - An instance of oauth.Consumer.
token - An instance of oauth.Token constructed with
the access token and secret.
user_agent - The HTTP User-Agent to provide for this application.
"""
self.consumer = consumer
self.token = token
self.user_agent = user_agent
self.store = None
# True if the credentials have been revoked
self._invalid = False
@property
def invalid(self):
"""True if the credentials are invalid, such as being revoked."""
return getattr(self, "_invalid", False)
def set_store(self, store):
"""Set the storage for the credential.
Args:
store: callable, a callable that when passed a Credential
will store the credential back to where it came from.
This is needed to store the latest access_token if it
has been revoked.
"""
self.store = store
def __getstate__(self):
"""Trim the state down to something that can be pickled."""
d = copy.copy(self.__dict__)
del d['store']
return d
def __setstate__(self, state):
"""Reconstitute the state of the object from being pickled."""
self.__dict__.update(state)
self.store = None
def authorize(self, http):
"""Authorize an httplib2.Http instance with these Credentials
Args:
http - An instance of httplib2.Http
or something that acts like it.
Returns:
A modified instance of http that was passed in.
Example:
h = httplib2.Http()
h = credentials.authorize(h)
You can't create a new OAuth
subclass of httplib2.Authenication because
it never gets passed the absolute URI, which is
needed for signing. So instead we have to overload
'request' with a closure that adds in the
Authorization header and then calls the original version
of 'request()'.
"""
request_orig = http.request
signer = oauth.SignatureMethod_HMAC_SHA1()
# The closure that will replace 'httplib2.Http.request'.
def new_request(uri, method='GET', body=None, headers=None,
redirections=httplib2.DEFAULT_MAX_REDIRECTS,
connection_type=None):
"""Modify the request headers to add the appropriate
Authorization header."""
response_code = 302
http.follow_redirects = False
while response_code in [301, 302]:
req = oauth.Request.from_consumer_and_token(
self.consumer, self.token, http_method=method, http_url=uri)
req.sign_request(signer, self.consumer, self.token)
if headers is None:
headers = {}
headers.update(req.to_header())
if 'user-agent' in headers:
headers['user-agent'] = self.user_agent + ' ' + headers['user-agent']
else:
headers['user-agent'] = self.user_agent
resp, content = request_orig(uri, method, body, headers,
redirections, connection_type)
response_code = resp.status
if response_code in [301, 302]:
uri = resp['location']
# Update the stored credential if it becomes invalid.
if response_code == 401:
logging.info('Access token no longer valid: %s' % content)
self._invalid = True
if self.store is not None:
self.store(self)
raise CredentialsInvalidError("Credentials are no longer valid.")
return resp, content
http.request = new_request
return http
class TwoLeggedOAuthCredentials(Credentials):
"""Two Legged Credentials object for OAuth 1.0a.
The Two Legged object is created directly, not from a flow. Once you
authorize and httplib2.Http instance you can change the requestor and that
change will propogate to the authorized httplib2.Http instance. For example:
http = httplib2.Http()
http = credentials.authorize(http)
credentials.requestor = 'foo@example.info'
http.request(...)
credentials.requestor = 'bar@example.info'
http.request(...)
"""
def __init__(self, consumer_key, consumer_secret, user_agent):
"""
Args:
consumer_key: string, An OAuth 1.0 consumer key
consumer_secret: string, An OAuth 1.0 consumer secret
user_agent: string, The HTTP User-Agent to provide for this application.
"""
self.consumer = oauth.Consumer(consumer_key, consumer_secret)
self.user_agent = user_agent
self.store = None
# email address of the user to act on the behalf of.
self._requestor = None
@property
def invalid(self):
"""True if the credentials are invalid, such as being revoked.
Always returns False for Two Legged Credentials.
"""
return False
def getrequestor(self):
return self._requestor
def setrequestor(self, email):
self._requestor = email
requestor = property(getrequestor, setrequestor, None,
'The email address of the user to act on behalf of')
def set_store(self, store):
"""Set the storage for the credential.
Args:
store: callable, a callable that when passed a Credential
will store the credential back to where it came from.
This is needed to store the latest access_token if it
has been revoked.
"""
self.store = store
def __getstate__(self):
"""Trim the state down to something that can be pickled."""
d = copy.copy(self.__dict__)
del d['store']
return d
def __setstate__(self, state):
"""Reconstitute the state of the object from being pickled."""
self.__dict__.update(state)
self.store = None
def authorize(self, http):
"""Authorize an httplib2.Http instance with these Credentials
Args:
http - An instance of httplib2.Http
or something that acts like it.
Returns:
A modified instance of http that was passed in.
Example:
h = httplib2.Http()
h = credentials.authorize(h)
You can't create a new OAuth
subclass of httplib2.Authenication because
it never gets passed the absolute URI, which is
needed for signing. So instead we have to overload
'request' with a closure that adds in the
Authorization header and then calls the original version
of 'request()'.
"""
request_orig = http.request
signer = oauth.SignatureMethod_HMAC_SHA1()
# The closure that will replace 'httplib2.Http.request'.
def new_request(uri, method='GET', body=None, headers=None,
redirections=httplib2.DEFAULT_MAX_REDIRECTS,
connection_type=None):
"""Modify the request headers to add the appropriate
Authorization header."""
response_code = 302
http.follow_redirects = False
while response_code in [301, 302]:
# add in xoauth_requestor_id=self._requestor to the uri
if self._requestor is None:
raise MissingParameter(
'Requestor must be set before using TwoLeggedOAuthCredentials')
parsed = list(urlparse.urlparse(uri))
q = parse_qsl(parsed[4])
q.append(('xoauth_requestor_id', self._requestor))
parsed[4] = urllib.urlencode(q)
uri = urlparse.urlunparse(parsed)
req = oauth.Request.from_consumer_and_token(
self.consumer, None, http_method=method, http_url=uri)
req.sign_request(signer, self.consumer, None)
if headers is None:
headers = {}
headers.update(req.to_header())
if 'user-agent' in headers:
headers['user-agent'] = self.user_agent + ' ' + headers['user-agent']
else:
headers['user-agent'] = self.user_agent
resp, content = request_orig(uri, method, body, headers,
redirections, connection_type)
response_code = resp.status
if response_code in [301, 302]:
uri = resp['location']
if response_code == 401:
logging.info('Access token no longer valid: %s' % content)
# Do not store the invalid state of the Credentials because
# being 2LO they could be reinstated in the future.
raise CredentialsInvalidError("Credentials are invalid.")
return resp, content
http.request = new_request
return http
class FlowThreeLegged(Flow):
"""Does the Three Legged Dance for OAuth 1.0a.
"""
def __init__(self, discovery, consumer_key, consumer_secret, user_agent,
**kwargs):
"""
discovery - Section of the API discovery document that describes
the OAuth endpoints.
consumer_key - OAuth consumer key
consumer_secret - OAuth consumer secret
user_agent - The HTTP User-Agent that identifies the application.
**kwargs - The keyword arguments are all optional and required
parameters for the OAuth calls.
"""
self.discovery = discovery
self.consumer_key = consumer_key
self.consumer_secret = consumer_secret
self.user_agent = user_agent
self.params = kwargs
self.request_token = {}
required = {}
for uriinfo in discovery.itervalues():
for name, value in uriinfo['parameters'].iteritems():
if value['required'] and not name.startswith('oauth_'):
required[name] = 1
for key in required.iterkeys():
if key not in self.params:
raise MissingParameter('Required parameter %s not supplied' % key)
def step1_get_authorize_url(self, oauth_callback='oob'):
"""Returns a URI to redirect to the provider.
oauth_callback - Either the string 'oob' for a non-web-based application,
or a URI that handles the callback from the authorization
server.
If oauth_callback is 'oob' then pass in the
generated verification code to step2_exchange,
otherwise pass in the query parameters received
at the callback uri to step2_exchange.
"""
consumer = oauth.Consumer(self.consumer_key, self.consumer_secret)
client = oauth.Client(consumer)
headers = {
'user-agent': self.user_agent,
'content-type': 'application/x-www-form-urlencoded'
}
body = urllib.urlencode({'oauth_callback': oauth_callback})
uri = _oauth_uri('request', self.discovery, self.params)
resp, content = client.request(uri, 'POST', headers=headers,
body=body)
if resp['status'] != '200':
logging.error('Failed to retrieve temporary authorization: %s', content)
raise RequestError('Invalid response %s.' % resp['status'])
self.request_token = dict(parse_qsl(content))
auth_params = copy.copy(self.params)
auth_params['oauth_token'] = self.request_token['oauth_token']
return _oauth_uri('authorize', self.discovery, auth_params)
def step2_exchange(self, verifier):
"""Exhanges an authorized request token
for OAuthCredentials.
Args:
verifier: string, dict - either the verifier token, or a dictionary
of the query parameters to the callback, which contains
the oauth_verifier.
Returns:
The Credentials object.
"""
if not (isinstance(verifier, str) or isinstance(verifier, unicode)):
verifier = verifier['oauth_verifier']
token = oauth.Token(
self.request_token['oauth_token'],
self.request_token['oauth_token_secret'])
token.set_verifier(verifier)
consumer = oauth.Consumer(self.consumer_key, self.consumer_secret)
client = oauth.Client(consumer, token)
headers = {
'user-agent': self.user_agent,
'content-type': 'application/x-www-form-urlencoded'
}
uri = _oauth_uri('access', self.discovery, self.params)
resp, content = client.request(uri, 'POST', headers=headers)
if resp['status'] != '200':
logging.error('Failed to retrieve access token: %s', content)
raise RequestError('Invalid response %s.' % resp['status'])
oauth_params = dict(parse_qsl(content))
token = oauth.Token(
oauth_params['oauth_token'],
oauth_params['oauth_token_secret'])
return OAuthCredentials(consumer, token, self.user_agent)
| [
[
8,
0,
0.0342,
0.0083,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0414,
0.0021,
0,
0.66,
0.0476,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0476,
0.0021,
0,
0.66,... | [
"\"\"\"Utilities for OAuth.\n\nUtilities for making it easier to work with OAuth.\n\"\"\"",
"__author__ = 'jcgregorio@google.com (Joe Gregorio)'",
"import copy",
"import httplib2",
"import logging",
"import oauth2 as oauth",
"import urllib",
"import urlparse",
"from anyjson import simplejson",
"tr... |
#!/usr/bin/python2.4
#
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Model objects for requests and responses.
Each API may support one or more serializations, such
as JSON, Atom, etc. The model classes are responsible
for converting between the wire format and the Python
object representation.
"""
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
import gflags
import logging
import urllib
from errors import HttpError
from oauth2client.anyjson import simplejson
FLAGS = gflags.FLAGS
gflags.DEFINE_boolean('dump_request_response', False,
'Dump all http server requests and responses. '
)
def _abstract():
raise NotImplementedError('You need to override this function')
class Model(object):
"""Model base class.
All Model classes should implement this interface.
The Model serializes and de-serializes between a wire
format such as JSON and a Python object representation.
"""
def request(self, headers, path_params, query_params, body_value):
"""Updates outgoing requests with a serialized body.
Args:
headers: dict, request headers
path_params: dict, parameters that appear in the request path
query_params: dict, parameters that appear in the query
body_value: object, the request body as a Python object, which must be
serializable.
Returns:
A tuple of (headers, path_params, query, body)
headers: dict, request headers
path_params: dict, parameters that appear in the request path
query: string, query part of the request URI
body: string, the body serialized in the desired wire format.
"""
_abstract()
def response(self, resp, content):
"""Convert the response wire format into a Python object.
Args:
resp: httplib2.Response, the HTTP response headers and status
content: string, the body of the HTTP response
Returns:
The body de-serialized as a Python object.
Raises:
apiclient.errors.HttpError if a non 2xx response is received.
"""
_abstract()
class BaseModel(Model):
"""Base model class.
Subclasses should provide implementations for the "serialize" and
"deserialize" methods, as well as values for the following class attributes.
Attributes:
accept: The value to use for the HTTP Accept header.
content_type: The value to use for the HTTP Content-type header.
no_content_response: The value to return when deserializing a 204 "No
Content" response.
alt_param: The value to supply as the "alt" query parameter for requests.
"""
accept = None
content_type = None
no_content_response = None
alt_param = None
def _log_request(self, headers, path_params, query, body):
"""Logs debugging information about the request if requested."""
if FLAGS.dump_request_response:
logging.info('--request-start--')
logging.info('-headers-start-')
for h, v in headers.iteritems():
logging.info('%s: %s', h, v)
logging.info('-headers-end-')
logging.info('-path-parameters-start-')
for h, v in path_params.iteritems():
logging.info('%s: %s', h, v)
logging.info('-path-parameters-end-')
logging.info('body: %s', body)
logging.info('query: %s', query)
logging.info('--request-end--')
def request(self, headers, path_params, query_params, body_value):
"""Updates outgoing requests with a serialized body.
Args:
headers: dict, request headers
path_params: dict, parameters that appear in the request path
query_params: dict, parameters that appear in the query
body_value: object, the request body as a Python object, which must be
serializable by simplejson.
Returns:
A tuple of (headers, path_params, query, body)
headers: dict, request headers
path_params: dict, parameters that appear in the request path
query: string, query part of the request URI
body: string, the body serialized as JSON
"""
query = self._build_query(query_params)
headers['accept'] = self.accept
headers['accept-encoding'] = 'gzip, deflate'
if 'user-agent' in headers:
headers['user-agent'] += ' '
else:
headers['user-agent'] = ''
headers['user-agent'] += 'google-api-python-client/1.0'
if body_value is not None:
headers['content-type'] = self.content_type
body_value = self.serialize(body_value)
self._log_request(headers, path_params, query, body_value)
return (headers, path_params, query, body_value)
def _build_query(self, params):
"""Builds a query string.
Args:
params: dict, the query parameters
Returns:
The query parameters properly encoded into an HTTP URI query string.
"""
if self.alt_param is not None:
params.update({'alt': self.alt_param})
astuples = []
for key, value in params.iteritems():
if type(value) == type([]):
for x in value:
x = x.encode('utf-8')
astuples.append((key, x))
else:
if getattr(value, 'encode', False) and callable(value.encode):
value = value.encode('utf-8')
astuples.append((key, value))
return '?' + urllib.urlencode(astuples)
def _log_response(self, resp, content):
"""Logs debugging information about the response if requested."""
if FLAGS.dump_request_response:
logging.info('--response-start--')
for h, v in resp.iteritems():
logging.info('%s: %s', h, v)
if content:
logging.info(content)
logging.info('--response-end--')
def response(self, resp, content):
"""Convert the response wire format into a Python object.
Args:
resp: httplib2.Response, the HTTP response headers and status
content: string, the body of the HTTP response
Returns:
The body de-serialized as a Python object.
Raises:
apiclient.errors.HttpError if a non 2xx response is received.
"""
self._log_response(resp, content)
# Error handling is TBD, for example, do we retry
# for some operation/error combinations?
if resp.status < 300:
if resp.status == 204:
# A 204: No Content response should be treated differently
# to all the other success states
return self.no_content_response
return self.deserialize(content)
else:
logging.debug('Content from bad request was: %s' % content)
raise HttpError(resp, content)
def serialize(self, body_value):
"""Perform the actual Python object serialization.
Args:
body_value: object, the request body as a Python object.
Returns:
string, the body in serialized form.
"""
_abstract()
def deserialize(self, content):
"""Perform the actual deserialization from response string to Python
object.
Args:
content: string, the body of the HTTP response
Returns:
The body de-serialized as a Python object.
"""
_abstract()
class JsonModel(BaseModel):
"""Model class for JSON.
Serializes and de-serializes between JSON and the Python
object representation of HTTP request and response bodies.
"""
accept = 'application/json'
content_type = 'application/json'
alt_param = 'json'
def __init__(self, data_wrapper=False):
"""Construct a JsonModel.
Args:
data_wrapper: boolean, wrap requests and responses in a data wrapper
"""
self._data_wrapper = data_wrapper
def serialize(self, body_value):
if (isinstance(body_value, dict) and 'data' not in body_value and
self._data_wrapper):
body_value = {'data': body_value}
return simplejson.dumps(body_value)
def deserialize(self, content):
body = simplejson.loads(content)
if isinstance(body, dict) and 'data' in body:
body = body['data']
return body
@property
def no_content_response(self):
return {}
class RawModel(JsonModel):
"""Model class for requests that don't return JSON.
Serializes and de-serializes between JSON and the Python
object representation of HTTP request, and returns the raw bytes
of the response body.
"""
accept = '*/*'
content_type = 'application/json'
alt_param = None
def deserialize(self, content):
return content
@property
def no_content_response(self):
return ''
class MediaModel(JsonModel):
"""Model class for requests that return Media.
Serializes and de-serializes between JSON and the Python
object representation of HTTP request, and returns the raw bytes
of the response body.
"""
accept = '*/*'
content_type = 'application/json'
alt_param = 'media'
def deserialize(self, content):
return content
@property
def no_content_response(self):
return ''
class ProtocolBufferModel(BaseModel):
"""Model class for protocol buffers.
Serializes and de-serializes the binary protocol buffer sent in the HTTP
request and response bodies.
"""
accept = 'application/x-protobuf'
content_type = 'application/x-protobuf'
alt_param = 'proto'
def __init__(self, protocol_buffer):
"""Constructs a ProtocolBufferModel.
The serialzed protocol buffer returned in an HTTP response will be
de-serialized using the given protocol buffer class.
Args:
protocol_buffer: The protocol buffer class used to de-serialize a
response from the API.
"""
self._protocol_buffer = protocol_buffer
def serialize(self, body_value):
return body_value.SerializeToString()
def deserialize(self, content):
return self._protocol_buffer.FromString(content)
@property
def no_content_response(self):
return self._protocol_buffer()
def makepatch(original, modified):
"""Create a patch object.
Some methods support PATCH, an efficient way to send updates to a resource.
This method allows the easy construction of patch bodies by looking at the
differences between a resource before and after it was modified.
Args:
original: object, the original deserialized resource
modified: object, the modified deserialized resource
Returns:
An object that contains only the changes from original to modified, in a
form suitable to pass to a PATCH method.
Example usage:
item = service.activities().get(postid=postid, userid=userid).execute()
original = copy.deepcopy(item)
item['object']['content'] = 'This is updated.'
service.activities.patch(postid=postid, userid=userid,
body=makepatch(original, item)).execute()
"""
patch = {}
for key, original_value in original.iteritems():
modified_value = modified.get(key, None)
if modified_value is None:
# Use None to signal that the element is deleted
patch[key] = None
elif original_value != modified_value:
if type(original_value) == type({}):
# Recursively descend objects
patch[key] = makepatch(original_value, modified_value)
else:
# In the case of simple types or arrays we just replace
patch[key] = modified_value
else:
# Don't add anything to patch if there's no change
pass
for key in modified:
if key not in original:
patch[key] = modified[key]
return patch
| [
[
8,
0,
0.0519,
0.0182,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0649,
0.0026,
0,
0.66,
0.0625,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0701,
0.0026,
0,
0.66,... | [
"\"\"\"Model objects for requests and responses.\n\nEach API may support one or more serializations, such\nas JSON, Atom, etc. The model classes are responsible\nfor converting between the wire format and the Python\nobject representation.\n\"\"\"",
"__author__ = 'jcgregorio@google.com (Joe Gregorio)'",
"import... |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Utilities for OAuth.
Utilities for making it easier to work with OAuth 1.0 credentials.
"""
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
import pickle
import threading
from apiclient.oauth import Storage as BaseStorage
class Storage(BaseStorage):
"""Store and retrieve a single credential to and from a file."""
def __init__(self, filename):
self._filename = filename
self._lock = threading.Lock()
def get(self):
"""Retrieve Credential from file.
Returns:
apiclient.oauth.Credentials
"""
self._lock.acquire()
try:
f = open(self._filename, 'r')
credentials = pickle.loads(f.read())
f.close()
credentials.set_store(self.put)
except:
credentials = None
self._lock.release()
return credentials
def put(self, credentials):
"""Write a pickled Credentials to file.
Args:
credentials: Credentials, the credentials to store.
"""
self._lock.acquire()
f = open(self._filename, 'w')
f.write(pickle.dumps(credentials))
f.close()
self._lock.release()
| [
[
8,
0,
0.2619,
0.0635,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.3175,
0.0159,
0,
0.66,
0.2,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.3492,
0.0159,
0,
0.66,
... | [
"\"\"\"Utilities for OAuth.\n\nUtilities for making it easier to work with OAuth 1.0 credentials.\n\"\"\"",
"__author__ = 'jcgregorio@google.com (Joe Gregorio)'",
"import pickle",
"import threading",
"from apiclient.oauth import Storage as BaseStorage",
"class Storage(BaseStorage):\n \"\"\"Store and retr... |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import apiclient
import base64
import pickle
from django.db import models
class OAuthCredentialsField(models.Field):
__metaclass__ = models.SubfieldBase
def db_type(self):
return 'VARCHAR'
def to_python(self, value):
if value is None:
return None
if isinstance(value, apiclient.oauth.Credentials):
return value
return pickle.loads(base64.b64decode(value))
def get_db_prep_value(self, value):
return base64.b64encode(pickle.dumps(value))
class FlowThreeLeggedField(models.Field):
__metaclass__ = models.SubfieldBase
def db_type(self):
return 'VARCHAR'
def to_python(self, value):
print "In to_python", value
if value is None:
return None
if isinstance(value, apiclient.oauth.FlowThreeLegged):
return value
return pickle.loads(base64.b64decode(value))
def get_db_prep_value(self, value):
return base64.b64encode(pickle.dumps(value))
| [
[
1,
0,
0.2679,
0.0179,
0,
0.66,
0,
629,
0,
1,
0,
0,
629,
0,
0
],
[
1,
0,
0.2857,
0.0179,
0,
0.66,
0.2,
177,
0,
1,
0,
0,
177,
0,
0
],
[
1,
0,
0.3036,
0.0179,
0,
0.6... | [
"import apiclient",
"import base64",
"import pickle",
"from django.db import models",
"class OAuthCredentialsField(models.Field):\n\n __metaclass__ = models.SubfieldBase\n\n def db_type(self):\n return 'VARCHAR'\n\n def to_python(self, value):",
" __metaclass__ = models.SubfieldBase",
" def db_t... |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Utilities for Google App Engine
Utilities for making it easier to use the
Google API Client for Python on Google App Engine.
"""
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
import pickle
from google.appengine.ext import db
from apiclient.oauth import OAuthCredentials
from apiclient.oauth import FlowThreeLegged
class FlowThreeLeggedProperty(db.Property):
"""Utility property that allows easy
storage and retreival of an
apiclient.oauth.FlowThreeLegged"""
# Tell what the user type is.
data_type = FlowThreeLegged
# For writing to datastore.
def get_value_for_datastore(self, model_instance):
flow = super(FlowThreeLeggedProperty,
self).get_value_for_datastore(model_instance)
return db.Blob(pickle.dumps(flow))
# For reading from datastore.
def make_value_from_datastore(self, value):
if value is None:
return None
return pickle.loads(value)
def validate(self, value):
if value is not None and not isinstance(value, FlowThreeLegged):
raise BadValueError('Property %s must be convertible '
'to a FlowThreeLegged instance (%s)' %
(self.name, value))
return super(FlowThreeLeggedProperty, self).validate(value)
def empty(self, value):
return not value
class OAuthCredentialsProperty(db.Property):
"""Utility property that allows easy
storage and retrieval of
apiclient.oath.OAuthCredentials
"""
# Tell what the user type is.
data_type = OAuthCredentials
# For writing to datastore.
def get_value_for_datastore(self, model_instance):
cred = super(OAuthCredentialsProperty,
self).get_value_for_datastore(model_instance)
return db.Blob(pickle.dumps(cred))
# For reading from datastore.
def make_value_from_datastore(self, value):
if value is None:
return None
return pickle.loads(value)
def validate(self, value):
if value is not None and not isinstance(value, OAuthCredentials):
raise BadValueError('Property %s must be convertible '
'to an OAuthCredentials instance (%s)' %
(self.name, value))
return super(OAuthCredentialsProperty, self).validate(value)
def empty(self, value):
return not value
class StorageByKeyName(object):
"""Store and retrieve a single credential to and from
the App Engine datastore.
This Storage helper presumes the Credentials
have been stored as a CredenialsProperty
on a datastore model class, and that entities
are stored by key_name.
"""
def __init__(self, model, key_name, property_name):
"""Constructor for Storage.
Args:
model: db.Model, model class
key_name: string, key name for the entity that has the credentials
property_name: string, name of the property that is a CredentialsProperty
"""
self.model = model
self.key_name = key_name
self.property_name = property_name
def get(self):
"""Retrieve Credential from datastore.
Returns:
Credentials
"""
entity = self.model.get_or_insert(self.key_name)
credential = getattr(entity, self.property_name)
if credential and hasattr(credential, 'set_store'):
credential.set_store(self.put)
return credential
def put(self, credentials):
"""Write a Credentials to the datastore.
Args:
credentials: Credentials, the credentials to store.
"""
entity = self.model.get_or_insert(self.key_name)
setattr(entity, self.property_name, credentials)
entity.put()
| [
[
8,
0,
0.1259,
0.037,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1556,
0.0074,
0,
0.66,
0.125,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1704,
0.0074,
0,
0.66,
... | [
"\"\"\"Utilities for Google App Engine\n\nUtilities for making it easier to use the\nGoogle API Client for Python on Google App Engine.\n\"\"\"",
"__author__ = 'jcgregorio@google.com (Joe Gregorio)'",
"import pickle",
"from google.appengine.ext import db",
"from apiclient.oauth import OAuthCredentials",
"... |
#!/usr/bin/python2.4
#
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Errors for the library.
All exceptions defined by the library
should be defined in this file.
"""
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
from oauth2client.anyjson import simplejson
class Error(Exception):
"""Base error for this module."""
pass
class HttpError(Error):
"""HTTP data was invalid or unexpected."""
def __init__(self, resp, content, uri=None):
self.resp = resp
self.content = content
self.uri = uri
def _get_reason(self):
"""Calculate the reason for the error from the response content."""
if self.resp.get('content-type', '').startswith('application/json'):
try:
data = simplejson.loads(self.content)
reason = data['error']['message']
except (ValueError, KeyError):
reason = self.content
else:
reason = self.resp.reason
return reason
def __repr__(self):
if self.uri:
return '<HttpError %s when requesting %s returned "%s">' % (
self.resp.status, self.uri, self._get_reason())
else:
return '<HttpError %s "%s">' % (self.resp.status, self._get_reason())
__str__ = __repr__
class InvalidJsonError(Error):
"""The JSON returned could not be parsed."""
pass
class UnknownLinkType(Error):
"""Link type unknown or unexpected."""
pass
class UnknownApiNameOrVersion(Error):
"""No API with that name and version exists."""
pass
class UnacceptableMimeTypeError(Error):
"""That is an unacceptable mimetype for this operation."""
pass
class MediaUploadSizeError(Error):
"""Media is larger than the method can accept."""
pass
class ResumableUploadError(Error):
"""Error occured during resumable upload."""
pass
class BatchError(HttpError):
"""Error occured during batch operations."""
def __init__(self, reason, resp=None, content=None):
self.resp = resp
self.content = content
self.reason = reason
def __repr__(self):
return '<BatchError %s "%s">' % (self.resp.status, self.reason)
__str__ = __repr__
class UnexpectedMethodError(Error):
"""Exception raised by RequestMockBuilder on unexpected calls."""
def __init__(self, methodId=None):
"""Constructor for an UnexpectedMethodError."""
super(UnexpectedMethodError, self).__init__(
'Received unexpected call %s' % methodId)
class UnexpectedBodyError(Error):
"""Exception raised by RequestMockBuilder on unexpected bodies."""
def __init__(self, expected, provided):
"""Constructor for an UnexpectedMethodError."""
super(UnexpectedBodyError, self).__init__(
'Expected: [%s] - Provided: [%s]' % (expected, provided))
| [
[
8,
0,
0.1545,
0.0407,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.187,
0.0081,
0,
0.66,
0.0769,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.2114,
0.0081,
0,
0.66,
... | [
"\"\"\"Errors for the library.\n\nAll exceptions defined by the library\nshould be defined in this file.\n\"\"\"",
"__author__ = 'jcgregorio@google.com (Joe Gregorio)'",
"from oauth2client.anyjson import simplejson",
"class Error(Exception):\n \"\"\"Base error for this module.\"\"\"\n pass",
" \"\"\"Base... |
__version__ = "1.0c2"
| [
[
14,
0,
1,
1,
0,
0.66,
0,
162,
1,
0,
0,
0,
0,
3,
0
]
] | [
"__version__ = \"1.0c2\""
] |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Schema processing for discovery based APIs
Schemas holds an APIs discovery schemas. It can return those schema as
deserialized JSON objects, or pretty print them as prototype objects that
conform to the schema.
For example, given the schema:
schema = \"\"\"{
"Foo": {
"type": "object",
"properties": {
"etag": {
"type": "string",
"description": "ETag of the collection."
},
"kind": {
"type": "string",
"description": "Type of the collection ('calendar#acl').",
"default": "calendar#acl"
},
"nextPageToken": {
"type": "string",
"description": "Token used to access the next
page of this result. Omitted if no further results are available."
}
}
}
}\"\"\"
s = Schemas(schema)
print s.prettyPrintByName('Foo')
Produces the following output:
{
"nextPageToken": "A String", # Token used to access the
# next page of this result. Omitted if no further results are available.
"kind": "A String", # Type of the collection ('calendar#acl').
"etag": "A String", # ETag of the collection.
},
The constructor takes a discovery document in which to look up named schema.
"""
# TODO(jcgregorio) support format, enum, minimum, maximum
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
import copy
from oauth2client.anyjson import simplejson
class Schemas(object):
"""Schemas for an API."""
def __init__(self, discovery):
"""Constructor.
Args:
discovery: object, Deserialized discovery document from which we pull
out the named schema.
"""
self.schemas = discovery.get('schemas', {})
# Cache of pretty printed schemas.
self.pretty = {}
def _prettyPrintByName(self, name, seen=None, dent=0):
"""Get pretty printed object prototype from the schema name.
Args:
name: string, Name of schema in the discovery document.
seen: list of string, Names of schema already seen. Used to handle
recursive definitions.
Returns:
string, A string that contains a prototype object with
comments that conforms to the given schema.
"""
if seen is None:
seen = []
if name in seen:
# Do not fall into an infinite loop over recursive definitions.
return '# Object with schema name: %s' % name
seen.append(name)
if name not in self.pretty:
self.pretty[name] = _SchemaToStruct(self.schemas[name],
seen, dent).to_str(self._prettyPrintByName)
seen.pop()
return self.pretty[name]
def prettyPrintByName(self, name):
"""Get pretty printed object prototype from the schema name.
Args:
name: string, Name of schema in the discovery document.
Returns:
string, A string that contains a prototype object with
comments that conforms to the given schema.
"""
# Return with trailing comma and newline removed.
return self._prettyPrintByName(name, seen=[], dent=1)[:-2]
def _prettyPrintSchema(self, schema, seen=None, dent=0):
"""Get pretty printed object prototype of schema.
Args:
schema: object, Parsed JSON schema.
seen: list of string, Names of schema already seen. Used to handle
recursive definitions.
Returns:
string, A string that contains a prototype object with
comments that conforms to the given schema.
"""
if seen is None:
seen = []
return _SchemaToStruct(schema, seen, dent).to_str(self._prettyPrintByName)
def prettyPrintSchema(self, schema):
"""Get pretty printed object prototype of schema.
Args:
schema: object, Parsed JSON schema.
Returns:
string, A string that contains a prototype object with
comments that conforms to the given schema.
"""
# Return with trailing comma and newline removed.
return self._prettyPrintSchema(schema, dent=1)[:-2]
def get(self, name):
"""Get deserialized JSON schema from the schema name.
Args:
name: string, Schema name.
"""
return self.schemas[name]
class _SchemaToStruct(object):
"""Convert schema to a prototype object."""
def __init__(self, schema, seen, dent=0):
"""Constructor.
Args:
schema: object, Parsed JSON schema.
seen: list, List of names of schema already seen while parsing. Used to
handle recursive definitions.
dent: int, Initial indentation depth.
"""
# The result of this parsing kept as list of strings.
self.value = []
# The final value of the parsing.
self.string = None
# The parsed JSON schema.
self.schema = schema
# Indentation level.
self.dent = dent
# Method that when called returns a prototype object for the schema with
# the given name.
self.from_cache = None
# List of names of schema already seen while parsing.
self.seen = seen
def emit(self, text):
"""Add text as a line to the output.
Args:
text: string, Text to output.
"""
self.value.extend([" " * self.dent, text, '\n'])
def emitBegin(self, text):
"""Add text to the output, but with no line terminator.
Args:
text: string, Text to output.
"""
self.value.extend([" " * self.dent, text])
def emitEnd(self, text, comment):
"""Add text and comment to the output with line terminator.
Args:
text: string, Text to output.
comment: string, Python comment.
"""
if comment:
divider = '\n' + ' ' * (self.dent + 2) + '# '
lines = comment.splitlines()
lines = [x.rstrip() for x in lines]
comment = divider.join(lines)
self.value.extend([text, ' # ', comment, '\n'])
else:
self.value.extend([text, '\n'])
def indent(self):
"""Increase indentation level."""
self.dent += 1
def undent(self):
"""Decrease indentation level."""
self.dent -= 1
def _to_str_impl(self, schema):
"""Prototype object based on the schema, in Python code with comments.
Args:
schema: object, Parsed JSON schema file.
Returns:
Prototype object based on the schema, in Python code with comments.
"""
stype = schema.get('type')
if stype == 'object':
self.emitEnd('{', schema.get('description', ''))
self.indent()
for pname, pschema in schema.get('properties', {}).iteritems():
self.emitBegin('"%s": ' % pname)
self._to_str_impl(pschema)
self.undent()
self.emit('},')
elif '$ref' in schema:
schemaName = schema['$ref']
description = schema.get('description', '')
s = self.from_cache(schemaName, self.seen)
parts = s.splitlines()
self.emitEnd(parts[0], description)
for line in parts[1:]:
self.emit(line.rstrip())
elif stype == 'boolean':
value = schema.get('default', 'True or False')
self.emitEnd('%s,' % str(value), schema.get('description', ''))
elif stype == 'string':
value = schema.get('default', 'A String')
self.emitEnd('"%s",' % str(value), schema.get('description', ''))
elif stype == 'integer':
value = schema.get('default', '42')
self.emitEnd('%s,' % str(value), schema.get('description', ''))
elif stype == 'number':
value = schema.get('default', '3.14')
self.emitEnd('%s,' % str(value), schema.get('description', ''))
elif stype == 'null':
self.emitEnd('None,', schema.get('description', ''))
elif stype == 'any':
self.emitEnd('"",', schema.get('description', ''))
elif stype == 'array':
self.emitEnd('[', schema.get('description'))
self.indent()
self.emitBegin('')
self._to_str_impl(schema['items'])
self.undent()
self.emit('],')
else:
self.emit('Unknown type! %s' % stype)
self.emitEnd('', '')
self.string = ''.join(self.value)
return self.string
def to_str(self, from_cache):
"""Prototype object based on the schema, in Python code with comments.
Args:
from_cache: callable(name, seen), Callable that retrieves an object
prototype for a schema with the given name. Seen is a list of schema
names already seen as we recursively descend the schema definition.
Returns:
Prototype object based on the schema, in Python code with comments.
The lines of the code will all be properly indented.
"""
self.from_cache = from_cache
return self._to_str_impl(self.schema)
| [
[
8,
0,
0.1205,
0.1452,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2046,
0.0033,
0,
0.66,
0.2,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.2112,
0.0033,
0,
0.66,
... | [
"\"\"\"Schema processing for discovery based APIs\n\nSchemas holds an APIs discovery schemas. It can return those schema as\ndeserialized JSON objects, or pretty print them as prototype objects that\nconform to the schema.\n\nFor example, given the schema:",
"__author__ = 'jcgregorio@google.com (Joe Gregorio)'",
... |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Utility module to import a JSON module
Hides all the messy details of exactly where
we get a simplejson module from.
"""
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
try: # pragma: no cover
import simplejson
except ImportError: # pragma: no cover
try:
# Try to import from django, should work on App Engine
from django.utils import simplejson
except ImportError:
# Should work for Python2.6 and higher.
import json as simplejson
| [
[
8,
0,
0.5312,
0.1562,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.6562,
0.0312,
0,
0.66,
0.5,
777,
1,
0,
0,
0,
0,
3,
0
],
[
7,
0,
0.875,
0.2812,
0,
0.66,
... | [
"\"\"\"Utility module to import a JSON module\n\nHides all the messy details of exactly where\nwe get a simplejson module from.\n\"\"\"",
"__author__ = 'jcgregorio@google.com (Joe Gregorio)'",
"try: # pragma: no cover\n import simplejson\nexcept ImportError: # pragma: no cover\n try:\n # Try to import from... |
# Early, and incomplete implementation of -04.
#
import re
import urllib
RESERVED = ":/?#[]@!$&'()*+,;="
OPERATOR = "+./;?|!@"
EXPLODE = "*+"
MODIFIER = ":^"
TEMPLATE = re.compile(r"{(?P<operator>[\+\./;\?|!@])?(?P<varlist>[^}]+)}", re.UNICODE)
VAR = re.compile(r"^(?P<varname>[^=\+\*:\^]+)((?P<explode>[\+\*])|(?P<partial>[:\^]-?[0-9]+))?(=(?P<default>.*))?$", re.UNICODE)
def _tostring(varname, value, explode, operator, safe=""):
if type(value) == type([]):
if explode == "+":
return ",".join([varname + "." + urllib.quote(x, safe) for x in value])
else:
return ",".join([urllib.quote(x, safe) for x in value])
if type(value) == type({}):
keys = value.keys()
keys.sort()
if explode == "+":
return ",".join([varname + "." + urllib.quote(key, safe) + "," + urllib.quote(value[key], safe) for key in keys])
else:
return ",".join([urllib.quote(key, safe) + "," + urllib.quote(value[key], safe) for key in keys])
else:
return urllib.quote(value, safe)
def _tostring_path(varname, value, explode, operator, safe=""):
joiner = operator
if type(value) == type([]):
if explode == "+":
return joiner.join([varname + "." + urllib.quote(x, safe) for x in value])
elif explode == "*":
return joiner.join([urllib.quote(x, safe) for x in value])
else:
return ",".join([urllib.quote(x, safe) for x in value])
elif type(value) == type({}):
keys = value.keys()
keys.sort()
if explode == "+":
return joiner.join([varname + "." + urllib.quote(key, safe) + joiner + urllib.quote(value[key], safe) for key in keys])
elif explode == "*":
return joiner.join([urllib.quote(key, safe) + joiner + urllib.quote(value[key], safe) for key in keys])
else:
return ",".join([urllib.quote(key, safe) + "," + urllib.quote(value[key], safe) for key in keys])
else:
if value:
return urllib.quote(value, safe)
else:
return ""
def _tostring_query(varname, value, explode, operator, safe=""):
joiner = operator
varprefix = ""
if operator == "?":
joiner = "&"
varprefix = varname + "="
if type(value) == type([]):
if 0 == len(value):
return ""
if explode == "+":
return joiner.join([varname + "=" + urllib.quote(x, safe) for x in value])
elif explode == "*":
return joiner.join([urllib.quote(x, safe) for x in value])
else:
return varprefix + ",".join([urllib.quote(x, safe) for x in value])
elif type(value) == type({}):
if 0 == len(value):
return ""
keys = value.keys()
keys.sort()
if explode == "+":
return joiner.join([varname + "." + urllib.quote(key, safe) + "=" + urllib.quote(value[key], safe) for key in keys])
elif explode == "*":
return joiner.join([urllib.quote(key, safe) + "=" + urllib.quote(value[key], safe) for key in keys])
else:
return varprefix + ",".join([urllib.quote(key, safe) + "," + urllib.quote(value[key], safe) for key in keys])
else:
if value:
return varname + "=" + urllib.quote(value, safe)
else:
return varname
TOSTRING = {
"" : _tostring,
"+": _tostring,
";": _tostring_query,
"?": _tostring_query,
"/": _tostring_path,
".": _tostring_path,
}
def expand(template, vars):
def _sub(match):
groupdict = match.groupdict()
operator = groupdict.get('operator')
if operator is None:
operator = ''
varlist = groupdict.get('varlist')
safe = "@"
if operator == '+':
safe = RESERVED
varspecs = varlist.split(",")
varnames = []
defaults = {}
for varspec in varspecs:
m = VAR.search(varspec)
groupdict = m.groupdict()
varname = groupdict.get('varname')
explode = groupdict.get('explode')
partial = groupdict.get('partial')
default = groupdict.get('default')
if default:
defaults[varname] = default
varnames.append((varname, explode, partial))
retval = []
joiner = operator
prefix = operator
if operator == "+":
prefix = ""
joiner = ","
if operator == "?":
joiner = "&"
if operator == "":
joiner = ","
for varname, explode, partial in varnames:
if varname in vars:
value = vars[varname]
#if not value and (type(value) == type({}) or type(value) == type([])) and varname in defaults:
if not value and value != "" and varname in defaults:
value = defaults[varname]
elif varname in defaults:
value = defaults[varname]
else:
continue
retval.append(TOSTRING[operator](varname, value, explode, operator, safe=safe))
if "".join(retval):
return prefix + joiner.join(retval)
else:
return ""
return TEMPLATE.sub(_sub, template)
| [
[
1,
0,
0.0204,
0.0068,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0272,
0.0068,
0,
0.66,
0.0833,
614,
0,
1,
0,
0,
614,
0,
0
],
[
14,
0,
0.0408,
0.0068,
0,
... | [
"import re",
"import urllib",
"RESERVED = \":/?#[]@!$&'()*+,;=\"",
"OPERATOR = \"+./;?|!@\"",
"EXPLODE = \"*+\"",
"MODIFIER = \":^\"",
"TEMPLATE = re.compile(r\"{(?P<operator>[\\+\\./;\\?|!@])?(?P<varlist>[^}]+)}\", re.UNICODE)",
"VAR = re.compile(r\"^(?P<varname>[^=\\+\\*:\\^]+)((?P<explode>[\\+\\*])... |
#!/usr/bin/env python
# Copyright (c) 2010, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Module to enforce different constraints on flags.
A validator represents an invariant, enforced over a one or more flags.
See 'FLAGS VALIDATORS' in gflags.py's docstring for a usage manual.
"""
__author__ = 'olexiy@google.com (Olexiy Oryeshko)'
class Error(Exception):
"""Thrown If validator constraint is not satisfied."""
class Validator(object):
"""Base class for flags validators.
Users should NOT overload these classes, and use gflags.Register...
methods instead.
"""
# Used to assign each validator an unique insertion_index
validators_count = 0
def __init__(self, checker, message):
"""Constructor to create all validators.
Args:
checker: function to verify the constraint.
Input of this method varies, see SimpleValidator and
DictionaryValidator for a detailed description.
message: string, error message to be shown to the user
"""
self.checker = checker
self.message = message
Validator.validators_count += 1
# Used to assert validators in the order they were registered (CL/18694236)
self.insertion_index = Validator.validators_count
def Verify(self, flag_values):
"""Verify that constraint is satisfied.
flags library calls this method to verify Validator's constraint.
Args:
flag_values: gflags.FlagValues, containing all flags
Raises:
Error: if constraint is not satisfied.
"""
param = self._GetInputToCheckerFunction(flag_values)
if not self.checker(param):
raise Error(self.message)
def GetFlagsNames(self):
"""Return the names of the flags checked by this validator.
Returns:
[string], names of the flags
"""
raise NotImplementedError('This method should be overloaded')
def PrintFlagsWithValues(self, flag_values):
raise NotImplementedError('This method should be overloaded')
def _GetInputToCheckerFunction(self, flag_values):
"""Given flag values, construct the input to be given to checker.
Args:
flag_values: gflags.FlagValues, containing all flags.
Returns:
Return type depends on the specific validator.
"""
raise NotImplementedError('This method should be overloaded')
class SimpleValidator(Validator):
"""Validator behind RegisterValidator() method.
Validates that a single flag passes its checker function. The checker function
takes the flag value and returns True (if value looks fine) or, if flag value
is not valid, either returns False or raises an Exception."""
def __init__(self, flag_name, checker, message):
"""Constructor.
Args:
flag_name: string, name of the flag.
checker: function to verify the validator.
input - value of the corresponding flag (string, boolean, etc).
output - Boolean. Must return True if validator constraint is satisfied.
If constraint is not satisfied, it should either return False or
raise Error.
message: string, error message to be shown to the user if validator's
condition is not satisfied
"""
super(SimpleValidator, self).__init__(checker, message)
self.flag_name = flag_name
def GetFlagsNames(self):
return [self.flag_name]
def PrintFlagsWithValues(self, flag_values):
return 'flag --%s=%s' % (self.flag_name, flag_values[self.flag_name].value)
def _GetInputToCheckerFunction(self, flag_values):
"""Given flag values, construct the input to be given to checker.
Args:
flag_values: gflags.FlagValues
Returns:
value of the corresponding flag.
"""
return flag_values[self.flag_name].value
class DictionaryValidator(Validator):
"""Validator behind RegisterDictionaryValidator method.
Validates that flag values pass their common checker function. The checker
function takes flag values and returns True (if values look fine) or,
if values are not valid, either returns False or raises an Exception.
"""
def __init__(self, flag_names, checker, message):
"""Constructor.
Args:
flag_names: [string], containing names of the flags used by checker.
checker: function to verify the validator.
input - dictionary, with keys() being flag_names, and value for each
key being the value of the corresponding flag (string, boolean, etc).
output - Boolean. Must return True if validator constraint is satisfied.
If constraint is not satisfied, it should either return False or
raise Error.
message: string, error message to be shown to the user if validator's
condition is not satisfied
"""
super(DictionaryValidator, self).__init__(checker, message)
self.flag_names = flag_names
def _GetInputToCheckerFunction(self, flag_values):
"""Given flag values, construct the input to be given to checker.
Args:
flag_values: gflags.FlagValues
Returns:
dictionary, with keys() being self.lag_names, and value for each key
being the value of the corresponding flag (string, boolean, etc).
"""
return dict([key, flag_values[key].value] for key in self.flag_names)
def PrintFlagsWithValues(self, flag_values):
prefix = 'flags '
flags_with_values = []
for key in self.flag_names:
flags_with_values.append('%s=%s' % (key, flag_values[key].value))
return prefix + ', '.join(flags_with_values)
def GetFlagsNames(self):
return self.flag_names
| [
[
8,
0,
0.1818,
0.0267,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2032,
0.0053,
0,
0.66,
0.2,
777,
1,
0,
0,
0,
0,
3,
0
],
[
3,
0,
0.2219,
0.0107,
0,
0.66,
... | [
"\"\"\"Module to enforce different constraints on flags.\n\nA validator represents an invariant, enforced over a one or more flags.\nSee 'FLAGS VALIDATORS' in gflags.py's docstring for a usage manual.\n\"\"\"",
"__author__ = 'olexiy@google.com (Olexiy Oryeshko)'",
"class Error(Exception):\n \"\"\"Thrown If val... |
"""SocksiPy - Python SOCKS module.
Version 1.00
Copyright 2006 Dan-Haim. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of Dan Haim nor the names of his contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY DAN HAIM "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL DAN HAIM OR HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMANGE.
This module provides a standard socket-like interface for Python
for tunneling connections through SOCKS proxies.
"""
"""
Minor modifications made by Christopher Gilbert (http://motomastyle.com/)
for use in PyLoris (http://pyloris.sourceforge.net/)
Minor modifications made by Mario Vilas (http://breakingcode.wordpress.com/)
mainly to merge bug fixes found in Sourceforge
"""
import base64
import socket
import struct
import sys
if getattr(socket, 'socket', None) is None:
raise ImportError('socket.socket missing, proxy support unusable')
PROXY_TYPE_SOCKS4 = 1
PROXY_TYPE_SOCKS5 = 2
PROXY_TYPE_HTTP = 3
PROXY_TYPE_HTTP_NO_TUNNEL = 4
_defaultproxy = None
_orgsocket = socket.socket
class ProxyError(Exception): pass
class GeneralProxyError(ProxyError): pass
class Socks5AuthError(ProxyError): pass
class Socks5Error(ProxyError): pass
class Socks4Error(ProxyError): pass
class HTTPError(ProxyError): pass
_generalerrors = ("success",
"invalid data",
"not connected",
"not available",
"bad proxy type",
"bad input")
_socks5errors = ("succeeded",
"general SOCKS server failure",
"connection not allowed by ruleset",
"Network unreachable",
"Host unreachable",
"Connection refused",
"TTL expired",
"Command not supported",
"Address type not supported",
"Unknown error")
_socks5autherrors = ("succeeded",
"authentication is required",
"all offered authentication methods were rejected",
"unknown username or invalid password",
"unknown error")
_socks4errors = ("request granted",
"request rejected or failed",
"request rejected because SOCKS server cannot connect to identd on the client",
"request rejected because the client program and identd report different user-ids",
"unknown error")
def setdefaultproxy(proxytype=None, addr=None, port=None, rdns=True, username=None, password=None):
"""setdefaultproxy(proxytype, addr[, port[, rdns[, username[, password]]]])
Sets a default proxy which all further socksocket objects will use,
unless explicitly changed.
"""
global _defaultproxy
_defaultproxy = (proxytype, addr, port, rdns, username, password)
def wrapmodule(module):
"""wrapmodule(module)
Attempts to replace a module's socket library with a SOCKS socket. Must set
a default proxy using setdefaultproxy(...) first.
This will only work on modules that import socket directly into the namespace;
most of the Python Standard Library falls into this category.
"""
if _defaultproxy != None:
module.socket.socket = socksocket
else:
raise GeneralProxyError((4, "no proxy specified"))
class socksocket(socket.socket):
"""socksocket([family[, type[, proto]]]) -> socket object
Open a SOCKS enabled socket. The parameters are the same as
those of the standard socket init. In order for SOCKS to work,
you must specify family=AF_INET, type=SOCK_STREAM and proto=0.
"""
def __init__(self, family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0, _sock=None):
_orgsocket.__init__(self, family, type, proto, _sock)
if _defaultproxy != None:
self.__proxy = _defaultproxy
else:
self.__proxy = (None, None, None, None, None, None)
self.__proxysockname = None
self.__proxypeername = None
self.__httptunnel = True
def __recvall(self, count):
"""__recvall(count) -> data
Receive EXACTLY the number of bytes requested from the socket.
Blocks until the required number of bytes have been received.
"""
data = self.recv(count)
while len(data) < count:
d = self.recv(count-len(data))
if not d: raise GeneralProxyError((0, "connection closed unexpectedly"))
data = data + d
return data
def sendall(self, content, *args):
""" override socket.socket.sendall method to rewrite the header
for non-tunneling proxies if needed
"""
if not self.__httptunnel:
content = self.__rewriteproxy(content)
return super(socksocket, self).sendall(content, *args)
def __rewriteproxy(self, header):
""" rewrite HTTP request headers to support non-tunneling proxies
(i.e. those which do not support the CONNECT method).
This only works for HTTP (not HTTPS) since HTTPS requires tunneling.
"""
host, endpt = None, None
hdrs = header.split("\r\n")
for hdr in hdrs:
if hdr.lower().startswith("host:"):
host = hdr
elif hdr.lower().startswith("get") or hdr.lower().startswith("post"):
endpt = hdr
if host and endpt:
hdrs.remove(host)
hdrs.remove(endpt)
host = host.split(" ")[1]
endpt = endpt.split(" ")
if (self.__proxy[4] != None and self.__proxy[5] != None):
hdrs.insert(0, self.__getauthheader())
hdrs.insert(0, "Host: %s" % host)
hdrs.insert(0, "%s http://%s%s %s" % (endpt[0], host, endpt[1], endpt[2]))
return "\r\n".join(hdrs)
def __getauthheader(self):
auth = self.__proxy[4] + ":" + self.__proxy[5]
return "Proxy-Authorization: Basic " + base64.b64encode(auth)
def setproxy(self, proxytype=None, addr=None, port=None, rdns=True, username=None, password=None):
"""setproxy(proxytype, addr[, port[, rdns[, username[, password]]]])
Sets the proxy to be used.
proxytype - The type of the proxy to be used. Three types
are supported: PROXY_TYPE_SOCKS4 (including socks4a),
PROXY_TYPE_SOCKS5 and PROXY_TYPE_HTTP
addr - The address of the server (IP or DNS).
port - The port of the server. Defaults to 1080 for SOCKS
servers and 8080 for HTTP proxy servers.
rdns - Should DNS queries be preformed on the remote side
(rather than the local side). The default is True.
Note: This has no effect with SOCKS4 servers.
username - Username to authenticate with to the server.
The default is no authentication.
password - Password to authenticate with to the server.
Only relevant when username is also provided.
"""
self.__proxy = (proxytype, addr, port, rdns, username, password)
def __negotiatesocks5(self, destaddr, destport):
"""__negotiatesocks5(self,destaddr,destport)
Negotiates a connection through a SOCKS5 server.
"""
# First we'll send the authentication packages we support.
if (self.__proxy[4]!=None) and (self.__proxy[5]!=None):
# The username/password details were supplied to the
# setproxy method so we support the USERNAME/PASSWORD
# authentication (in addition to the standard none).
self.sendall(struct.pack('BBBB', 0x05, 0x02, 0x00, 0x02))
else:
# No username/password were entered, therefore we
# only support connections with no authentication.
self.sendall(struct.pack('BBB', 0x05, 0x01, 0x00))
# We'll receive the server's response to determine which
# method was selected
chosenauth = self.__recvall(2)
if chosenauth[0:1] != chr(0x05).encode():
self.close()
raise GeneralProxyError((1, _generalerrors[1]))
# Check the chosen authentication method
if chosenauth[1:2] == chr(0x00).encode():
# No authentication is required
pass
elif chosenauth[1:2] == chr(0x02).encode():
# Okay, we need to perform a basic username/password
# authentication.
self.sendall(chr(0x01).encode() + chr(len(self.__proxy[4])) + self.__proxy[4] + chr(len(self.__proxy[5])) + self.__proxy[5])
authstat = self.__recvall(2)
if authstat[0:1] != chr(0x01).encode():
# Bad response
self.close()
raise GeneralProxyError((1, _generalerrors[1]))
if authstat[1:2] != chr(0x00).encode():
# Authentication failed
self.close()
raise Socks5AuthError((3, _socks5autherrors[3]))
# Authentication succeeded
else:
# Reaching here is always bad
self.close()
if chosenauth[1] == chr(0xFF).encode():
raise Socks5AuthError((2, _socks5autherrors[2]))
else:
raise GeneralProxyError((1, _generalerrors[1]))
# Now we can request the actual connection
req = struct.pack('BBB', 0x05, 0x01, 0x00)
# If the given destination address is an IP address, we'll
# use the IPv4 address request even if remote resolving was specified.
try:
ipaddr = socket.inet_aton(destaddr)
req = req + chr(0x01).encode() + ipaddr
except socket.error:
# Well it's not an IP number, so it's probably a DNS name.
if self.__proxy[3]:
# Resolve remotely
ipaddr = None
req = req + chr(0x03).encode() + chr(len(destaddr)).encode() + destaddr
else:
# Resolve locally
ipaddr = socket.inet_aton(socket.gethostbyname(destaddr))
req = req + chr(0x01).encode() + ipaddr
req = req + struct.pack(">H", destport)
self.sendall(req)
# Get the response
resp = self.__recvall(4)
if resp[0:1] != chr(0x05).encode():
self.close()
raise GeneralProxyError((1, _generalerrors[1]))
elif resp[1:2] != chr(0x00).encode():
# Connection failed
self.close()
if ord(resp[1:2])<=8:
raise Socks5Error((ord(resp[1:2]), _socks5errors[ord(resp[1:2])]))
else:
raise Socks5Error((9, _socks5errors[9]))
# Get the bound address/port
elif resp[3:4] == chr(0x01).encode():
boundaddr = self.__recvall(4)
elif resp[3:4] == chr(0x03).encode():
resp = resp + self.recv(1)
boundaddr = self.__recvall(ord(resp[4:5]))
else:
self.close()
raise GeneralProxyError((1,_generalerrors[1]))
boundport = struct.unpack(">H", self.__recvall(2))[0]
self.__proxysockname = (boundaddr, boundport)
if ipaddr != None:
self.__proxypeername = (socket.inet_ntoa(ipaddr), destport)
else:
self.__proxypeername = (destaddr, destport)
def getproxysockname(self):
"""getsockname() -> address info
Returns the bound IP address and port number at the proxy.
"""
return self.__proxysockname
def getproxypeername(self):
"""getproxypeername() -> address info
Returns the IP and port number of the proxy.
"""
return _orgsocket.getpeername(self)
def getpeername(self):
"""getpeername() -> address info
Returns the IP address and port number of the destination
machine (note: getproxypeername returns the proxy)
"""
return self.__proxypeername
def __negotiatesocks4(self,destaddr,destport):
"""__negotiatesocks4(self,destaddr,destport)
Negotiates a connection through a SOCKS4 server.
"""
# Check if the destination address provided is an IP address
rmtrslv = False
try:
ipaddr = socket.inet_aton(destaddr)
except socket.error:
# It's a DNS name. Check where it should be resolved.
if self.__proxy[3]:
ipaddr = struct.pack("BBBB", 0x00, 0x00, 0x00, 0x01)
rmtrslv = True
else:
ipaddr = socket.inet_aton(socket.gethostbyname(destaddr))
# Construct the request packet
req = struct.pack(">BBH", 0x04, 0x01, destport) + ipaddr
# The username parameter is considered userid for SOCKS4
if self.__proxy[4] != None:
req = req + self.__proxy[4]
req = req + chr(0x00).encode()
# DNS name if remote resolving is required
# NOTE: This is actually an extension to the SOCKS4 protocol
# called SOCKS4A and may not be supported in all cases.
if rmtrslv:
req = req + destaddr + chr(0x00).encode()
self.sendall(req)
# Get the response from the server
resp = self.__recvall(8)
if resp[0:1] != chr(0x00).encode():
# Bad data
self.close()
raise GeneralProxyError((1,_generalerrors[1]))
if resp[1:2] != chr(0x5A).encode():
# Server returned an error
self.close()
if ord(resp[1:2]) in (91, 92, 93):
self.close()
raise Socks4Error((ord(resp[1:2]), _socks4errors[ord(resp[1:2]) - 90]))
else:
raise Socks4Error((94, _socks4errors[4]))
# Get the bound address/port
self.__proxysockname = (socket.inet_ntoa(resp[4:]), struct.unpack(">H", resp[2:4])[0])
if rmtrslv != None:
self.__proxypeername = (socket.inet_ntoa(ipaddr), destport)
else:
self.__proxypeername = (destaddr, destport)
def __negotiatehttp(self, destaddr, destport):
"""__negotiatehttp(self,destaddr,destport)
Negotiates a connection through an HTTP server.
"""
# If we need to resolve locally, we do this now
if not self.__proxy[3]:
addr = socket.gethostbyname(destaddr)
else:
addr = destaddr
headers = ["CONNECT ", addr, ":", str(destport), " HTTP/1.1\r\n"]
headers += ["Host: ", destaddr, "\r\n"]
if (self.__proxy[4] != None and self.__proxy[5] != None):
headers += [self.__getauthheader(), "\r\n"]
headers.append("\r\n")
self.sendall("".join(headers).encode())
# We read the response until we get the string "\r\n\r\n"
resp = self.recv(1)
while resp.find("\r\n\r\n".encode()) == -1:
resp = resp + self.recv(1)
# We just need the first line to check if the connection
# was successful
statusline = resp.splitlines()[0].split(" ".encode(), 2)
if statusline[0] not in ("HTTP/1.0".encode(), "HTTP/1.1".encode()):
self.close()
raise GeneralProxyError((1, _generalerrors[1]))
try:
statuscode = int(statusline[1])
except ValueError:
self.close()
raise GeneralProxyError((1, _generalerrors[1]))
if statuscode != 200:
self.close()
raise HTTPError((statuscode, statusline[2]))
self.__proxysockname = ("0.0.0.0", 0)
self.__proxypeername = (addr, destport)
def connect(self, destpair):
"""connect(self, despair)
Connects to the specified destination through a proxy.
destpar - A tuple of the IP/DNS address and the port number.
(identical to socket's connect).
To select the proxy server use setproxy().
"""
# Do a minimal input check first
if (not type(destpair) in (list,tuple)) or (len(destpair) < 2) or (type(destpair[0]) != type('')) or (type(destpair[1]) != int):
raise GeneralProxyError((5, _generalerrors[5]))
if self.__proxy[0] == PROXY_TYPE_SOCKS5:
if self.__proxy[2] != None:
portnum = self.__proxy[2]
else:
portnum = 1080
_orgsocket.connect(self, (self.__proxy[1], portnum))
self.__negotiatesocks5(destpair[0], destpair[1])
elif self.__proxy[0] == PROXY_TYPE_SOCKS4:
if self.__proxy[2] != None:
portnum = self.__proxy[2]
else:
portnum = 1080
_orgsocket.connect(self,(self.__proxy[1], portnum))
self.__negotiatesocks4(destpair[0], destpair[1])
elif self.__proxy[0] == PROXY_TYPE_HTTP:
if self.__proxy[2] != None:
portnum = self.__proxy[2]
else:
portnum = 8080
_orgsocket.connect(self,(self.__proxy[1], portnum))
self.__negotiatehttp(destpair[0], destpair[1])
elif self.__proxy[0] == PROXY_TYPE_HTTP_NO_TUNNEL:
if self.__proxy[2] != None:
portnum = self.__proxy[2]
else:
portnum = 8080
_orgsocket.connect(self,(self.__proxy[1],portnum))
if destpair[1] == 443:
self.__negotiatehttp(destpair[0],destpair[1])
else:
self.__httptunnel = False
elif self.__proxy[0] == None:
_orgsocket.connect(self, (destpair[0], destpair[1]))
else:
raise GeneralProxyError((4, _generalerrors[4]))
| [
[
8,
0,
0.0365,
0.0708,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
8,
0,
0.0845,
0.0205,
0,
0.66,
0.04,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0982,
0.0023,
0,
0.66,
... | [
"\"\"\"SocksiPy - Python SOCKS module.\nVersion 1.00\n\nCopyright 2006 Dan-Haim. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n1. Redistributions of source code must retain the above copyright ... |
"""
iri2uri
Converts an IRI to a URI.
"""
__author__ = "Joe Gregorio (joe@bitworking.org)"
__copyright__ = "Copyright 2006, Joe Gregorio"
__contributors__ = []
__version__ = "1.0.0"
__license__ = "MIT"
__history__ = """
"""
import urlparse
# Convert an IRI to a URI following the rules in RFC 3987
#
# The characters we need to enocde and escape are defined in the spec:
#
# iprivate = %xE000-F8FF / %xF0000-FFFFD / %x100000-10FFFD
# ucschar = %xA0-D7FF / %xF900-FDCF / %xFDF0-FFEF
# / %x10000-1FFFD / %x20000-2FFFD / %x30000-3FFFD
# / %x40000-4FFFD / %x50000-5FFFD / %x60000-6FFFD
# / %x70000-7FFFD / %x80000-8FFFD / %x90000-9FFFD
# / %xA0000-AFFFD / %xB0000-BFFFD / %xC0000-CFFFD
# / %xD0000-DFFFD / %xE1000-EFFFD
escape_range = [
(0xA0, 0xD7FF ),
(0xE000, 0xF8FF ),
(0xF900, 0xFDCF ),
(0xFDF0, 0xFFEF),
(0x10000, 0x1FFFD ),
(0x20000, 0x2FFFD ),
(0x30000, 0x3FFFD),
(0x40000, 0x4FFFD ),
(0x50000, 0x5FFFD ),
(0x60000, 0x6FFFD),
(0x70000, 0x7FFFD ),
(0x80000, 0x8FFFD ),
(0x90000, 0x9FFFD),
(0xA0000, 0xAFFFD ),
(0xB0000, 0xBFFFD ),
(0xC0000, 0xCFFFD),
(0xD0000, 0xDFFFD ),
(0xE1000, 0xEFFFD),
(0xF0000, 0xFFFFD ),
(0x100000, 0x10FFFD)
]
def encode(c):
retval = c
i = ord(c)
for low, high in escape_range:
if i < low:
break
if i >= low and i <= high:
retval = "".join(["%%%2X" % ord(o) for o in c.encode('utf-8')])
break
return retval
def iri2uri(uri):
"""Convert an IRI to a URI. Note that IRIs must be
passed in a unicode strings. That is, do not utf-8 encode
the IRI before passing it into the function."""
if isinstance(uri ,unicode):
(scheme, authority, path, query, fragment) = urlparse.urlsplit(uri)
authority = authority.encode('idna')
# For each character in 'ucschar' or 'iprivate'
# 1. encode as utf-8
# 2. then %-encode each octet of that utf-8
uri = urlparse.urlunsplit((scheme, authority, path, query, fragment))
uri = "".join([encode(c) for c in uri])
return uri
if __name__ == "__main__":
import unittest
class Test(unittest.TestCase):
def test_uris(self):
"""Test that URIs are invariant under the transformation."""
invariant = [
u"ftp://ftp.is.co.za/rfc/rfc1808.txt",
u"http://www.ietf.org/rfc/rfc2396.txt",
u"ldap://[2001:db8::7]/c=GB?objectClass?one",
u"mailto:John.Doe@example.com",
u"news:comp.infosystems.www.servers.unix",
u"tel:+1-816-555-1212",
u"telnet://192.0.2.16:80/",
u"urn:oasis:names:specification:docbook:dtd:xml:4.1.2" ]
for uri in invariant:
self.assertEqual(uri, iri2uri(uri))
def test_iri(self):
""" Test that the right type of escaping is done for each part of the URI."""
self.assertEqual("http://xn--o3h.com/%E2%98%84", iri2uri(u"http://\N{COMET}.com/\N{COMET}"))
self.assertEqual("http://bitworking.org/?fred=%E2%98%84", iri2uri(u"http://bitworking.org/?fred=\N{COMET}"))
self.assertEqual("http://bitworking.org/#%E2%98%84", iri2uri(u"http://bitworking.org/#\N{COMET}"))
self.assertEqual("#%E2%98%84", iri2uri(u"#\N{COMET}"))
self.assertEqual("/fred?bar=%E2%98%9A#%E2%98%84", iri2uri(u"/fred?bar=\N{BLACK LEFT POINTING INDEX}#\N{COMET}"))
self.assertEqual("/fred?bar=%E2%98%9A#%E2%98%84", iri2uri(iri2uri(u"/fred?bar=\N{BLACK LEFT POINTING INDEX}#\N{COMET}")))
self.assertNotEqual("/fred?bar=%E2%98%9A#%E2%98%84", iri2uri(u"/fred?bar=\N{BLACK LEFT POINTING INDEX}#\N{COMET}".encode('utf-8')))
unittest.main()
| [
[
8,
0,
0.0318,
0.0545,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0636,
0.0091,
0,
0.66,
0.0909,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.0727,
0.0091,
0,
0.66... | [
"\"\"\"\niri2uri\n\nConverts an IRI to a URI.\n\n\"\"\"",
"__author__ = \"Joe Gregorio (joe@bitworking.org)\"",
"__copyright__ = \"Copyright 2006, Joe Gregorio\"",
"__contributors__ = []",
"__version__ = \"1.0.0\"",
"__license__ = \"MIT\"",
"__history__ = \"\"\"\n\"\"\"",
"import urlparse",
"escape_... |
#!/usr/bin/python
import os
import sys
import threading
from jobutil import *
__author__="qingkaishi"
__date__ ="$Apr 21, 2014 9:45:11 AM$"
alljobs = []
alljobslock = threading.Lock()
def parse_job_files(group):
jobs = []
for item in group:
if item[0].endswith('.json'):
job = ApsaraJob.parse(item[0], item[1])
else:
job = ApsaraJob.parse(item[1], item[0])
jobs.append(job)
alljobslock.acquire()
for item in jobs:
alljobs.append(item)
alljobslock.release()
#################################################################
def cpu_count():
''' Returns the number of CPUs in the system
'''
num = 2
if sys.platform == 'win32':
# fetch the cpu count for windows systems
try:
num = int(os.environ['NUMBER_OF_PROCESSORS'])
except (ValueError, KeyError):
pass
elif sys.platform == 'darwin':
# fetch teh cpu count for MacOS X systems
try:
num = int(os.popen('sysctl -n hw.ncpu').read())
except ValueError:
pass
else:
# an finally fetch the cpu count for Unix-like systems
try:
num = os.sysconf('SC_NPROCESSORS_ONLN')
except (ValueError, OSError, AttributeError):
pass
return num
#################################################################
alljobfiles = []
def get_all_job_files(arg, dirname, names):
jobfiles = []
for filePath in names:
file = os.path.join(dirname, filePath);
if(os.path.isfile(file)):
if(file.endswith(".json")):
jobfiles.append(file)
if(file.endswith(".jobstatus")):
jobfiles.append(file)
if len(jobfiles) == 2:
alljobfiles.append(jobfiles);
if __name__ == "__main__":
if os.path.exists(sys.argv[1]) is True:
os.path.walk(sys.argv[1], get_all_job_files, ())
group = []
allgroups = []
for item in alljobfiles:
group.append(item)
if len(group) == 100:
allgroups.append(group)
allgroups.append(group)
cpus = cpu_count()
for ag in allgroups:
threadlist = []
tempthread = threading.Thread(target=parse_job_files, args=(ag, ))
threadlist.append(tempthread)
if len(threadlist) == cpus:
for at in threadlist:
at.start()
for at in threadlist:
at.join();
for at in threadlist:
at.start()
for at in threadlist:
at.join();
| [
[
1,
0,
0.0202,
0.0101,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0303,
0.0101,
0,
0.66,
0.0833,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0404,
0.0101,
0,
... | [
"import os",
"import sys",
"import threading",
"from jobutil import *",
"__author__=\"qingkaishi\"",
"__date__ =\"$Apr 21, 2014 9:45:11 AM$\"",
"alljobs = []",
"alljobslock = threading.Lock()",
"def parse_job_files(group):\n jobs = []\n for item in group:\n if item[0].endswith('.json'):... |
#!/usr/bin/python
import os
import sys
import threading
from jobutil import *
__author__="qingkaishi"
__date__ ="$Apr 21, 2014 9:45:11 AM$"
alljobs = []
alljobslock = threading.Lock()
def parse_job_files(group):
jobs = []
for item in group:
if item[0].endswith('.json'):
job = ApsaraJob.parse(item[0], item[1])
else:
job = ApsaraJob.parse(item[1], item[0])
jobs.append(job)
alljobslock.acquire()
for item in jobs:
alljobs.append(item)
alljobslock.release()
#################################################################
def cpu_count():
''' Returns the number of CPUs in the system
'''
num = 2
if sys.platform == 'win32':
# fetch the cpu count for windows systems
try:
num = int(os.environ['NUMBER_OF_PROCESSORS'])
except (ValueError, KeyError):
pass
elif sys.platform == 'darwin':
# fetch teh cpu count for MacOS X systems
try:
num = int(os.popen('sysctl -n hw.ncpu').read())
except ValueError:
pass
else:
# an finally fetch the cpu count for Unix-like systems
try:
num = os.sysconf('SC_NPROCESSORS_ONLN')
except (ValueError, OSError, AttributeError):
pass
return num
#################################################################
alljobfiles = []
def get_all_job_files(arg, dirname, names):
jobfiles = []
for filePath in names:
file = os.path.join(dirname, filePath);
if(os.path.isfile(file)):
if(file.endswith(".json")):
jobfiles.append(file)
if(file.endswith(".jobstatus")):
jobfiles.append(file)
if len(jobfiles) == 2:
alljobfiles.append(jobfiles);
if __name__ == "__main__":
if os.path.exists(sys.argv[1]) is True:
os.path.walk(sys.argv[1], get_all_job_files, ())
group = []
allgroups = []
for item in alljobfiles:
group.append(item)
if len(group) == 100:
allgroups.append(group)
allgroups.append(group)
cpus = cpu_count()
for ag in allgroups:
threadlist = []
tempthread = threading.Thread(target=parse_job_files, args=(ag, ))
threadlist.append(tempthread)
if len(threadlist) == cpus:
for at in threadlist:
at.start()
for at in threadlist:
at.join();
for at in threadlist:
at.start()
for at in threadlist:
at.join();
| [
[
1,
0,
0.0202,
0.0101,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0303,
0.0101,
0,
0.66,
0.0833,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0404,
0.0101,
0,
... | [
"import os",
"import sys",
"import threading",
"from jobutil import *",
"__author__=\"qingkaishi\"",
"__date__ =\"$Apr 21, 2014 9:45:11 AM$\"",
"alljobs = []",
"alljobslock = threading.Lock()",
"def parse_job_files(group):\n jobs = []\n for item in group:\n if item[0].endswith('.json'):... |
#!/usr/bin/python
import cairo, gobject, gtk, gtk.gdk, gtk.glade, os, pygtk, re, sys, thread
BRUSHES_ZOOM = 0.5
DOWN_KEY = 65364
INITIAL_ZOOM = 0.5
LEFT_KEY = 65361
LEVEL_WIDTH = 100
LEVEL_HEIGHT = 100
MAX_ZOOM = 4
MIN_ZOOM = 0.25
RIGHT_KEY = 65363
SCROLL_STEP = 64
SETTINGS_DIR = os.getenv("HOME") + '/.abb_editor'
LAST_BRUSH_PATH = SETTINGS_DIR + '/last_brush.txt'
LAST_LEVEL_PATH = SETTINGS_DIR + '/last_level.txt'
TILE_SIZE = 64
UP_KEY = 65362
ZOOM_STEP = 0.25
class TriggerEditorWindow:
def __init__(self, parent_window, triggers_array, trigger_index):
self._parent_window = parent_window
self._triggers_array = triggers_array
self._trigger_index = trigger_index
self._gladefile = (
os.path.join(os.path.dirname(__file__), 'trigger_editor.glade'))
self._tree = gtk.glade.XML(self._gladefile)
# Set up the initial trigger text.
self._entry = self._tree.get_widget('entry')
trigger_text = self._triggers_array[self._trigger_index]
if trigger_text:
self._entry.set_text(trigger_text)
# Connect window signals.
self._window = self._tree.get_widget('window')
signals = { 'on_entry_changed' : self.EntryChangedEvent,
'on_entry_focus_out_event' : self.LoseFocusEvent,
'on_window_key_press_event' : self.KeyPressEvent }
self._tree.signal_autoconnect(signals)
def DestroyWindow(self):
self._window.destroy()
self._parent_window.queue_draw()
def EntryChangedEvent(self, widget):
trigger_text = widget.get_text()
if trigger_text == '':
trigger_text = None
self._triggers_array[self._trigger_index] = trigger_text
def LoseFocusEvent(self, widget, event):
self.DestroyWindow()
def KeyPressEvent(self, widget, event):
if event.keyval == 65293 or event.keyval == 65307: # Escape or enter key.
self.DestroyWindow()
class EditorWindow:
def __init__(self):
self.gladefile = os.path.join(os.path.dirname(__file__), 'editor.glade')
self.tree = gtk.glade.XML(self.gladefile)
# Connect window signals.
self.window = self.tree.get_widget('window')
if (self.window):
self.window.connect("destroy", gtk.main_quit)
self.brushes_widget = self.tree.get_widget('brushes')
self.tiles_widget = self.tree.get_widget('tiles')
signals = { 'on_brushes_expose_event' : self.BrushesExposeEvent,
'on_tiles_expose_event' : self.TilesExposeEvent,
'on_quit_menuitem_activate' : gtk.main_quit,
'on_menuitem_new_activate' : self.NewMenu,
'on_menuitem_loadlevel_activate' : self.LoadLevelMenu,
'on_menuitem_loadbrushes_activate' : self.LoadBrushesMenu,
'on_menuitem_save_activate' : self.SaveLevelMenu,
'on_menuitem_savelevel_activate' : self.SaveLevelAsMenu,
'on_brushes_button_press_event' : self.BrushesClickEvent,
'on_tiles_button_press_event' : self.TilesClickEvent,
'on_tiles_scroll_event' : self.TilesScrollEvent,
'on_window_key_press_event' : self.TilesKeyEvent }
self.tree.signal_autoconnect(signals)
# Initialize misc editor state and clear the document.
self._brushes_surface = None
self._selected_brush = 0
self.NewMenu(None)
# Load last opened files if any such records exist.
if os.path.exists(LAST_BRUSH_PATH):
file_path = open(LAST_BRUSH_PATH).readlines()[0].strip()
if os.path.exists(file_path):
self.LoadBrushesFromFile(file_path)
if os.path.exists(LAST_LEVEL_PATH):
file_path = open(LAST_LEVEL_PATH).readlines()[0].strip()
if os.path.exists(file_path):
self.LoadLevelFromFile(file_path)
def WorldToWindow(self, world_x, world_y):
window_x = world_x * self._view_zoom - self._view_x
window_y = world_y * self._view_zoom - self._view_y
return window_x, window_y
def WindowToWorld(self, window_x, window_y):
world_x = (window_x + self._view_x) / self._view_zoom
world_y = (window_y + self._view_y) / self._view_zoom
return world_x, world_y
def WorldToTileIndex(self, world_x, world_y):
if (world_x < 0 or world_x >= TILE_SIZE * LEVEL_WIDTH or
world_y < 0 or world_y >= TILE_SIZE * LEVEL_HEIGHT):
return -1
return LEVEL_HEIGHT * int(world_x / TILE_SIZE) + int(world_y / TILE_SIZE)
def NewMenu(self, widget):
self._view_x = 0
self._view_y = 0
self._view_zoom = INITIAL_ZOOM
self._tiles = [0] * LEVEL_WIDTH * LEVEL_HEIGHT
self._triggers = [None] * LEVEL_WIDTH * LEVEL_HEIGHT
self._current_file = None
self.SetCleanWindowTitle()
self.window.queue_draw()
def LoadLevelFromFile(self, file_path):
assert file_path
assert 0 == os.system('mkdir -p %s' % SETTINGS_DIR)
open(LAST_LEVEL_PATH, 'w').write(file_path)
self._current_file = file_path
self.SetCleanWindowTitle()
level_lines = open(file_path).readlines()
raw_tiles = level_lines[0].strip()
for tile in xrange(LEVEL_WIDTH * LEVEL_HEIGHT):
self._tiles[tile] = ord(raw_tiles[tile]) - ord('a')
self._triggers = []
for n in xrange(0, LEVEL_WIDTH * LEVEL_HEIGHT):
self._triggers.append(None)
trigger_re = re.compile('(\\d+),(\\d+),"([^"]+)"')
for raw_trigger in level_lines[1:]:
match = trigger_re.match(raw_trigger.strip())
assert match
x = int(match.group(1))
y = int(match.group(2))
trigger = match.group(3)
trigger_index = LEVEL_HEIGHT * x + y
self._triggers[trigger_index] = trigger
self.window.queue_draw()
def LoadLevelMenu(self, widget):
file_path = self.ChooseOpenFile()
if file_path:
self.LoadLevelFromFile(file_path)
def LoadBrushesFromFile(self, file_path):
assert 0 == os.system('mkdir -p %s' % SETTINGS_DIR)
open(LAST_BRUSH_PATH, 'w').write(file_path)
self._brushes_surface = cairo.ImageSurface.create_from_png(file_path)
self.window.queue_draw()
def LoadBrushesMenu(self, widget):
file_path = self.ChooseOpenFile()
if file_path:
self.LoadBrushesFromFile(file_path)
def SetDirtyWindowTitle(self):
if self._current_file:
window_title = self.window.get_title()
if window_title[0] != '*':
self.window.set_title('*' + self._current_file)
else:
self.window.set_title('*(Unsaved Level)')
def SetCleanWindowTitle(self):
if self._current_file:
self.window.set_title(self._current_file)
else:
self.window.set_title('(Unsaved Level)')
def SaveLevelToFile(self, file_path):
assert file_path
self._current_file = file_path
self.SetCleanWindowTitle()
level_string = map(lambda tile : '%c' % (tile + ord('a')), self._tiles)
level_file = open(file_path, 'w')
level_file.write(''.join(level_string))
for x in xrange(0, LEVEL_WIDTH):
for y in xrange(0, LEVEL_HEIGHT):
index = LEVEL_HEIGHT * x + y
trigger_string = self._triggers[index];
if trigger_string:
level_file.write('\n%d,%d,"%s"' % (x, y, trigger_string))
def SaveLevelMenu(self, widget):
if self._current_file:
self.SaveLevelToFile(self._current_file)
else:
self.SaveLevelAsMenu(widget)
def SaveLevelAsMenu(self, widget):
file_path = self.ChooseSaveFile()
if file_path:
assert 0 == os.system('mkdir -p %s' % SETTINGS_DIR)
open(LAST_LEVEL_PATH, 'w').write(file_path)
self.SaveLevelToFile(file_path)
def BrushesClickEvent(self, widget, event):
self._selected_brush = int(event.y / BRUSHES_ZOOM / TILE_SIZE)
self.window.queue_draw()
def BrushesExposeEvent(self, widget, event):
# Documentation for drawing using Cairo was found on:
# http://www.pygtk.org/articles/cairo-pygtk-widgets/cairo-pygtk-widgets.htm
# Cairo within Python documentation was found on:
# http://www.cairographics.org/pycairo
if self._brushes_surface:
cairo_context = widget.window.cairo_create()
cairo_context.rectangle(
event.area.x, event.area.y, event.area.width, event.area.height)
cairo_context.clip()
cairo_context.scale(BRUSHES_ZOOM, BRUSHES_ZOOM)
cairo_context.set_source_surface(self._brushes_surface, 0, 0)
cairo_context.paint()
cairo_context.rectangle(
0, TILE_SIZE * self._selected_brush, TILE_SIZE, TILE_SIZE)
cairo_context.set_line_width(6)
cairo_context.set_source_rgba(1, 0, 0, 1)
cairo_context.stroke()
return False
def TilesClickEvent(self, widget, event):
if not self._brushes_surface:
return
world_x, world_y = self.WindowToWorld(event.x, event.y)
tile_index = self.WorldToTileIndex(world_x, world_y)
if tile_index == -1:
return # Map tile out of bounds.
if event.button == 1: # Left click.
self._tiles[tile_index] = self._selected_brush
self._triggers[tile_index] = None
self.window.queue_draw()
self.SetDirtyWindowTitle()
elif event.button == 3: # Right click.
trigger_editor_window = (
TriggerEditorWindow(self.window, self._triggers, tile_index))
self.window.queue_draw()
self.SetDirtyWindowTitle()
def TilesKeyEvent(self, widget, event):
if event.keyval == LEFT_KEY:
self._view_x -= SCROLL_STEP * self._view_zoom
elif event.keyval == RIGHT_KEY:
self._view_x += SCROLL_STEP * self._view_zoom
elif event.keyval == UP_KEY:
self._view_y -= SCROLL_STEP * self._view_zoom
elif event.keyval == DOWN_KEY:
self._view_y += SCROLL_STEP * self._view_zoom
self.window.queue_draw()
def TilesScrollEvent(self, widget, event):
old_world_x, old_world_y = self.WindowToWorld(event.x, event.y)
if event.direction == 0:
self._view_zoom += ZOOM_STEP
elif event.direction == 1:
self._view_zoom -= ZOOM_STEP
self._view_zoom = max(self._view_zoom, MIN_ZOOM)
self._view_zoom = min(self._view_zoom, MAX_ZOOM)
# Zoom around the mouse pointer.
new_world_x, new_world_y = self.WindowToWorld(event.x, event.y)
self._view_x += (old_world_x - new_world_x) * self._view_zoom
self._view_y += (old_world_y - new_world_y) * self._view_zoom
self.window.queue_draw()
def TilesExposeEvent(self, widget, event):
# See comment in BrushesExposeEvent for Cairo documentation.
if self._brushes_surface:
cairo_context = widget.window.cairo_create()
brushes_pattern = cairo.SurfacePattern(self._brushes_surface)
brushes_pattern.set_filter(cairo.FILTER_FAST)
zoomed_tile_size = TILE_SIZE * self._view_zoom
x = 0
y = 0
while x <= event.area.width + zoomed_tile_size:
while y <= event.area.height + zoomed_tile_size:
world_x, world_y = self.WindowToWorld(x, y)
tile_index = self.WorldToTileIndex(world_x, world_y)
if tile_index == -1:
y += zoomed_tile_size
continue # Map tile out of bounds.
tile_x = TILE_SIZE * int(world_x / TILE_SIZE)
tile_y = TILE_SIZE * int(world_y / TILE_SIZE)
window_x, window_y = self.WorldToWindow(tile_x, tile_y)
cairo_context.identity_matrix()
cairo_context.reset_clip()
cairo_context.rectangle(
window_x, window_y, zoomed_tile_size, zoomed_tile_size)
cairo_context.set_source_rgba(0, 0, 0, 1)
cairo_context.fill()
tile_id = self._tiles[tile_index]
trigger = self._triggers[tile_index]
if tile_id != 0:
cairo_context.save()
cairo_context.rectangle(
window_x, window_y, zoomed_tile_size, zoomed_tile_size)
cairo_context.clip()
cairo_context.translate(window_x, window_y);
cairo_context.scale(self._view_zoom, self._view_zoom)
cairo_context.translate(0, -TILE_SIZE * tile_id)
cairo_context.set_source(brushes_pattern)
cairo_context.paint()
cairo_context.restore()
if trigger != None:
half_tile_size = TILE_SIZE / 2
cairo_context.save()
cairo_context.translate(window_x, window_y)
cairo_context.scale(self._view_zoom, self._view_zoom)
cairo_context.translate(half_tile_size, half_tile_size)
cairo_context.arc(
0.0, 0.0, half_tile_size - 10, 0.0, 2.0 * 3.1415926)
cairo_context.set_source_rgba(1, 1, 0.5, 0.7)
cairo_context.set_line_width(3)
cairo_context.stroke()
cairo_context.restore()
y += zoomed_tile_size
x += zoomed_tile_size
y = 0
else:
cairo_context = widget.window.cairo_create()
cairo_context.select_font_face("Sans")
cairo_context.set_font_size(18)
cairo_context.move_to(event.area.width / 2, event.area.height / 2)
cairo_context.show_text("No tile set loaded.")
return False
def ChooseOpenFile(self):
chooser = gtk.FileChooserDialog(
title = None,action=gtk.FILE_CHOOSER_ACTION_OPEN,
buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN,
gtk.RESPONSE_OK))
response = chooser.run()
result = None
if response == gtk.RESPONSE_OK:
result = chooser.get_filename()
chooser.destroy()
return result
def ChooseSaveFile(self):
chooser = gtk.FileChooserDialog(
title = None,action=gtk.FILE_CHOOSER_ACTION_SAVE,
buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE,
gtk.RESPONSE_OK))
response = chooser.run()
result = None
if response == gtk.RESPONSE_OK:
result = chooser.get_filename()
chooser.destroy()
return result
if __name__ == "__main__":
gobject.threads_init()
editor_window = EditorWindow()
gtk.main()
| [
[
1,
0,
0.008,
0.0027,
0,
0.66,
0,
747,
0,
10,
0,
0,
747,
0,
0
],
[
14,
0,
0.0159,
0.0027,
0,
0.66,
0.0526,
826,
1,
0,
0,
0,
0,
2,
0
],
[
14,
0,
0.0186,
0.0027,
0,
... | [
"import cairo, gobject, gtk, gtk.gdk, gtk.glade, os, pygtk, re, sys, thread",
"BRUSHES_ZOOM = 0.5",
"DOWN_KEY = 65364",
"INITIAL_ZOOM = 0.5",
"LEFT_KEY = 65361",
"LEVEL_WIDTH = 100",
"LEVEL_HEIGHT = 100",
"MAX_ZOOM = 4",
"MIN_ZOOM = 0.25",
"RIGHT_KEY = 65363",
"SCROLL_STEP = 64",
"SETTINGS_DIR... |
#!/usr/bin/python
import cairo, gobject, gtk, gtk.gdk, gtk.glade, os, pygtk, re, sys, thread
BRUSHES_ZOOM = 0.5
DOWN_KEY = 65364
INITIAL_ZOOM = 0.5
LEFT_KEY = 65361
LEVEL_WIDTH = 100
LEVEL_HEIGHT = 100
MAX_ZOOM = 4
MIN_ZOOM = 0.25
RIGHT_KEY = 65363
SCROLL_STEP = 64
SETTINGS_DIR = os.getenv("HOME") + '/.abb_editor'
LAST_BRUSH_PATH = SETTINGS_DIR + '/last_brush.txt'
LAST_LEVEL_PATH = SETTINGS_DIR + '/last_level.txt'
TILE_SIZE = 64
UP_KEY = 65362
ZOOM_STEP = 0.25
class TriggerEditorWindow:
def __init__(self, parent_window, triggers_array, trigger_index):
self._parent_window = parent_window
self._triggers_array = triggers_array
self._trigger_index = trigger_index
self._gladefile = (
os.path.join(os.path.dirname(__file__), 'trigger_editor.glade'))
self._tree = gtk.glade.XML(self._gladefile)
# Set up the initial trigger text.
self._entry = self._tree.get_widget('entry')
trigger_text = self._triggers_array[self._trigger_index]
if trigger_text:
self._entry.set_text(trigger_text)
# Connect window signals.
self._window = self._tree.get_widget('window')
signals = { 'on_entry_changed' : self.EntryChangedEvent,
'on_entry_focus_out_event' : self.LoseFocusEvent,
'on_window_key_press_event' : self.KeyPressEvent }
self._tree.signal_autoconnect(signals)
def DestroyWindow(self):
self._window.destroy()
self._parent_window.queue_draw()
def EntryChangedEvent(self, widget):
trigger_text = widget.get_text()
if trigger_text == '':
trigger_text = None
self._triggers_array[self._trigger_index] = trigger_text
def LoseFocusEvent(self, widget, event):
self.DestroyWindow()
def KeyPressEvent(self, widget, event):
if event.keyval == 65293 or event.keyval == 65307: # Escape or enter key.
self.DestroyWindow()
class EditorWindow:
def __init__(self):
self.gladefile = os.path.join(os.path.dirname(__file__), 'editor.glade')
self.tree = gtk.glade.XML(self.gladefile)
# Connect window signals.
self.window = self.tree.get_widget('window')
if (self.window):
self.window.connect("destroy", gtk.main_quit)
self.brushes_widget = self.tree.get_widget('brushes')
self.tiles_widget = self.tree.get_widget('tiles')
signals = { 'on_brushes_expose_event' : self.BrushesExposeEvent,
'on_tiles_expose_event' : self.TilesExposeEvent,
'on_quit_menuitem_activate' : gtk.main_quit,
'on_menuitem_new_activate' : self.NewMenu,
'on_menuitem_loadlevel_activate' : self.LoadLevelMenu,
'on_menuitem_loadbrushes_activate' : self.LoadBrushesMenu,
'on_menuitem_save_activate' : self.SaveLevelMenu,
'on_menuitem_savelevel_activate' : self.SaveLevelAsMenu,
'on_brushes_button_press_event' : self.BrushesClickEvent,
'on_tiles_button_press_event' : self.TilesClickEvent,
'on_tiles_scroll_event' : self.TilesScrollEvent,
'on_window_key_press_event' : self.TilesKeyEvent }
self.tree.signal_autoconnect(signals)
# Initialize misc editor state and clear the document.
self._brushes_surface = None
self._selected_brush = 0
self.NewMenu(None)
# Load last opened files if any such records exist.
if os.path.exists(LAST_BRUSH_PATH):
file_path = open(LAST_BRUSH_PATH).readlines()[0].strip()
if os.path.exists(file_path):
self.LoadBrushesFromFile(file_path)
if os.path.exists(LAST_LEVEL_PATH):
file_path = open(LAST_LEVEL_PATH).readlines()[0].strip()
if os.path.exists(file_path):
self.LoadLevelFromFile(file_path)
def WorldToWindow(self, world_x, world_y):
window_x = world_x * self._view_zoom - self._view_x
window_y = world_y * self._view_zoom - self._view_y
return window_x, window_y
def WindowToWorld(self, window_x, window_y):
world_x = (window_x + self._view_x) / self._view_zoom
world_y = (window_y + self._view_y) / self._view_zoom
return world_x, world_y
def WorldToTileIndex(self, world_x, world_y):
if (world_x < 0 or world_x >= TILE_SIZE * LEVEL_WIDTH or
world_y < 0 or world_y >= TILE_SIZE * LEVEL_HEIGHT):
return -1
return LEVEL_HEIGHT * int(world_x / TILE_SIZE) + int(world_y / TILE_SIZE)
def NewMenu(self, widget):
self._view_x = 0
self._view_y = 0
self._view_zoom = INITIAL_ZOOM
self._tiles = [0] * LEVEL_WIDTH * LEVEL_HEIGHT
self._triggers = [None] * LEVEL_WIDTH * LEVEL_HEIGHT
self._current_file = None
self.SetCleanWindowTitle()
self.window.queue_draw()
def LoadLevelFromFile(self, file_path):
assert file_path
assert 0 == os.system('mkdir -p %s' % SETTINGS_DIR)
open(LAST_LEVEL_PATH, 'w').write(file_path)
self._current_file = file_path
self.SetCleanWindowTitle()
level_lines = open(file_path).readlines()
raw_tiles = level_lines[0].strip()
for tile in xrange(LEVEL_WIDTH * LEVEL_HEIGHT):
self._tiles[tile] = ord(raw_tiles[tile]) - ord('a')
self._triggers = []
for n in xrange(0, LEVEL_WIDTH * LEVEL_HEIGHT):
self._triggers.append(None)
trigger_re = re.compile('(\\d+),(\\d+),"([^"]+)"')
for raw_trigger in level_lines[1:]:
match = trigger_re.match(raw_trigger.strip())
assert match
x = int(match.group(1))
y = int(match.group(2))
trigger = match.group(3)
trigger_index = LEVEL_HEIGHT * x + y
self._triggers[trigger_index] = trigger
self.window.queue_draw()
def LoadLevelMenu(self, widget):
file_path = self.ChooseOpenFile()
if file_path:
self.LoadLevelFromFile(file_path)
def LoadBrushesFromFile(self, file_path):
assert 0 == os.system('mkdir -p %s' % SETTINGS_DIR)
open(LAST_BRUSH_PATH, 'w').write(file_path)
self._brushes_surface = cairo.ImageSurface.create_from_png(file_path)
self.window.queue_draw()
def LoadBrushesMenu(self, widget):
file_path = self.ChooseOpenFile()
if file_path:
self.LoadBrushesFromFile(file_path)
def SetDirtyWindowTitle(self):
if self._current_file:
window_title = self.window.get_title()
if window_title[0] != '*':
self.window.set_title('*' + self._current_file)
else:
self.window.set_title('*(Unsaved Level)')
def SetCleanWindowTitle(self):
if self._current_file:
self.window.set_title(self._current_file)
else:
self.window.set_title('(Unsaved Level)')
def SaveLevelToFile(self, file_path):
assert file_path
self._current_file = file_path
self.SetCleanWindowTitle()
level_string = map(lambda tile : '%c' % (tile + ord('a')), self._tiles)
level_file = open(file_path, 'w')
level_file.write(''.join(level_string))
for x in xrange(0, LEVEL_WIDTH):
for y in xrange(0, LEVEL_HEIGHT):
index = LEVEL_HEIGHT * x + y
trigger_string = self._triggers[index];
if trigger_string:
level_file.write('\n%d,%d,"%s"' % (x, y, trigger_string))
def SaveLevelMenu(self, widget):
if self._current_file:
self.SaveLevelToFile(self._current_file)
else:
self.SaveLevelAsMenu(widget)
def SaveLevelAsMenu(self, widget):
file_path = self.ChooseSaveFile()
if file_path:
assert 0 == os.system('mkdir -p %s' % SETTINGS_DIR)
open(LAST_LEVEL_PATH, 'w').write(file_path)
self.SaveLevelToFile(file_path)
def BrushesClickEvent(self, widget, event):
self._selected_brush = int(event.y / BRUSHES_ZOOM / TILE_SIZE)
self.window.queue_draw()
def BrushesExposeEvent(self, widget, event):
# Documentation for drawing using Cairo was found on:
# http://www.pygtk.org/articles/cairo-pygtk-widgets/cairo-pygtk-widgets.htm
# Cairo within Python documentation was found on:
# http://www.cairographics.org/pycairo
if self._brushes_surface:
cairo_context = widget.window.cairo_create()
cairo_context.rectangle(
event.area.x, event.area.y, event.area.width, event.area.height)
cairo_context.clip()
cairo_context.scale(BRUSHES_ZOOM, BRUSHES_ZOOM)
cairo_context.set_source_surface(self._brushes_surface, 0, 0)
cairo_context.paint()
cairo_context.rectangle(
0, TILE_SIZE * self._selected_brush, TILE_SIZE, TILE_SIZE)
cairo_context.set_line_width(6)
cairo_context.set_source_rgba(1, 0, 0, 1)
cairo_context.stroke()
return False
def TilesClickEvent(self, widget, event):
if not self._brushes_surface:
return
world_x, world_y = self.WindowToWorld(event.x, event.y)
tile_index = self.WorldToTileIndex(world_x, world_y)
if tile_index == -1:
return # Map tile out of bounds.
if event.button == 1: # Left click.
self._tiles[tile_index] = self._selected_brush
self._triggers[tile_index] = None
self.window.queue_draw()
self.SetDirtyWindowTitle()
elif event.button == 3: # Right click.
trigger_editor_window = (
TriggerEditorWindow(self.window, self._triggers, tile_index))
self.window.queue_draw()
self.SetDirtyWindowTitle()
def TilesKeyEvent(self, widget, event):
if event.keyval == LEFT_KEY:
self._view_x -= SCROLL_STEP * self._view_zoom
elif event.keyval == RIGHT_KEY:
self._view_x += SCROLL_STEP * self._view_zoom
elif event.keyval == UP_KEY:
self._view_y -= SCROLL_STEP * self._view_zoom
elif event.keyval == DOWN_KEY:
self._view_y += SCROLL_STEP * self._view_zoom
self.window.queue_draw()
def TilesScrollEvent(self, widget, event):
old_world_x, old_world_y = self.WindowToWorld(event.x, event.y)
if event.direction == 0:
self._view_zoom += ZOOM_STEP
elif event.direction == 1:
self._view_zoom -= ZOOM_STEP
self._view_zoom = max(self._view_zoom, MIN_ZOOM)
self._view_zoom = min(self._view_zoom, MAX_ZOOM)
# Zoom around the mouse pointer.
new_world_x, new_world_y = self.WindowToWorld(event.x, event.y)
self._view_x += (old_world_x - new_world_x) * self._view_zoom
self._view_y += (old_world_y - new_world_y) * self._view_zoom
self.window.queue_draw()
def TilesExposeEvent(self, widget, event):
# See comment in BrushesExposeEvent for Cairo documentation.
if self._brushes_surface:
cairo_context = widget.window.cairo_create()
brushes_pattern = cairo.SurfacePattern(self._brushes_surface)
brushes_pattern.set_filter(cairo.FILTER_FAST)
zoomed_tile_size = TILE_SIZE * self._view_zoom
x = 0
y = 0
while x <= event.area.width + zoomed_tile_size:
while y <= event.area.height + zoomed_tile_size:
world_x, world_y = self.WindowToWorld(x, y)
tile_index = self.WorldToTileIndex(world_x, world_y)
if tile_index == -1:
y += zoomed_tile_size
continue # Map tile out of bounds.
tile_x = TILE_SIZE * int(world_x / TILE_SIZE)
tile_y = TILE_SIZE * int(world_y / TILE_SIZE)
window_x, window_y = self.WorldToWindow(tile_x, tile_y)
cairo_context.identity_matrix()
cairo_context.reset_clip()
cairo_context.rectangle(
window_x, window_y, zoomed_tile_size, zoomed_tile_size)
cairo_context.set_source_rgba(0, 0, 0, 1)
cairo_context.fill()
tile_id = self._tiles[tile_index]
trigger = self._triggers[tile_index]
if tile_id != 0:
cairo_context.save()
cairo_context.rectangle(
window_x, window_y, zoomed_tile_size, zoomed_tile_size)
cairo_context.clip()
cairo_context.translate(window_x, window_y);
cairo_context.scale(self._view_zoom, self._view_zoom)
cairo_context.translate(0, -TILE_SIZE * tile_id)
cairo_context.set_source(brushes_pattern)
cairo_context.paint()
cairo_context.restore()
if trigger != None:
half_tile_size = TILE_SIZE / 2
cairo_context.save()
cairo_context.translate(window_x, window_y)
cairo_context.scale(self._view_zoom, self._view_zoom)
cairo_context.translate(half_tile_size, half_tile_size)
cairo_context.arc(
0.0, 0.0, half_tile_size - 10, 0.0, 2.0 * 3.1415926)
cairo_context.set_source_rgba(1, 1, 0.5, 0.7)
cairo_context.set_line_width(3)
cairo_context.stroke()
cairo_context.restore()
y += zoomed_tile_size
x += zoomed_tile_size
y = 0
else:
cairo_context = widget.window.cairo_create()
cairo_context.select_font_face("Sans")
cairo_context.set_font_size(18)
cairo_context.move_to(event.area.width / 2, event.area.height / 2)
cairo_context.show_text("No tile set loaded.")
return False
def ChooseOpenFile(self):
chooser = gtk.FileChooserDialog(
title = None,action=gtk.FILE_CHOOSER_ACTION_OPEN,
buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN,
gtk.RESPONSE_OK))
response = chooser.run()
result = None
if response == gtk.RESPONSE_OK:
result = chooser.get_filename()
chooser.destroy()
return result
def ChooseSaveFile(self):
chooser = gtk.FileChooserDialog(
title = None,action=gtk.FILE_CHOOSER_ACTION_SAVE,
buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE,
gtk.RESPONSE_OK))
response = chooser.run()
result = None
if response == gtk.RESPONSE_OK:
result = chooser.get_filename()
chooser.destroy()
return result
if __name__ == "__main__":
gobject.threads_init()
editor_window = EditorWindow()
gtk.main()
| [
[
1,
0,
0.008,
0.0027,
0,
0.66,
0,
747,
0,
10,
0,
0,
747,
0,
0
],
[
14,
0,
0.0159,
0.0027,
0,
0.66,
0.0526,
826,
1,
0,
0,
0,
0,
2,
0
],
[
14,
0,
0.0186,
0.0027,
0,
... | [
"import cairo, gobject, gtk, gtk.gdk, gtk.glade, os, pygtk, re, sys, thread",
"BRUSHES_ZOOM = 0.5",
"DOWN_KEY = 65364",
"INITIAL_ZOOM = 0.5",
"LEFT_KEY = 65361",
"LEVEL_WIDTH = 100",
"LEVEL_HEIGHT = 100",
"MAX_ZOOM = 4",
"MIN_ZOOM = 0.25",
"RIGHT_KEY = 65363",
"SCROLL_STEP = 64",
"SETTINGS_DIR... |
#! /usr/bin/python
import random
import sys
import roslib; roslib.load_manifest("hrl_object_fetching")
import rospy
import actionlib
from pr2_overhead_grasping.msg import *
#from pr2_playpen.srv import *
from hrl_lib.keyboard_input import KeyboardInput
from pr2_overhead_grasping.helpers import log
from tabletop_object_detector.srv import TabletopSegmentation
from tabletop_object_detector.msg import TabletopDetectionResult
##
# Uses the object_detection service detect objects on the table. Returns a list
# of pairs [ [ x, y, z], rot ] which represent the centers and z orientation of
# each object detected on the table.
def detect_tabletop_objects():
DETECT_ERROR = 0.
#cbbf = ClusterBoundingBoxFinder(tf_listener=self.oger.cm.tf_listener)
object_detector = rospy.ServiceProxy("/tabletop_segmentation", TabletopSegmentation)
table = object_detector().table
object_detector.close()
return table
#if detects.result != 4:
# err("Detection failed (err %d)" % (detects.result))
# return []
#table_z = detects.table.pose.pose.position.z
#objects = []
#for cluster in detects.clusters:
# (object_points,
# object_bounding_box_dims,
# object_bounding_box,
# object_to_base_link_frame,
# object_to_cluster_frame) = cbbf.find_object_frame_and_bounding_box(cluster)
# # log("bounding box:", object_bounding_box)
# (object_pos, object_quat) = cf.mat_to_pos_and_quat(object_to_cluster_frame)
# angs = euler_from_quaternion(object_quat)
# log("angs:", angs)
# # position is half of height
# object_pos[2] = table_z + object_bounding_box[1][2] / 2. + DETECT_ERROR
# log("pos:", object_pos)
# log("table_z:", table_z)
# objects += [[object_pos, angs[2]]]
#return objects
if __name__ == '__main__':
args = sys.argv
rospy.init_node('object_fetching')
print detect_tabletop_objects()
# ki = KeyboardInput()
# grasp_client = actionlib.SimpleActionClient('overhead_grasp', OverheadGraspAction)
# grasp_client.wait_for_server()
# grasp_setup_client = actionlib.SimpleActionClient('overhead_grasp_setup', OverheadGraspSetupAction)
# grasp_setup_client.wait_for_server()
# print "grasp_client ready"
# if args[1] == 'reg_test':
# results_dict = {}
# ki.kbhit()
# while not rospy.is_shutdown():
# goal = OverheadGraspSetupGoal()
# grasp_setup_client.send_goal(goal)
# #grasp_setup_client.wait_for_result()
# rospy.sleep(1.0)
#
# print "Grasp started"
# goal = OverheadGraspGoal()
# goal.is_grasp = True
# goal.grasp_type=OverheadGraspGoal.VISION_GRASP
# goal.x = 0.5 + random.uniform(-0.1, 0.1)
# goal.y = 0.0 + random.uniform(-0.1, 0.1)
# grasp_client.send_goal(goal)
# grasp_client.wait_for_result()
# result = grasp_client.get_result()
# goal = OverheadGraspGoal()
# if result.grasp_result == "Table collision" or True:
# goal.is_grasp = False
# goal.grasp_type=OverheadGraspGoal.MANUAL_GRASP
# goal.x = 0.5 + random.uniform(-0.1, 0.1)
# goal.y = 0.0 + random.uniform(-0.1, 0.1)
# grasp_client.send_goal(goal)
# grasp_client.wait_for_result()
# result = grasp_client.get_result()
# if result.grasp_result not in results_dict:
# results_dict[result.grasp_result] = 0
# results_dict[result.grasp_result] += 1
#
# print results_dict
# try:
# print float(results_dict["No collision"]) / results_dict["Regular collision"]
# except:
# pass
#
# elif args[1] == 'playpen_demo':
# rospy.wait_for_service('conveyor')
# conveyor = rospy.ServiceProxy('conveyor', Conveyor)
# print "conveyor ready"
# rospy.wait_for_service('playpen')
# playpen = rospy.ServiceProxy('playpen', Playpen)
# print "playpen ready"
# print "waiting for setup"
# rospy.sleep(20.0)
# while not rospy.is_shutdown():
# conveyor(0.10 * 2.)
#
# print "Grasp started"
# goal = OverheadGraspGoal()
# goal.is_grasp = True
# goal.grasp_type=OverheadGraspGoal.VISION_GRASP
# goal.x = 0.5
# goal.y = 0.0
# grasp_client.send_goal(goal)
# grasp_client.wait_for_result()
# result = grasp_client.get_result()
# goal = OverheadGraspGoal()
# goal.is_grasp = False
# goal.grasp_type=OverheadGraspGoal.MANUAL_GRASP
# goal.x = 0.5 + random.uniform(-0.1, 0.1)
# goal.y = 0.0 + random.uniform(-0.1, 0.1)
# grasp_client.send_goal(goal)
# grasp_client.wait_for_result()
# result = grasp_client.get_result()
#
# # do playpen stuff
#
# log("Opening trap door")
# playpen(1)
# rospy.sleep(0.2)
# log("Closing trap door")
# playpen(0)
# rospy.sleep(0.2)
| [
[
1,
0,
0.0146,
0.0073,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0219,
0.0073,
0,
0.66,
0.0833,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0365,
0.0073,
0,
... | [
"import random",
"import sys",
"import roslib; roslib.load_manifest(\"hrl_object_fetching\")",
"import roslib; roslib.load_manifest(\"hrl_object_fetching\")",
"import rospy",
"import actionlib",
"from pr2_overhead_grasping.msg import *",
"from hrl_lib.keyboard_input import KeyboardInput",
"from pr2_... |
#! /usr/bin/python
import numpy as np, math
import scipy.io as spio
import roslib; roslib.load_manifest('hrl_object_fetching')
import rospy
import hrl_lib.util as hrl_util
from std_msgs.msg import Float64MultiArray, Bool
from pr2_msgs.msg import AccelerometerState, PressureState
from sensor_msgs.msg import JointState
from pr2_controllers_msgs.msg import JointTrajectoryControllerState
from hrl_pr2_lib.pr2 import PR2, Joint
from motion_planning_msgs.srv import FilterJointTrajectory
import pr2_controllers_msgs.msg as pm
UNTUCK = False
rospy.init_node('untuck_grasp')
[q, t] = hrl_util.load_pickle('untuck_traj_6.pickle')
q = np.mat(q.T)
q = q[:,0::30]
#trim_val = -1
#q = q[:,0:trim_val]
#q[:,-1] = np.mat([[-0.269010636167, -0.307363010617, -1.52246181858, -1.67151320238, 294.057002545, -1.55558026761, -1.71909509593]]).T
vel = q.copy()
vel[:,1:] -= q[:,0:-1]
vel[:,0] = 0
vel /= 0.3
#vel[:,-1] = np.mat([[0.1] * 7]).T
t = np.linspace(1.3, 1.3 + (q.shape[1] - 1) * 0.3, q.shape[1])
#t[-1] = t[-1] + 2
#t = q / vel
#t = t.max(1)
#t = np.cumsum(t)
#print t
pr2 = PR2()
rospy.wait_for_service('trajectory_filter/filter_trajectory')
filter_traj = rospy.ServiceProxy('trajectory_filter/filter_trajectory', FilterJointTrajectory)
#print q.shape
#vel = vel[:,0:trim_val]
#t = t[0:trim_val]
if not UNTUCK:
q = q[:,::-1]
vel = -vel[:,::-1]
vel[:,-1] = 0
#vel[:,0] = np.mat([[0.1] * 7]).T
#t[-1] = t[-1] - 2
t[0] = 0
t[1:] += 0.1
#print q
#print vel
joint_traj = pr2.right._create_trajectory(q, t, vel)
result = filter_traj(trajectory=joint_traj, allowed_time=rospy.Duration.from_sec(20))
filtered_traj = result.trajectory
filtered_traj.header.stamp = rospy.get_rostime() + rospy.Duration(1.)
g = pm.JointTrajectoryGoal()
g.trajectory = joint_traj
pr2.right.client.send_goal(g)
#pr2.right.set_poses(q, t, vel)
#def set_poses(self, pos_mat, times, vel_mat=None, block=True):
| [
[
1,
0,
0.0328,
0.0164,
0,
0.66,
0,
954,
0,
2,
0,
0,
954,
0,
0
],
[
1,
0,
0.0492,
0.0164,
0,
0.66,
0.0323,
670,
0,
1,
0,
0,
670,
0,
0
],
[
1,
0,
0.0656,
0.0164,
0,
... | [
"import numpy as np, math",
"import scipy.io as spio",
"import roslib; roslib.load_manifest('hrl_object_fetching')",
"import roslib; roslib.load_manifest('hrl_object_fetching')",
"import rospy",
"import hrl_lib.util as hrl_util",
"from std_msgs.msg import Float64MultiArray, Bool",
"from pr2_msgs.msg i... |
#! /usr/bin/python
import numpy as np, math
import scipy.io as spio
import roslib; roslib.load_manifest('hrl_object_fetching')
import rospy
import hrl_lib.util as hrl_util
from std_msgs.msg import Float64MultiArray, Bool
from pr2_msgs.msg import AccelerometerState, PressureState
from sensor_msgs.msg import JointState
from pr2_controllers_msgs.msg import JointTrajectoryControllerState
r_jt_idx_lis = [17, 18, 16, 20, 19, 21, 22]
l_jt_idx_lis = [29, 30, 28, 32, 31, 33, 34]
n_samples = 100 * 20
class Listener:
def __init__(self):
self.q = np.zeros(( n_samples, 7))
self.t = np.zeros((n_samples, 1))
self.tind = 0
self.ind = 0
def callback(self,msg):
if self.ind % 10 == 0:
print self.tind, self.ind
for i,idx in enumerate(r_jt_idx_lis):
self.q[self.ind, i] = msg.position[idx]
print self.q[self.ind, i],
print ""
self.t[self.ind] = msg.header.stamp.to_sec()
self.ind += 1
rospy.init_node('quick_data')
lis = Listener()
sub = rospy.Subscriber('/joint_states', JointState, lis.callback)
#sub_started = rospy.Subscriber('/grasper/grasp_executing', Bool, lis.grasp_executing)
rospy.spin()
hrl_util.save_pickle([lis.q[0:lis.ind,:], lis.t[0:lis.ind,:]], 'untuck_traj_6.pickle')
i = 0
while lis.q[i,4] != 0:
print lis.q[i-1,3] - lis.q[i,3],
i += 1
#c = 10
#data = {'q%d'%c:lis.q, 'des%d'%c:lis.des, 't%d'%c:lis.t}
#data = {'q':lis.q, 'des':lis.des, 't':lis.t}
#spio.savemat('grasp_err_all_1.mat', data)
| [
[
1,
0,
0.0426,
0.0213,
0,
0.66,
0,
954,
0,
2,
0,
0,
954,
0,
0
],
[
1,
0,
0.0638,
0.0213,
0,
0.66,
0.05,
670,
0,
1,
0,
0,
670,
0,
0
],
[
1,
0,
0.0851,
0.0213,
0,
0.... | [
"import numpy as np, math",
"import scipy.io as spio",
"import roslib; roslib.load_manifest('hrl_object_fetching')",
"import roslib; roslib.load_manifest('hrl_object_fetching')",
"import rospy",
"import hrl_lib.util as hrl_util",
"from std_msgs.msg import Float64MultiArray, Bool",
"from pr2_msgs.msg i... |
#! /usr/bin/python
import roslib
roslib.load_manifest('hrl_trajectory_playback')
import rospy
import actionlib
import trajectory_msgs.msg as tm
import pr2_controllers_msgs.msg as pm
import hrl_lib.util as hrl_util
#from hrl_pr2_lib.pr2 import PR2, Joint
from hrl_trajectory_playback.srv import TrajPlaybackSrv, TrajPlaybackSrvRequest
import numpy as np, math
##
# This code was crudely grabbed from Hai's hrl_pr2_lib.pr2 because it's broken...
class PR2(object):
def __init__(self):
self.right = PR2Arm('r')
self.left = PR2Arm('l')
class PR2Arm(object):
def __init__(self, arm):
joint_controller_name = arm + '_arm_controller'
self.client = actionlib.SimpleActionClient('/%s/joint_trajectory_action' % joint_controller_name, pm.JointTrajectoryAction)
rospy.loginfo('pr2arm: waiting for server %s' % joint_controller_name)
self.client.wait_for_server()
self.joint_names = rospy.get_param('/%s/joints' % joint_controller_name)
self.zeros = [0 for j in range(len(self.joint_names))]
def create_trajectory(self, pos_mat, times, vel_mat=None):
#Make JointTrajectoryPoints
points = [tm.JointTrajectoryPoint() for i in range(pos_mat.shape[1])]
for i in range(pos_mat.shape[1]):
points[i].positions = pos_mat[:,i].A1.tolist()
points[i].accelerations = self.zeros
if vel_mat == None:
points[i].velocities = self.zeros
else:
points[i].velocities = vel_mat[:,i].A1.tolist()
for i in range(pos_mat.shape[1]):
points[i].time_from_start = rospy.Duration(times[i])
#Create JointTrajectory
jt = tm.JointTrajectory()
jt.joint_names = self.joint_names
jt.points = points
jt.header.stamp = rospy.get_rostime()
return jt
##
class TrajPlayback():
def __init__( self, name, fname, arm = 'right' ):
self.arm = arm
self.name = name
rospy.logout( 'TrajPlayback: Initializing (%s)' % self.name )
try:
rospy.init_node('traj_playback_'+self.name)
except:
pass
dat = hrl_util.load_pickle( fname )
self.q = np.mat( dat[0].T )
# subsample
self.q = self.q[:,0::30]
# smooth
self.t = np.linspace( 1.3, 1.3 + (self.q.shape[1]-1)*0.3, self.q.shape[1] )
self.vel = self.q.copy()
self.vel[:,1:] -= self.q[:,0:-1]
self.vel[:,0] = 0
self.vel /= 0.3
self.pr2 = PR2()
self.__service = rospy.Service( 'traj_playback/' + name,
TrajPlaybackSrv,
self.process_service )
rospy.logout( 'TrajPlayback: Ready for service requests (%s)' % self.name )
def process_service( self, req ):
if req.play_backward:
rospy.loginfo( 'TrajPlayback: Playing Reverse (%s)' % self.name )
else:
rospy.loginfo( 'TrajPlayback: Playing Forward (%s)' % self.name )
if req.play_backward:
tq = self.q[:,::-1].copy()
tvel = -1 * self.vel[:,::-1].copy()
tvel[:,-1] = 0
tt = self.t.copy()
tt[0] = 0
tt[1:] += 0.1
else:
tq = self.q.copy()
tvel = self.vel.copy()
tt = self.t.copy()
if self.arm == 'right':
joint_traj = self.pr2.right.create_trajectory( tq, tt, tvel )
else:
joint_traj = self.pr2.left.create_trajectory( tq, tt, tvel )
dur = rospy.Duration.from_sec( tt[-1] + 5 )
# result = self.filter_traj( trajectory = joint_traj,
# allowed_time = dur)
# ft = result.trajectory
# ft.header.stamp = rospy.get_rostime() + rospy.Duration( 1.0 )
g = pm.JointTrajectoryGoal()
g.trajectory = joint_traj # why not ft...?
if self.arm == 'right':
self.pr2.right.client.send_goal( g )
self.pr2.right.client.wait_for_result()
else:
self.pr2.left.client.send_goal( g )
self.pr2.left.client.wait_for_result()
return True
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('--pkl', action='store', type='string', dest='pkl',
help='Output file [default=\'out.pkl\']', default='out.pkl')
p.add_option('--name', action='store', type='string', dest='name',
help='Service "name": /traj_playback/name [default=\'test\']',
default='test')
p.add_option('--play', action='store_true', dest='play',
help='Just play it once instead of building service [default=False]',
default=False)
p.add_option('--reverse', action='store_true', dest='rev',
help='Just play it once in reverse [default=False]',
default=False)
p.add_option('--left', action='store_true', dest='left_arm',
help='Use the left arm? [Right is default]')
opt, args = p.parse_args()
if opt.left_arm:
tp = TrajPlayback( opt.name, opt.pkl, arm = 'left' )
else:
tp = TrajPlayback( opt.name, opt.pkl, arm = 'right' )
if opt.play:
req = TrajPlaybackSrvRequest()
req.play_backward = opt.rev
tp.process_service( req )
else:
rospy.spin()
| [
[
1,
0,
0.0127,
0.0063,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.019,
0.0063,
0,
0.66,
0.0833,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.0253,
0.0063,
0,
0.6... | [
"import roslib",
"roslib.load_manifest('hrl_trajectory_playback')",
"import rospy",
"import actionlib",
"import trajectory_msgs.msg as tm",
"import pr2_controllers_msgs.msg as pm",
"import hrl_lib.util as hrl_util",
"from hrl_trajectory_playback.srv import TrajPlaybackSrv, TrajPlaybackSrvRequest",
"... |
#! /usr/bin/python
import roslib
roslib.load_manifest('hrl_trajectory_playback')
import rospy
import hrl_lib.util as hrl_util
from sensor_msgs.msg import JointState
from collections import deque # fast appends
import numpy as np, math
# Hack (this code currently only supports the right arm!)
JOINT_NAMES = ['%s_shoulder_pan_joint', '%s_shoulder_lift_joint', '%s_upper_arm_roll_joint',
'%s_elbow_flex_joint', '%s_forearm_roll_joint', '%s_wrist_flex_joint',
'%s_wrist_roll_joint']
class Listener:
def __init__(self, arm = 'right'):
self.q = deque() # np.zeros(( n_samples, 7))
self.t = deque() # np.zeros((n_samples, 1))
self.arm = arm
# self.tind = 0
# self.ind = 0
self.initialized = False
self.starttime = rospy.Time(0)
self.r_jt_idx_lis = None
self.l_jt_idx_lis = None
def callback( self, msg ):
currtime = msg.header.stamp.to_sec()
if not self.initialized:
self.initialized = True
self.starttime = currtime
self.lasttime = currtime
self.r_jt_idx_lis = [msg.name.index(joint_name % 'r') for joint_name in JOINT_NAMES]
self.l_jt_idx_lis = [msg.name.index(joint_name % 'l') for joint_name in JOINT_NAMES]
if currtime - self.lasttime > 1.0:
self.lasttime = currtime
print 'Still Capturing (%d sec)' % (currtime - self.starttime)
if self.arm == 'right':
q_ja = [ msg.position[idx] for idx in self.r_jt_idx_lis ]
else:
q_ja = [ msg.position[idx] for idx in self.l_jt_idx_lis ]
self.q.append( q_ja )
# for i,idx in enumerate( r_jt_idx_lis ): # only dealing with right arm!
# self.q[self.ind, i] = msg.position[idx]
# print self.q[self.ind, i],
# print ""
# self.t[self.ind] = msg.header.stamp.to_sec()
# self.ind += 1
self.t.append([ currtime ])
if __name__ == '__main__':
import optparse
p = optparse.OptionParser()
p.add_option('--pkl', action='store', type='string', dest='pkl',
help='Output file [default=\'out.pkl\']', default='out.pkl')
p.add_option('--left', action='store_true', dest='left_arm',
help='Use the left arm? [Right is default]')
opt, args = p.parse_args()
rospy.init_node('quick_data')
if opt.left_arm:
lis = Listener( arm = 'left' )
else:
lis = Listener( arm = 'right' )
sub = rospy.Subscriber( '/joint_states', JointState, lis.callback )
print 'Recording... <Ctrl-C> to stop.'
rospy.spin()
sub.unregister()
#hrl_util.save_pickle([lis.q[0:lis.ind,:], lis.t[0:lis.ind,:]], 'untuck_traj_6.pickle')
print 'Outputting to: %s' % opt.pkl
hrl_util.save_pickle([ np.array(lis.q), # Nx7 numpy array
np.array(lis.t) ], # Nx1 numpy array
opt.pkl )
| [
[
1,
0,
0.0235,
0.0118,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.0353,
0.0118,
0,
0.66,
0.1111,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.0471,
0.0118,
0,
0.... | [
"import roslib",
"roslib.load_manifest('hrl_trajectory_playback')",
"import rospy",
"import hrl_lib.util as hrl_util",
"from sensor_msgs.msg import JointState",
"from collections import deque # fast appends",
"import numpy as np, math",
"JOINT_NAMES = ['%s_shoulder_pan_joint', '%s_shoulder_lift_joint'... |
__all__ = [
'playback',
'record'
]
| [
[
14,
0,
0.625,
1,
0,
0.66,
0,
272,
0,
0,
0,
0,
0,
5,
0
]
] | [
"__all__ = [\n'playback',\n'record'\n]"
] |
import scipy.optimize as so
import math, numpy as np
import pylab as pl
import sys, optparse, time
import copy
from enthought.mayavi import mlab
#import util as ut
import roslib; roslib.load_manifest('doors_forces_kinematics')
roslib.load_manifest('epc_core')
import cody_arms.arms as ca
#import mekabot.coord_frames as mcf
import cody_arms.coord_frames as mcf
import hrl_lib.util as ut, hrl_lib.transforms as tr
roslib.load_manifest('hrl_tilting_hokuyo')
import hrl_tilting_hokuyo.display_3d_mayavi as d3m
roslib.load_manifest('epc_door_opening')
import epc_door_opening.segway_motion_calc as smc
class JointTrajectory():
''' class to store joint trajectories.
data only - use for pickling.
'''
def __init__(self):
self.time_list = [] # time in seconds
self.q_list = [] #each element is a list of 7 joint angles.
self.qdot_list = [] #each element is a list of 7 joint angles.
self.qdotdot_list = [] #each element is a list of 7 joint angles.
## class to store trajectory of a coord frame executing planar motion (x,y,a)
#data only - use for pickling
class PlanarTrajectory():
def __init__(self):
self.time_list = [] # time in seconds
self.x_list = []
self.y_list = []
self.a_list = []
class CartesianTajectory():
''' class to store trajectory of cartesian points.
data only - use for pickling
'''
def __init__(self):
self.time_list = [] # time in seconds
self.p_list = [] #each element is a list of 3 coordinates
self.v_list = [] #each element is a list of 3 coordinates (velocity)
class ForceTrajectory():
''' class to store time evolution of the force at the end effector.
data only - use for pickling
'''
def __init__(self):
self.time_list = [] # time in seconds
self.f_list = [] #each element is a list of 3 coordinates
##
# @param traj - JointTrajectory
# @return CartesianTajectory after performing FK on traj to compute
# cartesian position, velocity
def joint_to_cartesian(traj, arm):
firenze = ca.M3HrlRobot(end_effector_length = 0.17318)
#firenze = ca.M3HrlRobot()
pts = []
cart_vel = []
for i in range(len(traj.q_list)):
q = traj.q_list[i]
p = firenze.FK(arm, q)
pts.append(p.A1.tolist())
if traj.qdot_list != [] and traj.qdot_list[0] != None:
qdot = traj.qdot_list[i]
jac = firenze.Jac(arm, q)
vel = jac * np.matrix(qdot).T
cart_vel.append(vel.A1[0:3].tolist())
ct = CartesianTajectory()
ct.time_list = copy.copy(traj.time_list)
ct.p_list = copy.copy(pts)
ct.v_list = copy.copy(cart_vel)
#return np.matrix(pts).T
return ct
def plot_forces_quiver(pos_traj,force_traj,color='k'):
import arm_trajectories as at
#if traj.__class__ == at.JointTrajectory:
if isinstance(pos_traj,at.JointTrajectory):
pos_traj = joint_to_cartesian(pos_traj)
pts = np.matrix(pos_traj.p_list).T
label_list = ['X coord (m)', 'Y coord (m)', 'Z coord (m)']
x = pts[0,:].A1.tolist()
y = pts[1,:].A1.tolist()
forces = np.matrix(force_traj.f_list).T
u = (-1*forces[0,:]).A1.tolist()
v = (-1*forces[1,:]).A1.tolist()
pl.quiver(x,y,u,v,width=0.002,color=color,scale=100.0)
# pl.quiver(x,y,u,v,width=0.002,color=color)
pl.axis('equal')
##
# @param xaxis - x axis for the graph (0,1 or 2)
# @param zaxis - for a 3d plot. not implemented.
def plot_cartesian(traj, xaxis=None, yaxis=None, zaxis=None, color='b',label='_nolegend_',
linewidth=2, scatter_size=10, plot_velocity=False):
import matplotlib_util.util as mpu
import arm_trajectories as at
#if traj.__class__ == at.JointTrajectory:
if isinstance(traj,at.JointTrajectory):
traj = joint_to_cartesian(traj)
pts = np.matrix(traj.p_list).T
label_list = ['X coord (m)', 'Y coord (m)', 'Z coord (m)']
x = pts[xaxis,:].A1.tolist()
y = pts[yaxis,:].A1.tolist()
if plot_velocity:
vels = np.matrix(traj.v_list).T
xvel = vels[xaxis,:].A1.tolist()
yvel = vels[yaxis,:].A1.tolist()
if zaxis == None:
mpu.plot_yx(y, x, color, linewidth, '-', scatter_size, label,
axis = 'equal', xlabel = label_list[xaxis],
ylabel = label_list[yaxis],)
if plot_velocity:
mpu.plot_quiver_yxv(y, x, np.matrix([xvel,yvel]),
width = 0.001, scale = 1.)
mpu.legend()
else:
from numpy import array
from enthought.mayavi.api import Engine
engine = Engine()
engine.start()
if len(engine.scenes) == 0:
engine.new_scene()
z = pts[zaxis,:].A1.tolist()
time_list = [t-traj.time_list[0] for t in traj.time_list]
mlab.plot3d(x,y,z,time_list,tube_radius=None,line_width=4)
mlab.axes()
mlab.xlabel(label_list[xaxis])
mlab.ylabel(label_list[yaxis])
mlab.zlabel(label_list[zaxis])
mlab.colorbar(title='Time')
# -------------------------------------------
axes = engine.scenes[0].children[0].children[0].children[1]
axes.axes.position = array([ 0., 0.])
axes.axes.label_format = '%-#6.2g'
axes.title_text_property.font_size=4
## return two lists containing the radial and tangential components of the forces.
# @param f_list - list of forces. (each force is a list of 2 or 3 floats)
# @param p_list - list of positions. (each position is a list of 2 or 3 floats)
# @param cx - x coord of the center of the circle.
# @param cy - y coord of the center of the circle.
# @return list of magnitude of radial component, list of magnitude
# tangential component, list of the force along the remaining
# direction
def compute_radial_tangential_forces(f_list,p_list,cx,cy):
f_rad_l,f_tan_l, f_res_l = [], [], []
for f,p in zip(f_list,p_list):
rad_vec = np.array([p[0]-cx,p[1]-cy])
rad_vec = rad_vec/np.linalg.norm(rad_vec)
tan_vec = (np.matrix([[0,-1],[1,0]]) * np.matrix(rad_vec).T).A1
f_vec = np.array([f[0],f[1]])
f_tan_mag = np.dot(f_vec, tan_vec)
f_rad_mag = np.dot(f_vec, rad_vec)
# f_res_mag = np.linalg.norm(f_vec- rad_vec*f_rad_mag - tan_vec*f_tan_mag)
f_rad_mag = abs(f_rad_mag)
f_tan_mag = abs(f_tan_mag)
f_rad_l.append(f_rad_mag)
f_tan_l.append(f_tan_mag)
f_res_l.append(abs(f[2]))
return f_rad_l, f_tan_l, f_res_l
def fit_circle_priors(rad_guess, x_guess, y_guess, pts, sigma_r,
sigma_xy, sigma_pts, verbose=True):
global x_prior, y_prior
x_prior = x_guess
y_prior = y_guess
def error_function(params):
center = np.matrix((params[0],params[1])).T
rad = params[2]
err_pts = ut.norm(pts-center).A1 - rad
lik = np.dot(err_pts, err_pts) / (sigma_pts * sigma_pts)
pri = ((rad - rad_guess)**2) / (sigma_r * sigma_r)
#pri += ((x_prior - center[0,0])**2) / (sigma_xy * sigma_xy)
#pri += ((y_prior - center[1,0])**2) / (sigma_xy * sigma_xy)
return (lik + pri)
params_1 = [x_prior, y_prior, rad_guess]
r = so.fmin_bfgs(error_function, params_1, full_output=1,
disp = verbose, gtol=1e-5)
opt_params_1,fopt_1 = r[0],r[1]
y_prior = y_guess + 2*rad_guess
params_2 = [x_prior, y_prior, rad_guess]
r = so.fmin_bfgs(error_function, params_2, full_output=1,
disp = verbose, gtol=1e-5)
opt_params_2,fopt_2 = r[0],r[1]
if fopt_2<fopt_1:
return opt_params_2[2],opt_params_2[0],opt_params_2[1]
else:
return opt_params_1[2],opt_params_1[0],opt_params_1[1]
## find the x and y coord of the center of the circle and the radius that
# best matches the data.
# @param rad_guess - guess for the radius of the circle
# @param x_guess - guess for x coord of center
# @param y_guess - guess for y coord of center.
# @param pts - 2xN np matrix of points.
# @param method - optimization method. ('fmin' or 'fmin_bfgs')
# @param verbose - passed onto the scipy optimize functions. whether to print out the convergence info.
# @return r,x,y (radius, x and y coord of the center of the circle)
def fit_circle(rad_guess, x_guess, y_guess, pts, method, verbose=True,
rad_fix = False):
def error_function(params):
center = np.matrix((params[0],params[1])).T
if rad_fix:
rad = rad_guess
else:
rad = params[2]
err = ut.norm(pts-center).A1 - rad
res = np.dot(err,err)
#if not rad_fix and rad < 0.3:
# res = res*(0.3-rad)*100
return res
params_1 = [x_guess,y_guess]
if not rad_fix:
params_1.append(rad_guess)
if method == 'fmin':
r = so.fmin(error_function,params_1,xtol=0.0002,ftol=0.000001,full_output=1,disp=verbose)
opt_params_1,fopt_1 = r[0],r[1]
elif method == 'fmin_bfgs':
r = so.fmin_bfgs(error_function, params_1, full_output=1,
disp = verbose, gtol=1e-5)
opt_params_1,fopt_1 = r[0],r[1]
else:
raise RuntimeError('unknown method: '+method)
params_2 = [x_guess,y_guess+2*rad_guess]
if not rad_fix:
params_2.append(rad_guess)
if method == 'fmin':
r = so.fmin(error_function,params_2,xtol=0.0002,ftol=0.000001,full_output=1,disp=verbose)
opt_params_2,fopt_2 = r[0],r[1]
elif method == 'fmin_bfgs':
r = so.fmin_bfgs(error_function, params_2, full_output=1,
disp = verbose, gtol=1e-5)
opt_params_2,fopt_2 = r[0],r[1]
else:
raise RuntimeError('unknown method: '+method)
if fopt_2<fopt_1:
if rad_fix:
return rad_guess,opt_params_2[0],opt_params_2[1]
else:
return opt_params_2[2],opt_params_2[0],opt_params_2[1]
else:
if rad_fix:
return rad_guess,opt_params_1[0],opt_params_1[1]
else:
return opt_params_1[2],opt_params_1[0],opt_params_1[1]
## changes the cartesian trajectory to put everything in the same frame.
# NOTE - velocity transformation does not work if the segway is also
# moving. This is because I am not logging the velocity of the segway.
# @param pts - CartesianTajectory
# @param st - object of type PlanarTrajectory (segway trajectory)
# @return CartesianTajectory
def account_segway_motion(cart_traj, force_traj, st):
ct = CartesianTajectory()
ft = ForceTrajectory()
for i in range(len(cart_traj.p_list)):
x,y,a = st.x_list[i], st.y_list[i], st.a_list[i]
p_tl = np.matrix(cart_traj.p_list[i]).T
p_ts = smc.tsTtl(p_tl, x, y, a)
p = p_ts
ct.p_list.append(p.A1.tolist())
# transform forces to the world frame.
f_tl = np.matrix(force_traj.f_list[i]).T
f_ts = smc.tsRtl(f_tl, a)
f = f_ts
ft.f_list.append(f.A1.tolist())
# this is incorrect. I also need to use the velocity of the
# segway. Unclear whether this is useful right now, so not
# implementing it. (Advait. Jan 6, 2010.)
if cart_traj.v_list != []:
v_tl = np.matrix(cart_traj.v_list[i]).T
v_ts = smc.tsRtl(v_tl, a)
ct.v_list.append(v_ts.A1.tolist())
ct.time_list = copy.copy(cart_traj.time_list)
ft.time_list = copy.copy(force_traj.time_list)
return ct, ft
# @param cart_traj - CartesianTajectory
# @param z_l - list of zenither heights
# @return CartesianTajectory
def account_zenithering(cart_traj, z_l):
ct = CartesianTajectory()
h_start = z_l[0]
for i in range(len(cart_traj.p_list)):
h = z_l[i]
p = cart_traj.p_list[i]
p[2] += h - h_start
ct.p_list.append(p)
# this is incorrect. I also need to use the velocity of the
# zenither. Unclear whether this is useful right now, so not
# implementing it. (Advait. Jan 6, 2010.)
if cart_traj.v_list != []:
ct.v_list.append(cart_traj.v_list[i])
ct.time_list = copy.copy(cart_traj.time_list)
return ct
##
# remove the initial part of the trjectory in which the hook is not moving.
# @param ct - cartesian trajectory of the end effector in the world frame.
# @return 2xN np matrix, reject_idx
def filter_cartesian_trajectory(ct):
pts_list = ct.p_list
ee_start_pos = pts_list[0]
l = [pts_list[0]]
for i, p in enumerate(pts_list[1:]):
l.append(p)
pts_2d = (np.matrix(l).T)[0:2,:]
st_pt = pts_2d[:,0]
end_pt = pts_2d[:,-1]
dist_moved = np.linalg.norm(st_pt-end_pt)
#if dist_moved < 0.1:
if dist_moved < 0.03:
reject_idx = i
pts_2d = pts_2d[:,reject_idx:]
return pts_2d, reject_idx
##
# remove the last part of the trjectory in which the hook might have slipped off
# @param ct - cartesian trajectory of the end effector in the world frame.
# @param ft - force trajectory
# @return cartesian trajectory with the zero force end part removed, force trajectory
def filter_trajectory_force(ct, ft):
vel_list = copy.copy(ct.v_list)
pts_list = copy.copy(ct.p_list)
time_list = copy.copy(ct.time_list)
ft_list = copy.copy(ft.f_list)
f_mag_list = ut.norm(np.matrix(ft.f_list).T).A1.tolist()
if len(pts_list) != len(f_mag_list):
print 'arm_trajectories.filter_trajectory_force: force and end effector lists are not of the same length.'
print 'Exiting ...'
sys.exit()
n_pts = len(pts_list)
i = n_pts - 1
hook_slip_off_threshold = 1.5 # from compliant_trajectories.py
while i > 0:
if f_mag_list[i] < hook_slip_off_threshold:
pts_list.pop()
time_list.pop()
ft_list.pop()
if vel_list != []:
vel_list.pop()
else:
break
i -= 1
ct2 = CartesianTajectory()
ct2.time_list = time_list
ct2.p_list = pts_list
ct2.v_list = vel_list
ft2 = ForceTrajectory()
ft2.time_list = copy.copy(time_list)
ft2.f_list = ft_list
return ct2, ft2
if __name__ == '__main__':
import matplotlib_util.util as mpu
p = optparse.OptionParser()
p.add_option('-f', action='store', type='string', dest='fname',
help='pkl file to use.', default='')
p.add_option('--xy', action='store_true', dest='xy',
help='plot the x and y coordinates of the end effector.')
p.add_option('--yz', action='store_true', dest='yz',
help='plot the y and z coordinates of the end effector.')
p.add_option('--xz', action='store_true', dest='xz',
help='plot the x and z coordinates of the end effector.')
p.add_option('--plot_ellipses', action='store_true', dest='plot_ellipses',
help='plot the stiffness ellipse in the x-y plane')
p.add_option('--pfc', action='store_true', dest='pfc',
help='plot the radial and tangential components of the force.')
p.add_option('--pff', action='store_true', dest='pff',
help='plot the force field corresponding to a stiffness ellipse.')
p.add_option('--pev', action='store_true', dest='pev',
help='plot the stiffness ellipses for different combinations of the rel stiffnesses.')
p.add_option('--plot_forces', action='store_true', dest='plot_forces',
help='plot the force in the x-y plane')
p.add_option('--plot_forces_error', action='store_true', dest='plot_forces_error',
help='plot the error between the computed and measured (ATI) forces in the x-y plane')
p.add_option('--xyz', action='store_true', dest='xyz',
help='plot in 3d the coordinates of the end effector.')
p.add_option('-r', action='store', type='float', dest='rad',
help='radius of the joint.', default=None)
p.add_option('--noshow', action='store_true', dest='noshow',
help='do not display the figure (use while saving figures to disk)')
p.add_option('--exptplot', action='store_true', dest='exptplot',
help='put all the graphs of an experiment as subplots.')
p.add_option('--sturm', action='store_true', dest='sturm',
help='make log files to send to sturm')
p.add_option('--icra_presentation_plot', action='store_true',
dest='icra_presentation_plot',
help='plot explaining CEP update.')
opt, args = p.parse_args()
fname = opt.fname
xy_flag = opt.xy
yz_flag = opt.yz
xz_flag = opt.xz
plot_forces_flag = opt.plot_forces
plot_ellipses_flag = opt.plot_ellipses
plot_forces_error_flag = opt.plot_forces_error
plot_force_components_flag = opt.pfc
plot_force_field_flag = opt.pff
xyz_flag = opt.xyz
rad = opt.rad
show_fig = not(opt.noshow)
plot_ellipses_vary_flag = opt.pev
expt_plot = opt.exptplot
sturm_output = opt.sturm
if plot_ellipses_vary_flag:
show_fig=False
i = 0
ratio_list1 = [0.1,0.3,0.5,0.7,0.9] # coarse search
ratio_list2 = [0.1,0.3,0.5,0.7,0.9] # coarse search
ratio_list3 = [0.1,0.3,0.5,0.7,0.9] # coarse search
# ratio_list1 = [0.7,0.8,0.9,1.0]
# ratio_list2 = [0.7,0.8,0.9,1.0]
# ratio_list3 = [0.3,0.4,0.5,0.6,0.7]
# ratio_list1 = [1.0,2.,3.0]
# ratio_list2 = [1.,2.,3.]
# ratio_list3 = [0.3,0.4,0.5,0.6,0.7]
inv_mean_list,std_list = [],[]
x_l,y_l,z_l = [],[],[]
s0 = 0.2
#s0 = 0.4
for s1 in ratio_list1:
for s2 in ratio_list2:
for s3 in ratio_list3:
i += 1
s_list = [s0,s1,s2,s3,0.8]
#s_list = [s1,s2,s3,s0,0.8]
print '################## s_list:', s_list
m,s = plot_stiff_ellipse_map(s_list,i)
inv_mean_list.append(1./m)
std_list.append(s)
x_l.append(s1)
y_l.append(s2)
z_l.append(s3)
ut.save_pickle({'x_l':x_l,'y_l':y_l,'z_l':z_l,'inv_mean_list':inv_mean_list,'std_list':std_list},
'stiff_dict_'+ut.formatted_time()+'.pkl')
d3m.plot_points(np.matrix([x_l,y_l,z_l]),scalar_list=inv_mean_list,mode='sphere')
mlab.axes()
d3m.show()
sys.exit()
if fname=='':
print 'please specify a pkl file (-f option)'
print 'Exiting...'
sys.exit()
d = ut.load_pickle(fname)
actual_cartesian_tl = joint_to_cartesian(d['actual'], d['arm'])
actual_cartesian, _ = account_segway_motion(actual_cartesian_tl,d['force'], d['segway'])
if d.has_key('zenither_list'):
actual_cartesian = account_zenithering(actual_cartesian,
d['zenither_list'])
eq_cartesian_tl = joint_to_cartesian(d['eq_pt'], d['arm'])
eq_cartesian, _ = account_segway_motion(eq_cartesian_tl, d['force'], d['segway'])
if d.has_key('zenither_list'):
eq_cartesian = account_zenithering(eq_cartesian, d['zenither_list'])
cartesian_force_clean, _ = filter_trajectory_force(actual_cartesian,
d['force'])
pts_2d, reject_idx = filter_cartesian_trajectory(cartesian_force_clean)
if rad != None:
#rad = 0.39 # lab cabinet recessed.
#rad = 0.42 # kitchen cabinet
#rad = 0.80 # lab glass door
pts_list = actual_cartesian.p_list
eq_pts_list = eq_cartesian.p_list
ee_start_pos = pts_list[0]
x_guess = ee_start_pos[0]
y_guess = ee_start_pos[1] - rad
print 'before call to fit_rotary_joint'
force_list = d['force'].f_list
if sturm_output:
str_parts = fname.split('.')
sturm_file_name = str_parts[0]+'_sturm.log'
print 'Sturm file name:', sturm_file_name
sturm_file = open(sturm_file_name,'w')
sturm_pts = cartesian_force_clean.p_list
print 'len(sturm_pts):', len(sturm_pts)
print 'len(pts_list):', len(pts_list)
for i,p in enumerate(sturm_pts[1:]):
sturm_file.write(" ".join(map(str,p)))
sturm_file.write('\n')
sturm_file.write('\n')
sturm_file.close()
rad_guess = rad
rad, cx, cy = fit_circle(rad_guess,x_guess,y_guess,pts_2d,
method='fmin_bfgs',verbose=False)
print 'rad, cx, cy:', rad, cx, cy
c_ts = np.matrix([cx, cy, 0.]).T
start_angle = tr.angle_within_mod180(math.atan2(pts_2d[1,0]-cy,
pts_2d[0,0]-cx) - math.pi/2)
end_angle = tr.angle_within_mod180(math.atan2(pts_2d[1,-1]-cy,
pts_2d[0,-1]-cx) - math.pi/2)
mpu.plot_circle(cx, cy, rad, start_angle, end_angle,
label='Actual\_opt', color='r')
if opt.icra_presentation_plot:
mpu.set_figure_size(30,20)
rad = 1.0
x_guess = pts_2d[0,0]
y_guess = pts_2d[1,0] - rad
rad_guess = rad
rad, cx, cy = fit_circle(rad_guess,x_guess,y_guess,pts_2d,
method='fmin_bfgs',verbose=False)
print 'Estimated rad, cx, cy:', rad, cx, cy
start_angle = tr.angle_within_mod180(math.atan2(pts_2d[1,0]-cy,
pts_2d[0,0]-cx) - math.pi/2)
end_angle = tr.angle_within_mod180(math.atan2(pts_2d[1,-1]-cy,
pts_2d[0,-1]-cx) - math.pi/2)
subsample_ratio = 1
pts_2d_s = pts_2d[:,::subsample_ratio]
cep_force_clean, force_new = filter_trajectory_force(eq_cartesian,
d['force'])
cep_2d = np.matrix(cep_force_clean.p_list).T[0:2,reject_idx:]
# first draw the entire CEP and end effector trajectories
mpu.figure()
mpu.plot_yx(pts_2d_s[1,:].A1, pts_2d_s[0,:].A1, color='b',
label = '\huge{End Effector Trajectory}', axis = 'equal', alpha = 1.0,
scatter_size=7, linewidth=0, marker='x',
marker_edge_width = 1.5)
cep_2d_s = cep_2d[:,::subsample_ratio]
mpu.plot_yx(cep_2d_s[1,:].A1, cep_2d_s[0,:].A1, color='g',
label = '\huge{Equilibrium Point Trajectory}', axis = 'equal', alpha = 1.0,
scatter_size=10, linewidth=0, marker='+',
marker_edge_width = 1.5)
mpu.plot_circle(cx, cy, rad, start_angle, end_angle,
label='\huge{Estimated Kinematics}', color='r',
alpha=0.7)
mpu.plot_radii(cx, cy, rad, start_angle, end_angle,
interval=end_angle-start_angle, color='r',
alpha=0.7)
mpu.legend()
fig_name = 'epc'
fig_number = 1
mpu.savefig(fig_name+'%d'%fig_number)
fig_number += 1
# now zoom in to a small region to show the force
# decomposition.
zoom_location = 10
pts_2d_zoom = pts_2d[:,:zoom_location]
cep_2d_zoom = cep_2d[:,:zoom_location]
# image_name = 'anim'
# for i in range(zoom_location):
# mpu.figure()
# mpu.plot_yx(pts_2d_zoom[1,:].A1, pts_2d_zoom[0,:].A1, color='w',
# axis = 'equal', alpha = 1.0)
# mpu.plot_yx(cep_2d_zoom[1,:].A1, cep_2d_zoom[0,:].A1, color='w',
# axis = 'equal', alpha = 1.0)
# mpu.plot_yx(pts_2d_zoom[1,:i+1].A1, pts_2d_zoom[0,:i+1].A1, color='b',
# label = '\huge{End Effector Trajectory}', axis = 'equal', alpha = 1.0,
# scatter_size=7, linewidth=0, marker='x',
# marker_edge_width = 1.5)
# mpu.plot_yx(cep_2d_zoom[1,:i+1].A1, cep_2d_zoom[0,:i+1].A1, color='g',
# label = '\huge{Equilibrium Point Trajectory}', axis = 'equal', alpha = 1.0,
# scatter_size=10, linewidth=0, marker='+',
# marker_edge_width = 1.5)
# mpu.pl.xlim(0.28, 0.47)
# mpu.legend()
# mpu.savefig(image_name+'%d.png'%(i+1))
mpu.figure()
mpu.plot_yx(pts_2d_zoom[1,:].A1, pts_2d_zoom[0,:].A1, color='b',
label = '\huge{End Effector Trajectory}', axis = 'equal', alpha = 1.0,
scatter_size=7, linewidth=0, marker='x',
marker_edge_width = 1.5)
mpu.plot_yx(cep_2d_zoom[1,:].A1, cep_2d_zoom[0,:].A1, color='g',
label = '\huge{Equilibrium Point Trajectory}', axis = 'equal', alpha = 1.0,
scatter_size=10, linewidth=0, marker='+',
marker_edge_width = 1.5)
mpu.pl.xlim(0.28, 0.47)
mpu.legend()
#mpu.savefig('two.png')
mpu.savefig(fig_name+'%d'%fig_number)
fig_number += 1
rad, cx, cy = fit_circle(1.0,x_guess,y_guess,pts_2d_zoom,
method='fmin_bfgs',verbose=False)
print 'Estimated rad, cx, cy:', rad, cx, cy
start_angle = tr.angle_within_mod180(math.atan2(pts_2d[1,0]-cy,
pts_2d[0,0]-cx) - math.pi/2)
end_angle = tr.angle_within_mod180(math.atan2(pts_2d_zoom[1,-1]-cy,
pts_2d_zoom[0,-1]-cx) - math.pi/2)
mpu.plot_circle(cx, cy, rad, start_angle, end_angle,
label='\huge{Estimated Kinematics}', color='r',
alpha=0.7)
mpu.pl.xlim(0.28, 0.47)
mpu.legend()
#mpu.savefig('three.png')
mpu.savefig(fig_name+'%d'%fig_number)
fig_number += 1
current_pos = pts_2d_zoom[:,-1]
radial_vec = current_pos - np.matrix([cx,cy]).T
radial_vec = radial_vec / np.linalg.norm(radial_vec)
tangential_vec = np.matrix([[0,-1],[1,0]]) * radial_vec
mpu.plot_quiver_yxv([pts_2d_zoom[1,-1]],
[pts_2d_zoom[0,-1]],
radial_vec, scale=10., width = 0.002)
rad_text_loc = pts_2d_zoom[:,-1] + np.matrix([0.001,0.01]).T
mpu.pl.text(rad_text_loc[0,0], rad_text_loc[1,0], '$\hat v_{rad}$', fontsize = 30)
mpu.plot_quiver_yxv([pts_2d_zoom[1,-1]],
[pts_2d_zoom[0,-1]],
tangential_vec, scale=10., width = 0.002)
tan_text_loc = pts_2d_zoom[:,-1] + np.matrix([-0.012, -0.011]).T
mpu.pl.text(tan_text_loc[0,0], tan_text_loc[1,0], s = '$\hat v_{tan}$', fontsize = 30)
mpu.pl.xlim(0.28, 0.47)
mpu.legend()
#mpu.savefig('four.png')
mpu.savefig(fig_name+'%d'%fig_number)
fig_number += 1
wrist_color = '#A0A000'
wrist_force = -np.matrix(force_new.f_list[zoom_location]).T
frad = (wrist_force[0:2,:].T * radial_vec)[0,0] * radial_vec
mpu.plot_quiver_yxv([pts_2d_zoom[1,-1]],
[pts_2d_zoom[0,-1]],
wrist_force, scale=50., width = 0.002,
color=wrist_color)
#color='y')
wf_text = rad_text_loc + np.matrix([-0.06,0.015]).T
mpu.pl.text(wf_text[0,0], wf_text[1,0], color=wrist_color,
fontsize = 25, s = 'Total Force')
mpu.plot_quiver_yxv([pts_2d_zoom[1,-1]],
[pts_2d_zoom[0,-1]],
frad, scale=50., width = 0.002,
color=wrist_color)
frad_text = rad_text_loc + np.matrix([0.,0.015]).T
mpu.pl.text(frad_text[0,0], frad_text[1,0], color=wrist_color, s = '$\hat F_{rad}$', fontsize = 30)
mpu.pl.xlim(0.28, 0.47)
mpu.legend()
#mpu.savefig('five.png')
mpu.savefig(fig_name+'%d'%fig_number)
fig_number += 1
frad = (wrist_force[0:2,:].T * radial_vec)[0,0]
hook_force_motion = -(frad - 5) * radial_vec * 0.001
tangential_motion = 0.01 * tangential_vec
total_cep_motion = hook_force_motion + tangential_motion
mpu.plot_quiver_yxv([cep_2d_zoom[1,-1]],
[cep_2d_zoom[0,-1]],
hook_force_motion, scale=0.1, width = 0.002)
hw_text = cep_2d_zoom[:,-1] + np.matrix([-0.002,-0.012]).T
mpu.pl.text(hw_text[0,0], hw_text[1,0], color='k', fontsize=20,
s = '$h[t]$')
mpu.pl.xlim(0.28, 0.47)
mpu.legend()
#mpu.savefig('six.png')
mpu.savefig(fig_name+'%d'%fig_number)
fig_number += 1
mpu.plot_quiver_yxv([cep_2d_zoom[1,-1]],
[cep_2d_zoom[0,-1]],
tangential_motion, scale=0.1, width = 0.002)
mw_text = cep_2d_zoom[:,-1] + np.matrix([-0.018,0.001]).T
mpu.pl.text(mw_text[0,0], mw_text[1,0], color='k', fontsize=20,
s = '$m[t]$')
mpu.pl.xlim(0.28, 0.47)
mpu.legend()
#mpu.savefig('seven.png')
mpu.savefig(fig_name+'%d'%fig_number)
fig_number += 1
mpu.plot_quiver_yxv([cep_2d_zoom[1,-1]],
[cep_2d_zoom[0,-1]],
total_cep_motion, scale=0.1, width = 0.002)
cep_text = cep_2d_zoom[:,-1] + np.matrix([-0.058,-0.023]).T
mpu.pl.text(cep_text[0,0], cep_text[1,0], color='k', fontsize=20,
s = '$x_{eq}[t]$ = &x_{eq}[t-1] + m[t] + h[t]$')
mpu.pl.xlim(0.28, 0.47)
mpu.legend()
#mpu.savefig('eight.png')
mpu.savefig(fig_name+'%d'%fig_number)
fig_number += 1
new_cep = cep_2d_zoom[:,-1] + total_cep_motion
mpu.plot_yx(new_cep[1,:].A1, new_cep[0,:].A1, color='g',
axis = 'equal', alpha = 1.0,
scatter_size=10, linewidth=0, marker='+',
marker_edge_width = 1.5)
mpu.pl.xlim(0.28, 0.47)
mpu.legend()
#mpu.savefig('nine.png')
mpu.savefig(fig_name+'%d'%fig_number)
fig_number += 1
mpu.show()
if xy_flag:
st_pt = pts_2d[:,0]
end_pt = pts_2d[:,-1]
if expt_plot:
pl.subplot(233)
plot_cartesian(actual_cartesian, xaxis=0, yaxis=1, color='b',
label='FK', plot_velocity=False)
plot_cartesian(eq_cartesian, xaxis=0,yaxis=1,color='g',label='Eq Point')
elif yz_flag:
plot_cartesian(actual_cartesian,xaxis=1,yaxis=2,color='b',label='FK')
plot_cartesian(eq_cartesian, xaxis=1,yaxis=2,color='g',label='Eq Point')
elif xz_flag:
plot_cartesian(actual_cartesian,xaxis=0,yaxis=2,color='b',label='FK')
plot_cartesian(eq_cartesian, xaxis=0,yaxis=2,color='g',label='Eq Point')
if plot_forces_flag or plot_forces_error_flag or plot_ellipses_flag or plot_force_components_flag or plot_force_field_flag:
# arm_stiffness_list = d['stiffness'].stiffness_list
# scale = d['stiffness'].stiffness_scale
# asl = [min(scale*s,1.0) for s in arm_stiffness_list]
# ftraj_jinv,ftraj_stiff,ftraj_torque,k_cart_list=compute_forces(d['actual'],d['eq_pt'],
# d['torque'],asl)
if plot_forces_flag:
plot_forces_quiver(actual_cartesian,d['force'],color='k')
#plot_forces_quiver(actual_cartesian,ftraj_jinv,color='y')
#plot_forces_quiver(actual_cartesian,ftraj_stiff,color='y')
if plot_ellipses_flag:
#plot_stiff_ellipses(k_cart_list,actual_cartesian)
if expt_plot:
subplotnum=234
else:
pl.figure()
subplotnum=111
plot_stiff_ellipses(k_cart_list,eq_cartesian,subplotnum=subplotnum)
if plot_forces_error_flag:
plot_error_forces(d['force'].f_list,ftraj_jinv.f_list)
#plot_error_forces(d['force'].f_list,ftraj_stiff.f_list)
if plot_force_components_flag:
p_list = actual_cartesian.p_list
#cx = 45.
#cy = -0.3
frad_list,ftan_list,_ = compute_radial_tangential_forces(d['force'].f_list,p_list,cx,cy)
#frad_list,ftan_list,_ = compute_radial_tangential_forces(d['force_raw'].f_list,p_list,cx,cy)
if expt_plot:
pl.subplot(235)
else:
pl.figure()
time_list = d['force'].time_list
time_list = [t-time_list[0] for t in time_list]
x_coord_list = np.matrix(p_list)[:,0].A1.tolist()
mpu.plot_yx(frad_list,x_coord_list,scatter_size=50,color=time_list,cb_label='time',axis=None)
pl.xlabel('x coord of end effector (m)')
pl.ylabel('magnitude of radial force (N)')
pl.title(d['info'])
if expt_plot:
pl.subplot(236)
else:
pl.figure()
mpu.plot_yx(ftan_list,x_coord_list,scatter_size=50,color=time_list,cb_label='time',axis=None)
pl.xlabel('x coord of end effector (m)')
pl.ylabel('magnitude of tangential force (N)')
pl.title(d['info'])
if plot_force_field_flag:
plot_stiffness_field(k_cart_list[0],plottitle='start')
plot_stiffness_field(k_cart_list[-1],plottitle='end')
str_parts = fname.split('.')
if d.has_key('strategy'):
addon = ''
if opt.xy:
addon = '_xy'
if opt.xz:
addon = '_xz'
fig_name = str_parts[0]+'_'+d['strategy']+addon+'.png'
else:
fig_name = str_parts[0]+'_res.png'
if expt_plot:
f = pl.gcf()
curr_size = f.get_size_inches()
f.set_size_inches(curr_size[0]*2,curr_size[1]*2)
f.savefig(fig_name)
if show_fig:
pl.show()
else:
print '################################'
print 'show_fig is FALSE'
if not(expt_plot):
pl.savefig(fig_name)
if xyz_flag:
plot_cartesian(traj, xaxis=0,yaxis=1,zaxis=2)
mlab.show()
#--------------------- OLD, maybe useful functions -------------------
### compute the force that the arm would apply given the stiffness matrix
## @param q_actual_traj - Joint Trajectory (actual angles.)
## @param q_eq_traj - Joint Trajectory (equilibrium point angles.)
## @param torque_traj - JointTrajectory (torques measured at the joints.)
## @param rel_stiffness_list - list of 5 elements (stiffness numbers for the joints.)
## @return lots of things, look at the code.
#def compute_forces(q_actual_traj,q_eq_traj,torque_traj,rel_stiffness_list):
# firenze = hr.M3HrlRobot(connect=False)
#
# d_gains_list_mN_deg_sec = [-100,-120,-15,-25,-1.25]
# d_gains_list = [180./1000.*s/math.pi for s in d_gains_list_mN_deg_sec]
#
# stiff_list_mNm_deg = [1800,1300,350,600,60]
# stiff_list_Nm_rad = [180./1000.*s/math.pi for s in stiff_list_mNm_deg]
## stiffness_settings = [0.15,0.7,0.8,0.8,0.8]
## dia = np.array(stiffness_settings) * np.array(stiff_list_Nm_rad)
# dia = np.array(rel_stiffness_list) * np.array(stiff_list_Nm_rad)
# k_q = np.matrix(np.diag(dia))
# dia_inv = 1./dia
# k_q_inv = np.matrix(np.diag(dia_inv))
#
# actual_cart = joint_to_cartesian(q_actual_traj)
# eq_cart = joint_to_cartesian(q_eq_traj)
# force_traj_jacinv = ForceTrajectory()
# force_traj_stiff = ForceTrajectory()
# force_traj_torque = ForceTrajectory()
#
# k_cart_list = []
#
# for q_actual,q_dot,q_eq,actual_pos,eq_pos,t,tau_m in zip(q_actual_traj.q_list,q_actual_traj.qdot_list,q_eq_traj.q_list,actual_cart.p_list,eq_cart.p_list,q_actual_traj.time_list,torque_traj.q_list):
# q_eq = firenze.clamp_to_physical_joint_limits('right_arm',q_eq)
# q_delta = np.matrix(q_actual).T - np.matrix(q_eq).T
# tau = k_q * q_delta[0:5,0] - np.matrix(np.array(d_gains_list)*np.array(q_dot)[0:5]).T
#
# x_delta = np.matrix(actual_pos).T - np.matrix(eq_pos).T
#
# jac_full = firenze.Jac('right_arm',q_actual)
# jac = jac_full[0:3,0:5]
#
# jac_full_eq = firenze.Jac('right_arm',q_eq)
# jac_eq = jac_full_eq[0:3,0:5]
# k_cart = np.linalg.inv((jac_eq*k_q_inv*jac_eq.T)) # calculating stiff matrix using Jacobian for eq pt.
# k_cart_list.append(k_cart)
#
# pseudo_inv_jac = np.linalg.inv(jac_full*jac_full.T)*jac_full
#
# tau_full = np.row_stack((tau,np.matrix(tau_m[5:7]).T))
# #force = (-1*pseudo_inv_jac*tau_full)[0:3]
# force = -1*pseudo_inv_jac[0:3,0:5]*tau
# force_traj_jacinv.f_list.append(force.A1.tolist())
# force_traj_stiff.f_list.append((k_cart*x_delta).A1.tolist())
# force_traj_torque.f_list.append((pseudo_inv_jac*np.matrix(tau_m).T)[0:3].A1.tolist())
#
# return force_traj_jacinv,force_traj_stiff,force_traj_torque,k_cart_list
### def plot_error_forces(measured_list,calc_list):
### err_x, err_y = [],[]
### err_rel_x, err_rel_y = [],[]
### mag_x, mag_y = [],[]
### for m,c in zip(measured_list,calc_list):
### err_x.append(abs(m[0]-c[0]))
### err_rel_x.append(abs(m[0]-c[0])/abs(m[0])*100)
### #err_rel_x.append(ut.bound(abs(m[0]-c[0])/abs(m[0])*100,100,0))
### mag_x.append(abs(m[0]))
### err_y.append(abs(m[1]-c[1]))
### err_rel_y.append(abs(m[1]-c[1])/abs(m[1])*100)
### #err_rel_y.append(ut.bound(abs(m[1]-c[1])/abs(m[1])*100,100,0))
### mag_y.append(abs(m[1]))
###
### x_idx = range(len(err_x))
### zero = [0 for i in x_idx]
###
### fig = pl.figure()
### ax1 = fig.add_subplot(111)
### ax2 = ax1.twinx()
###
### ax1.plot(zero,c='k',linewidth=1,label='_nolegend_')
### l1 = ax1.plot(err_x,c='b',linewidth=1,label='absolute error')
### ax1.scatter(x_idx,err_x,c='b',s=10,label='_nolegend_', linewidths=0)
### l2 = ax1.plot(mag_x,c='g',linewidth=1,label='magnitude')
### ax1.scatter(x_idx,mag_x,c='g',s=10,label='_nolegend_', linewidths=0)
### l3 = ax2.plot(err_rel_x,c='r',linewidth=1,label='relative error %')
###
### ax1.set_ylim(0,15)
### ax2.set_ylim(0,100)
### ax1.set_xlabel('measurement number')
### ax1.set_ylabel('x component of force (N)')
### ax2.set_ylabel('percentage error')
### ax1.yaxis.set_label_coords(-0.3,0.5)
### ax2.yaxis.set_label_coords(-0.3,0.5)
### leg = pl.legend([l1,l2,l3],['absolute error','magnitude','rel error %'],loc='upper left',
### handletextsep=0.015,handlelen=0.003,labelspacing=0.003)
###
### fig = pl.figure()
### ax1 = fig.add_subplot(111)
### ax2 = ax1.twinx()
###
### ax1.plot(zero,c='k',linewidth=1)
### l1 = ax1.plot(err_y,c='b',linewidth=1)
### ax1.scatter(x_idx,err_y,c='b',s=10, linewidths=0)
### l2 = ax1.plot(mag_y,c='g',linewidth=1)
### ax1.scatter(x_idx,mag_y,c='g',s=10,linewidths=0)
### l3 = ax2.plot(err_rel_y,c='r',linewidth=1)
###
### ax1.set_ylim(0,15)
### ax2.set_ylim(0,100)
### ax1.yaxis.set_label_coords(-0.3,0.5)
### ax2.yaxis.set_label_coords(-0.3,0.5)
### ax1.set_xlabel('measurement number')
### ax1.set_ylabel('y component of force (N)')
### ax2.set_ylabel('percentage error')
### #pl.legend(loc='best')
### leg = pl.legend([l1,l2,l3],['absolute error','magnitude','rel error %'],loc='upper left',
### handletextsep=0.015,handlelen=0.003,labelspacing=0.003)
###
### # pl.figure()
### # pl.plot(zero,c='k',linewidth=0.5,label='_nolegend_')
### # pl.plot(err_y,c='b',linewidth=1,label='error')
### # pl.plot(err_rel_y,c='r',linewidth=1,label='relative error %')
### # pl.scatter(x_idx,err_y,c='b',s=10,label='_nolegend_', linewidths=0)
### # pl.plot(mag_y,c='g',linewidth=1,label='magnitude')
### # pl.scatter(x_idx,mag_y,c='g',s=10,label='_nolegend_', linewidths=0)
### #
### # pl.xlabel('measurement number')
### # pl.ylabel('y component of force (N)')
### # pl.legend(loc='best')
### # pl.axis('equal')
###
###
### def plot_stiff_ellipses(k_cart_list,pos_traj,skip=10,subplotnum=111):
### import arm_trajectories as at
### if isinstance(pos_traj,at.JointTrajectory):
### pos_traj = joint_to_cartesian(pos_traj)
###
### pts = np.matrix(pos_traj.p_list).T
### x_l = pts[0,:].A1.tolist()
### y_l = pts[1,:].A1.tolist()
###
### from pylab import figure, show, rand
### from matplotlib.patches import Ellipse
###
### ells = []
### scale = 25000.
### ratio_list = []
### for k_c,x,y in zip(k_cart_list[::skip],x_l[::skip],y_l[::skip]):
### w,v = np.linalg.eig(k_c[0:2,0:2])
### w_abs = np.abs(w)
### major_axis = np.max(w_abs)
### minor_axis = np.min(w_abs)
### print 'major, minor:',major_axis,minor_axis
### # print 'k_c:', k_c
### ratio_list.append(major_axis/minor_axis)
###
### ells.append(Ellipse(np.array([x,y]),width=w[0]/scale,height=w[1]/scale,angle=math.degrees(math.atan2(v[1,0],v[0,0]))))
### ells[-1].set_lw(2)
###
### #fig = pl.figure()
### #ax = fig.add_subplot(111, aspect='equal')
### ax = pl.subplot(subplotnum, aspect='equal')
###
### for e in ells:
### ax.add_artist(e)
### #e.set_clip_box(ax.bbox)
### #e.set_alpha(1.)
### e.set_facecolor(np.array([1,1,1]))
###
### plot_cartesian(pos_traj,xaxis=0,yaxis=1,color='b',
### linewidth=0.0,scatter_size=0)
### # plot_cartesian(pos_traj,xaxis=0,yaxis=1,color='b',label='Eq Point',
### # linewidth=1.5,scatter_size=0)
### # plot_cartesian(d['actual'],xaxis=0,yaxis=1,color='b',label='FK',
### # linewidth=1.5,scatter_size=0)
### # plot_cartesian(d['eq_pt'], xaxis=0,yaxis=1,color='g',label='Eq Point',
### # linewidth=1.5,scatter_size=0)
###
### mean_ratio = np.mean(np.array(ratio_list))
### std_ratio = np.std(np.array(ratio_list))
###
### return mean_ratio,std_ratio
###
### # plot the force field in the xy plane for the stiffness matrix k_cart.
### ## @param k_cart: 3x3 cartesian space stiffness matrix.
### def plot_stiffness_field(k_cart,plottitle=''):
### n_points = 20
### ang_step = math.radians(360)/n_points
### x_list = []
### y_list = []
### u_list = []
### v_list = []
### k_cart = k_cart[0:2,0:2]
###
### for i in range(n_points):
### ang = i*ang_step
### for r in [0.5,1.,1.5]:
### dx = r*math.cos(ang)
### dy = r*math.sin(ang)
### dtau = -k_cart*np.matrix([dx,dy]).T
### x_list.append(dx)
### y_list.append(dy)
### u_list.append(dtau[0,0])
### v_list.append(dtau[1,0])
###
### pl.figure()
### # mpu.plot_circle(0,0,1.0,0.,math.radians(360))
### mpu.plot_radii(0,0,1.5,0.,math.radians(360),interval=ang_step,color='r')
### pl.quiver(x_list,y_list,u_list,v_list,width=0.002,color='k',scale=None)
### pl.axis('equal')
### pl.title(plottitle)
###
### def plot_stiff_ellipse_map(stiffness_list,num):
### firenze = hr.M3HrlRobot(connect=False)
### hook_3dprint_angle = math.radians(20-2.54)
### rot_mat = tr.Rz(0.-hook_3dprint_angle)*tr.Ry(math.radians(-90))
###
### d_gains_list_mN_deg_sec = [-100,-120,-15,-25,-1.25]
### d_gains_list = [180./1000.*s/math.pi for s in d_gains_list_mN_deg_sec]
###
### stiff_list_mNm_deg = [1800,1300,350,600,60]
### stiff_list_Nm_rad = [180./1000.*s/math.pi for s in stiff_list_mNm_deg]
### dia = np.array(stiffness_list) * np.array(stiff_list_Nm_rad)
### k_q = np.matrix(np.diag(dia))
### dia_inv = 1./dia
### k_q_inv = np.matrix(np.diag(dia_inv))
###
### s0,s1,s2,s3 = stiffness_list[0],stiffness_list[1],stiffness_list[2],stiffness_list[3]
###
### i=0
### #for z in np.arange(-0.1,-0.36,-0.05):
### for z in np.arange(-0.23,-0.27,-0.05):
### pl.figure()
### k_cart_list = []
### pos_traj = CartesianTajectory()
### for x in np.arange(0.25,0.56,0.05):
### for y in np.arange(-0.15,-0.56,-0.05):
### if math.sqrt(x**2+y**2)>0.55:
### continue
### q = firenze.IK('right_arm',np.matrix([x,y,z]).T,rot_mat)
### if q == None:
### continue
### jac_full = firenze.Jac('right_arm',q)
### jac = jac_full[0:3,0:5]
### k_cart = np.linalg.inv((jac*k_q_inv*jac.T))
### k_cart_list.append(k_cart)
### pos_traj.p_list.append([x,y,z])
### pos_traj.time_list.append(0.1)
### if len(pos_traj.p_list)>0:
### ret = plot_stiff_ellipses(k_cart_list,pos_traj,skip=1)
### pl.axis('equal')
### pl.legend(loc='best')
### title_string = 'z: %.2f stiff:[%.1f,%.1f,%.1f,%.1f]'%(z,s0,s1,s2,s3)
### pl.title(title_string)
### i+=1
### pl.savefig('ellipses_%03d_%03d.png'%(num,i))
###
### return ret
###
### def diff_roll_angles():
### pl.subplot(211,aspect='equal')
| [
[
1,
0,
0.0017,
0.0009,
0,
0.66,
0,
359,
0,
1,
0,
0,
359,
0,
0
],
[
1,
0,
0.0035,
0.0009,
0,
0.66,
0.0333,
526,
0,
2,
0,
0,
526,
0,
0
],
[
1,
0,
0.0044,
0.0009,
0,
... | [
"import scipy.optimize as so",
"import math, numpy as np",
"import pylab as pl",
"import sys, optparse, time",
"import copy",
"from enthought.mayavi import mlab",
"import roslib; roslib.load_manifest('doors_forces_kinematics')",
"import roslib; roslib.load_manifest('doors_forces_kinematics')",
"rosl... |
import scipy.optimize as so
import matplotlib.pyplot as pp
import matplotlib_util.util as mpu
import numpy as np, math
import sys, os, time
sys.path.append(os.environ['HRLBASEPATH']+'/src/projects/modeling_forces/handheld_hook')
import ram_db as rd
import mechanism_analyse_RAM as mar
import mechanism_analyse_advait as maa
import arm_trajectories as at
import tangential_force_monitor as tfm
import roslib; roslib.load_manifest('equilibrium_point_control')
import hrl_lib.util as ut, hrl_lib.transforms as tr
## assuming that the mechnism is rotary.
# @return r, cx, cy
def estimate_mechanism_kinematics(pull_dict, pr2_log):
if not pr2_log:
act_tl = at.joint_to_cartesian(pull_dict['actual'], pull_dict['arm'])
force_tl = pull_dict['force']
actual_cartesian, force_ts = at.account_segway_motion(act_tl,
force_tl, pull_dict['segway'])
cartesian_force_clean, _ = at.filter_trajectory_force(actual_cartesian,
pull_dict['force'])
pts_list = actual_cartesian.p_list
pts_2d, reject_idx = at.filter_cartesian_trajectory(cartesian_force_clean)
else:
# not performing force filtering for PR2 trajectories.
# might have to add that in later.
p_list, f_list = pull_dict['ee_list'], pull_dict['f_list']
p_list = p_list[::2]
f_list = f_list[::2]
pts = np.matrix(p_list).T
px = pts[0,:].A1
py = pts[1,:].A1
pts_2d = np.matrix(np.row_stack((px, py)))
#rad = 0.4
rad = 1.1
x_guess = pts_2d[0,0]
y_guess = pts_2d[1,0] - rad
rad_guess = rad
rad, cx, cy = at.fit_circle(rad_guess,x_guess,y_guess,pts_2d,
method='fmin_bfgs',verbose=False,
rad_fix=False)
#rad, cx, cy = rad_guess, x_guess, y_guess
return rad, cx, cy
def force_trajectory_in_hindsight(pull_dict, mechanism_type, pr2_log):
print '_________________________________________________'
print 'starting force_trajectory_in_hindsight'
print '_________________________________________________'
if not pr2_log:
arm = pull_dict['arm']
act_tl = at.joint_to_cartesian(pull_dict['actual'], arm)
force_tl = pull_dict['force']
actual_cartesian, force_ts = at.account_segway_motion(act_tl,
force_tl, pull_dict['segway'])
p_list = actual_cartesian.p_list
f_list = force_ts.f_list
else:
p_list, f_list = pull_dict['ee_list'], pull_dict['f_list']
p_list = p_list[::2]
f_list = f_list[::2]
if mechanism_type == 'rotary':
r, cx, cy = estimate_mechanism_kinematics(pull_dict, pr2_log)
print 'rad, cx, cy:', r, cx, cy
frad_list,ftan_list,_ = at.compute_radial_tangential_forces(f_list,
p_list,cx,cy)
p0 = p_list[0]
rad_vec_init = np.matrix((p0[0]-cx, p0[1]-cy)).T
rad_vec_init = rad_vec_init / np.linalg.norm(rad_vec_init)
config_list = []
for p in p_list:
rvec = np.matrix((p[0]-cx, p[1]-cy)).T
rvec = rvec / np.linalg.norm(rvec)
ang = np.arccos((rvec.T*rad_vec_init)[0,0])
if np.isnan(ang):
ang = 0
config_list.append(ang)
else:
p0 = p_list[0]
ftan_list, config_list = [], []
for f, p in zip(f_list, p_list):
config_list.append(p0[0] - p[0])
ftan_list.append(abs(f[0]))
return config_list, ftan_list
def online_force_with_radius(pull_dict, pr2_log, radius_err = 0.,
with_prior = True):
if not pr2_log:
act_tl = at.joint_to_cartesian(pull_dict['actual'], pull_dict['arm'])
force_tl = pull_dict['force']
actual_cartesian, force_ts = at.account_segway_motion(act_tl,
force_tl, pull_dict['segway'])
p_list = actual_cartesian.p_list
f_list = force_ts.f_list
else:
p_list, f_list = pull_dict['ee_list'], pull_dict['f_list']
p_list = p_list[::2]
f_list = f_list[::2]
radius, _, _ = estimate_mechanism_kinematics(pull_dict, pr2_log)
radius += radius_err
print '_________________________________________________'
print 'using radius:', radius
print '_________________________________________________'
pts_list = []
ftan_list = []
config_list = []
for f,p in zip(f_list, p_list):
pts_list.append(p)
pts_2d = (np.matrix(pts_list).T)[0:2,:]
x_guess = pts_list[0][0]
y_guess = pts_list[0][1] - radius
rad_guess = radius
if with_prior:
rad, cx, cy = at.fit_circle_priors(rad_guess, x_guess,
y_guess, pts_2d, sigma_r = 0.2, sigma_xy = 0.2,
sigma_pts = 0.01, verbose=False)
else:
rad, cx, cy = at.fit_circle(rad_guess,x_guess,y_guess,pts_2d,
method='fmin_bfgs',verbose=False,
rad_fix=True)
print 'rad, cx, cy:', rad, cx, cy
p0 = p_list[0]
rad_vec_init = np.matrix((p0[0]-cx, p0[1]-cy)).T
rad_vec_init = rad_vec_init / np.linalg.norm(rad_vec_init)
rad_vec = np.array([p[0]-cx,p[1]-cy])
rad_vec = rad_vec/np.linalg.norm(rad_vec)
ang = np.arccos((rad_vec.T*rad_vec_init)[0,0])
config_list.append(ang)
tan_vec = (np.matrix([[0,-1],[1,0]]) * np.matrix(rad_vec).T).A1
f_vec = np.array([f[0],f[1]])
f_tan_mag = abs(np.dot(f_vec, tan_vec))
ftan_list.append(f_tan_mag)
return config_list, ftan_list
def load_ref_traj(nm):
if 'kitchen_cabinet' in nm:
#has_tags = ['HSI_kitchen_cabinet_left']
has_tags = ['HSI_kitchen_cabinet_right']
elif 'lab_cabinet_recessed_left' in nm:
has_tags = ['HSI_lab_cabinet_recessed_left']
elif 'lab_cabinet_recessed_right' in nm:
has_tags = ['HRL_lab_cabinet_recessed_right']
elif 'spring_loaded_door' in nm:
has_tags = ['HSI_Glass_Door']
elif 'hrl_toolchest' in nm:
has_tags = ['HRL_toolchest_drawer_empty']
elif 'ikea_cabinet' in nm:
has_tags = ['HSI_kitchen_cabinet_right']
#has_tags[rd.o, rd.c]
elif 'refrigerator' in nm:
has_tags = ['naveen_refrigerator']
#has_tags = [rd.r]
else:
#has_tags = [rd.r]
return None
mn, std, config, typ = rd.get_mean_std_config(has_tags)
return mn, std, config, typ
def error_lists(ftan_l, config_l, ref_dict):
# matching the dict expected in tangential_force_monitor.py
ref_force_dict = {}
ref_force_dict['tangential'] = ref_dict['mean']
ref_force_dict['configuration'] = ref_dict['config']
ref_force_dict['type'] = ref_dict['typ']
ref_force_dict['name'] = ref_dict['name']
rel_err_list = []
abs_err_list = []
for f,c in zip(ftan_l, config_l):
hi, lo, ref_hi, ref_lo = tfm.error_from_reference(ref_force_dict, f, c)
# if ref_hi < 5.:
# # only consider configs where ref force is greater than 3N
# continue
if lo > hi:
err = -lo
ref = ref_lo
else:
err = hi
ref = ref_hi
if ref == 0:
continue
# if abs(err) < 3.:
# continue
rel_err_list.append(err/ref)
abs_err_list.append(err)
return rel_err_list, abs_err_list
def plot_err_histogram(rel_list, abs_list, title):
# plot relative error histogram.
max_err = 1.0
bin_width = 0.05 # relative err.
bins = np.arange(0.-bin_width/2.-max_err, max_err+2*bin_width, bin_width)
hist, bin_edges = np.histogram(np.array(rel_list), bins)
mpu.figure()
mpu.plot_histogram(bin_edges[:-1]+bin_width/2., hist,
width=bin_width*0.8, xlabel='Relative Error',
plot_title=title)
# plot relative error histogram.
max_err = 20
bin_width = 2 # relative err.
bins = np.arange(0.-bin_width/2.-max_err, max_err+2*bin_width, bin_width)
hist, bin_edges = np.histogram(np.array(abs_list), bins)
mpu.figure()
mpu.plot_histogram(bin_edges[:-1]+bin_width/2., hist,
width=bin_width*0.8, xlabel='Absolute Error',
plot_title=title)
def truncate_to_config(ftan_l, config_l, config):
idxs = np.where(np.array(config_l)<config)[0]
idx = idxs[-1]
return ftan_l[:idx+1], config_l[:idx+1]
def plot_pkl(pkl_nm):
pull_dict = ut.load_pickle(pkl_nm)
if 'pr2' in pkl_nm:
pr2_log = True
h_color = 'y'
else:
pr2_log = False
h_color = 'r'
t = load_ref_traj(pkl_nm)
if t !=None:
ref_mean, ref_std, ref_config, typ = t
mar.plot_reference_trajectory(ref_config, ref_mean, ref_std, typ, 'Hello')
ref_config = np.degrees(ref_config)
max_config = np.max(ref_config)
else:
typ = 'rotary'
max_config = 60.
if pr2_log:
o_ftan = pull_dict['ftan_list']
o_config = pull_dict['config_list']
else:
o_ftan = pull_dict['online_ftan']
o_config = pull_dict['online_ang']
h_config, h_ftan = force_trajectory_in_hindsight(pull_dict,
typ, pr2_log)
if typ == 'rotary':
if opt.prior:
r_config, r_ftan = online_force_with_radius(pull_dict,
pr2_log)
r_config = np.degrees(r_config)
o_config = np.degrees(o_config)
h_config = np.degrees(h_config)
o_ftan, o_config = truncate_to_config(o_ftan, o_config, max_config)
h_ftan, h_config = truncate_to_config(h_ftan, h_config, max_config)
if typ == 'rotary':
if opt.prior:
r_ftan, r_config = truncate_to_config(r_ftan, r_config, max_config)
bin_size = 1.
else:
bin_size = 0.01
#o_config, o_ftan = maa.bin(o_config, o_ftan, bin_size, np.mean, True)
#h_config, h_ftan = maa.bin(h_config, h_ftan, bin_size, np.mean, True)
# non_nans = ~np.isnan(h_ftan)
# h_ftan = np.array(h_ftan)[non_nans]
# h_config = np.array(h_config)[non_nans]
#
# non_nans = ~np.isnan(o_ftan)
# o_ftan = np.array(o_ftan)[non_nans]
# o_config = np.array(o_config)[non_nans]
# h_config = h_config[:-1]
# h_ftan = h_ftan[1:]
if not pr2_log:
m,c = get_cody_calibration()
o_ftan = (np.array(o_ftan) - c) / m
h_ftan = (np.array(h_ftan) - c) / m
pp.plot(o_config, o_ftan, 'bo-', ms=5, label='online')
pp.plot(h_config, h_ftan, h_color+'o-', ms=5, label='hindsight')
if typ == 'rotary':
if opt.prior:
r_config, r_ftan = maa.bin(r_config, r_ftan, bin_size, max, True)
pp.plot(r_config, r_ftan, 'go-', ms=5, label='online with priors')
pp.xlabel('Configuration')
pp.ylabel('Tangential Force')
if pr2_log:
pp.figure()
p_list, f_list = pull_dict['ee_list'], pull_dict['f_list']
p_list = p_list[::2]
f_list = f_list[::2]
x_l, y_l, z_l = zip(*p_list)
pp.plot(x_l, y_l)
r, cx, cy = estimate_mechanism_kinematics(pull_dict, pr2_log)
mpu.plot_circle(cx, cy, r, 0., math.pi/2,
label='Actual\_opt', color='r')
pp.axis('equal')
def compute_mean_std(pkls, bin_size):
c_list = []
f_list = []
max_config = math.radians(100.)
typ = 'rotary'
for pkl_nm in pkls:
pull_dict = ut.load_pickle(pkl_nm)
pr2_log = 'pr2' in pkl_nm
h_config, h_ftan = force_trajectory_in_hindsight(pull_dict,
typ, pr2_log)
#h_config, h_ftan = online_force_with_radius(pull_dict, pr2_log)
c_list.append(h_config)
f_list.append(h_ftan)
max_config = min(max_config, np.max(h_config))
leng = int (max_config / bin_size) - 1
ff = []
for c, f in zip(c_list, f_list):
#c, f = maa.bin(c, f, bin_size, max, True)
c, f = maa.bin(c, f, bin_size, np.mean, False, empty_value = np.nan)
f, c = truncate_to_config(f, c, max_config)
f = np.ma.masked_array(f, np.isnan(f))
f = f[:leng]
c = c[:leng]
ff.append(f)
arr = np.array(ff)
mean = arr.mean(0)
std = arr.std(0)
return mean, std, c, arr
def calibrate_least_squares(ref_mean, sensor_mean):
ref_mean = np.array(ref_mean)
length = min(ref_mean.shape[0], sensor_mean.shape[0])
ref_mean = ref_mean[:length]
sensor_mean = sensor_mean[:length]
def error_function(params):
m, c = params[0], params[1]
sensor_predict = m * ref_mean + c
err = (sensor_predict - sensor_mean)
return np.sum((err * err) * np.abs(ref_mean))
#return np.sum(err * err)
params = [1., 0.]
r = so.fmin_bfgs(error_function, params, full_output=1,
disp = False, gtol=1e-5)
print 'Optimization result:', r[0]
def get_cody_calibration():
m = 1.13769405
c = 2.22946475
# sensor = m * ref + c
m, c = 1., 0.
return m, c
def convert_to_ram_db(pkls, name):
if pkls == []:
return
bin_size = math.radians(1.)
mean, std, c, arr = compute_mean_std(pkls, bin_size)
d = {}
d['std'] = std
d['mean'] = mean
d['rad'] = -3.141592
d['name'] = name
d['config'] = c
d['vec_list'] = arr.tolist()
d['typ'] = 'rotary'
ut.save_pickle(d, name+'.pkl')
def simulate_perception(pkls, percep_std, name):
c_list = []
f_list = []
trials_per_pkl = 5
bin_size = math.radians(1.)
max_config = math.radians(100.)
for pkl_nm in pkls:
pull_dict = ut.load_pickle(pkl_nm)
pr2_log = 'pr2' in pkl_nm
for t in range(trials_per_pkl):
radius_err = np.random.normal(scale=percep_std)
#radius_err = np.random.uniform(-percep_std, percep_std)
h_config, h_ftan = online_force_with_radius(pull_dict, pr2_log, radius_err)
c_list.append(h_config)
f_list.append(h_ftan)
max_config = min(max_config, np.max(h_config))
leng = int (max_config / bin_size) - 1
ff = []
for c, f in zip(c_list, f_list):
c, f = maa.bin(c, f, bin_size, np.mean, False, empty_value = np.nan)
f, c = truncate_to_config(f, c, max_config)
f = np.ma.masked_array(f, np.isnan(f))
f = f[:leng]
c = c[:leng]
ff.append(f)
arr = np.array(ff)
mean = arr.mean(0)
std = arr.std(0)
d = {}
d['std'] = std
d['mean'] = mean
d['rad'] = -3.141592
d['name'] = name
d['config'] = c
d['vec_list'] = arr.tolist()
d['typ'] = 'rotary'
ut.save_pickle(d, name+'.pkl')
def known_radius(pkls, name):
c_list = []
f_list = []
trials_per_pkl = 1
bin_size = math.radians(1.)
max_config = math.radians(100.)
for pkl_nm in pkls:
pull_dict = ut.load_pickle(pkl_nm)
pr2_log = 'pr2' in pkl_nm
for t in range(trials_per_pkl):
h_config, h_ftan = online_force_with_radius(pull_dict,
pr2_log, with_prior = False)
c_list.append(h_config)
f_list.append(h_ftan)
max_config = min(max_config, np.max(h_config))
leng = int (max_config / bin_size) - 1
ff = []
for c, f in zip(c_list, f_list):
c, f = maa.bin(c, f, bin_size, np.mean, False, empty_value = np.nan)
f, c = truncate_to_config(f, c, max_config)
f = np.ma.masked_array(f, np.isnan(f))
f = f[:leng]
c = c[:leng]
ff.append(f)
arr = np.array(ff)
mean = arr.mean(0)
std = arr.std(0)
d = {}
d['std'] = std
d['mean'] = mean
d['rad'] = -3.141592
d['name'] = name
d['config'] = c
d['vec_list'] = arr.tolist()
d['typ'] = 'rotary'
ut.save_pickle(d, name+'.pkl')
if __name__ == '__main__':
import optparse
import glob
p = optparse.OptionParser()
p.add_option('-d', action='store', type='string', dest='dir_nm',
help='plot all the pkls in the directory.', default='')
p.add_option('-f', action='store', type='string', dest='fname',
help='pkl file to use.', default='')
p.add_option('--prior', action='store_true', dest='prior',
help='estimate tangential force using prior.')
p.add_option('--calibrate', action='store_true', dest='calibrate',
help='calibrate the sensor using the ref trajectory.')
p.add_option('--ram_db', action='store_true', dest='ram_db',
help='convert trials to ram_db format.')
p.add_option('--nm', action='store', dest='name', default='',
help='name for the ram_db dict.')
p.add_option('--simulate_percep', action='store_true', dest='simulate_percep',
help='simulate perception.')
opt, args = p.parse_args()
if opt.calibrate:
pkls_nm = glob.glob(opt.dir_nm+'/*pull*.pkl')
ref_mean, ref_std, ref_config, typ = load_ref_traj(pkls_nm[0])
cody_pkls = glob.glob(opt.dir_nm+'/*trajector*.pkl')
cody_mn, cody_std, cody_config, _ = compute_mean_std(cody_pkls, math.radians(1.))
calibrate_least_squares(ref_mean, cody_mn)
sys.exit()
if opt.simulate_percep:
percep_std = 0.1
if opt.name == '':
name = opt.dir_nm.split('/')[0]
else:
name = opt.name
cody_pkls = glob.glob(opt.dir_nm+'/*trajector*.pkl')
if cody_pkls != []:
simulate_perception(cody_pkls, percep_std, name+'_noisy_cody')
known_radius(cody_pkls, name+'_known_rad_cody')
pr2_pkls = glob.glob(opt.dir_nm+'/pr2*.pkl')
if pr2_pkls != []:
simulate_perception(pr2_pkls, percep_std, name+'_noisy_pr2')
known_radius(pr2_pkls, name+'_known_rad_pr2')
sys.exit()
if opt.ram_db:
if opt.name == '':
name = opt.dir_nm.split('/')[0]
else:
name = opt.name
cody_pkls = glob.glob(opt.dir_nm+'/*trajector*.pkl')
convert_to_ram_db(cody_pkls, name+'_cody')
pr2_pkls = glob.glob(opt.dir_nm+'/pr2*.pkl')
convert_to_ram_db(pr2_pkls, name+'_pr2')
sys.exit()
if opt.dir_nm != '':
pkls_nm = glob.glob(opt.dir_nm+'/*pull*.pkl')
pp.figure()
ref_mean, ref_std, ref_config, typ = load_ref_traj(pkls_nm[0])
mar.plot_reference_trajectory(ref_config, ref_mean, ref_std, typ, 'Hello')
pr2_pkls = glob.glob(opt.dir_nm+'/pr2*.pkl')
if pr2_pkls != []:
pr2_mn, pr2_std, pr2_config, _ = compute_mean_std(pr2_pkls, math.radians(1.))
c1 = 'b'
pr2_config = np.degrees(pr2_config)
pp.plot(pr2_config, pr2_mn, color=c1, label='PR2')
pp.fill_between(pr2_config, np.array(pr2_mn)+np.array(pr2_std),
np.array(pr2_mn)-np.array(pr2_std), color=c1, alpha=0.5)
cody_pkls = glob.glob(opt.dir_nm+'/*trajector*.pkl')
if cody_pkls != []:
cody_mn, cody_std, cody_config, _ = compute_mean_std(cody_pkls, math.radians(1.))
m,c = get_cody_calibration()
cody_mn = (cody_mn - c) / m
cody_mn = cody_mn[1:]
cody_std = cody_std[1:]
cody_config = cody_config[:-1]
c1 = 'r'
cody_config = np.degrees(cody_config)
pp.plot(cody_config, cody_mn, color=c1, label='Cody')
pp.fill_between(cody_config, np.array(cody_mn)+np.array(cody_std),
np.array(cody_mn)-np.array(cody_std), color=c1, alpha=0.5)
pp.legend()
pp.show()
if opt.fname:
plot_pkl(opt.fname)
pp.legend()
pp.show()
| [
[
1,
0,
0.0035,
0.0018,
0,
0.66,
0,
359,
0,
1,
0,
0,
359,
0,
0
],
[
1,
0,
0.0053,
0.0018,
0,
0.66,
0.0357,
596,
0,
1,
0,
0,
596,
0,
0
],
[
1,
0,
0.007,
0.0018,
0,
0... | [
"import scipy.optimize as so",
"import matplotlib.pyplot as pp",
"import matplotlib_util.util as mpu",
"import numpy as np, math",
"import sys, os, time",
"sys.path.append(os.environ['HRLBASEPATH']+'/src/projects/modeling_forces/handheld_hook')",
"import ram_db as rd",
"import mechanism_analyse_RAM as... |
#! /usr/bin/python
import roslib; roslib.load_manifest('hrl_pr2_lib')
import rospy
import tf.transformations as tr
import hrl_lib.tf_utils as tfu
import hrl_lib.util as ut
import tf
import geometry_msgs.msg as gm
import sys
import math
import numpy as np
import actionlib
import hrl_pr2_lib.msg as hm
class MoveBase:
def __init__(self):
rospy.init_node('odom_move_base')
self.tw_pub = rospy.Publisher('base_controller/command', gm.Twist)
#rospy.Subscriber('simple_move_base', gm.Pose2D, self.pose2d_cb)
self.tl = tf.TransformListener()
self.go_xy_server = actionlib.SimpleActionServer('go_xy', hm.GoXYAction, self._go_xy_cb, auto_start=True)
self.go_ang_server = actionlib.SimpleActionServer('go_angle', hm.GoAngleAction, self._go_ang_cb, auto_start=True)
def _go_xy_cb(self, goal):
rospy.loginfo('received go_xy goal %f %f' % (goal.x, goal.y))
def send_feed_back(error):
feed_back_msg = hm.GoXYFeedback()
feed_back_msg.error = np.linalg.norm(error)
self.go_xy_server.publish_feedback(feed_back_msg)
error = self.go_xy(np.matrix([goal.x, goal.y]).T, func=send_feed_back)
result = hm.GoXYResult()
result.error = np.linalg.norm(error)
self.go_xy_server.set_succeeded(result)
def _go_ang_cb(self, goal):
rospy.loginfo('received go_angle goal %f' % (goal.angle))
def send_feed_back(error):
feed_back_msg = hm.GoAngleFeedback()
feed_back_msg.error = error
self.go_ang_server.publish_feedback(feed_back_msg)
error = self.go_angle(goal.angle, func=send_feed_back)
result = hm.GoAngleResult()
result.error = error
self.go_ang_server.set_succeeded(result)
def go_xy(self, target_base, tolerance=.01, max_speed=.1, func=None):
k = 2.
self.tl.waitForTransform('base_footprint', 'odom_combined', rospy.Time(), rospy.Duration(10))
rate = rospy.Rate(100)
od_T_bf = tfu.transform('odom_combined', 'base_footprint', self.tl)
target_odom = (od_T_bf * np.row_stack([target_base, np.matrix([0,1.]).T]))[0:2,0]
#print 'target base', target_base.T
#print 'target odom', target_odom.T
while not rospy.is_shutdown():
robot_odom = np.matrix(tfu.transform('odom_combined', 'base_footprint', self.tl)[0:2,3])
#rospy.loginfo('odom %s' % str(robot_odom.T))
diff_odom = target_odom - robot_odom
mag = np.linalg.norm(diff_odom)
#rospy.loginfo('error %s' % str(mag))
if func != None:
func(diff_odom)
if mag < tolerance:
break
direc = diff_odom / mag
speed = min(mag * k, max_speed)
vel_odom = direc * speed
#vel_odom = direc * mag * k
#print mag*k, max_speed, speed
bf_T_odom = tfu.transform('base_footprint', 'odom_combined', self.tl)
vel_base = bf_T_odom * np.row_stack([vel_odom, np.matrix([0,0.]).T])
#pdb.set_trace()
#rospy.loginfo('vel_base %f %f' % (vel_base[0,0], vel_base[1,0]))
tw = gm.Twist()
tw.linear.x = vel_base[0,0]
tw.linear.y = vel_base[1,0]
#rospy.loginfo('commanded %s' % str(tw))
self.tw_pub.publish(tw)
rate.sleep()
rospy.loginfo('finished go_xy %f' % np.linalg.norm(diff_odom))
return diff_odom
##
# delta angle
def go_angle(self, target_odom, tolerance=math.radians(5.), max_ang_vel=math.radians(20.), func=None):
self.tl.waitForTransform('base_footprint', 'odom_combined', rospy.Time(), rospy.Duration(10))
rate = rospy.Rate(100)
k = math.radians(80)
#current_ang_odom = tr.euler_from_matrix(tfu.transform('base_footprint', 'odom_combined', self.tl)[0:3, 0:3], 'sxyz')[2]
#target_odom = current_ang_odom + delta_ang
while not rospy.is_shutdown():
robot_odom = tfu.transform('base_footprint', 'odom_combined', self.tl)
current_ang_odom = tr.euler_from_matrix(robot_odom[0:3, 0:3], 'sxyz')[2]
diff = ut.standard_rad(current_ang_odom - target_odom)
p = k * diff
#print diff
if func != None:
func(diff)
if np.abs(diff) < tolerance:
break
tw = gm.Twist()
vels = [p, np.sign(p) * max_ang_vel]
tw.angular.z = vels[np.argmin(np.abs(vels))]
#rospy.loginfo('diff %.3f vel %.3f' % (math.degrees(diff), math.degrees(tw.angular.z)))
self.tw_pub.publish(tw)
#rospy.loginfo('commanded %s' % str(tw))
rate.sleep()
rospy.loginfo('finished %.3f' % math.degrees(diff))
return diff
#def pose2d_cb(self, msg):
# if msg.x != 0:
# rospy.loginfo('go x called')
# self.go_x(msg.x, msg.y)
# elif msg.theta != 0:
# rospy.loginfo('go theta called')
# self.go_ang(msg.theta)
#def go_ang(self, ang, speed):
# dt = math.radians(ang)
# if dt > 0:
# sign = -1
# elif dt < 0:
# sign = 1
# else:
# sign = 0
# self.tl.waitForTransform('base_footprint', 'odom_combined', rospy.Time(), rospy.Duration(10))
# p0_base = tfu.transform('base_footprint', 'odom_combined', self.tl)# \
# start_ang = tr.euler_from_matrix(p0_base[0:3, 0:3], 'sxyz')[2]
# r = rospy.Rate(100)
# dist_so_far = 0.
# last_ang = start_ang
# while not rospy.is_shutdown():
# pcurrent_base = tfu.transform('base_footprint', 'odom_combined', self.tl) #\
# current_ang = tr.euler_from_matrix(pcurrent_base[0:3, 0:3], 'sxyz')[2]
# #relative_trans = np.linalg.inv(p0_base) * pcurrent_base
# #relative_ang = math.degrees(tr.euler_from_matrix(relative_trans[0:3, 0:3], 'sxyz')[2])
# dist_so_far = dist_so_far + (ut.standard_rad(current_ang - last_ang))
# #print 'dist_so_far %.3f dt %.3f diff %.3f' % (dist_so_far, dt, ut.standard_rad(current_ang - last_ang))
# if dt > 0 and dist_so_far > dt:
# rospy.loginfo('stopped! %f %f' % (dist_so_far, dt))
# break
# elif dt < 0 and dist_so_far < dt:
# rospy.loginfo('stopped! %f %f' % (dist_so_far, dt))
# break
# elif dt == 0:
# rospy.loginfo('stopped! %f %f' % (dist_so_far, dt))
# break
# tw = gm.Twist()
# tw.linear.x = 0
# tw.linear.y = 0
# tw.linear.z = 0
# tw.angular.x = 0
# tw.angular.y = 0#0#math.radians(10)
# tw.angular.z = math.radians(speed * sign)
# self.tw_pub.publish(tw)
# r.sleep()
# last_ang = current_ang
#def go_x(self, x, speed):
# vel = speed * np.sign(x)
# self.tl.waitForTransform('base_footprint', 'odom_combined', rospy.Time(), rospy.Duration(10))
# p0_base = tfu.transform('base_footprint', 'odom_combined', self.tl)
# r = rospy.Rate(100)
# while not rospy.is_shutdown():
# pcurrent_base = tfu.transform('base_footprint', 'odom_combined', self.tl)
# relative_trans = np.linalg.inv(p0_base) * pcurrent_base
# dist_moved = np.linalg.norm(relative_trans[0:3,3])
# print "%s" % str(dist_moved)
#
# if dist_moved > np.abs(x):
# rospy.loginfo('stopped! error %f' % (np.abs(dist_moved-np.abs(x))))
# break
# tw = gm.Twist()
# tw.linear.x = vel
# tw.linear.y = 0
# tw.linear.z = 0
# tw.angular.x = 0
# tw.angular.y = 0
# tw.angular.z = 0
# self.tw_pub.publish(tw)
# r.sleep()
if __name__ == '__main__':
m = MoveBase()
rospy.loginfo('simple move base server up!')
rospy.spin()
#m.go_ang(-390, 100)
#m.go_x(.2, .05)
| [
[
1,
0,
0.0093,
0.0047,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.0093,
0.0047,
0,
0.66,
0.0714,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.014,
0.0047,
0,
0.6... | [
"import roslib; roslib.load_manifest('hrl_pr2_lib')",
"import roslib; roslib.load_manifest('hrl_pr2_lib')",
"import rospy",
"import tf.transformations as tr",
"import hrl_lib.tf_utils as tfu",
"import hrl_lib.util as ut",
"import tf",
"import geometry_msgs.msg as gm",
"import sys",
"import math",
... |
import sensor_msgs.msg as sm
import pr2_arm_navigation_perception.srv as snp
#import tf
#import tf.msg
import rospy
import numpy as np
import hrl_lib.rutils as ru
##
# Converts a list of pr2_msgs/PressureState into a matrix
#
# @return left mat, right mat, array
def pressure_state_to_mat(contact_msgs):
times = np.array([c.header.stamp.to_time() for c in contact_msgs])
left, right = zip(*[[list(c.l_finger_tip), list(c.r_finger_tip)] for c in contact_msgs])
left = np.matrix(left).T
right = np.matrix(right).T
return left, right, times
class LaserScanner:
def __init__(self, service):
srv_name = '/%s/single_sweep_cloud' % service
self.sp = rospy.ServiceProxy(srv_name, snp.BuildCloudAngle)
def scan_np(self, start, end, duration):
resp = self.sp(start, end, duration)
return ru.pointcloud_to_np(resp.cloud)
def scan(self, start, end, duration):
resp = self.sp(start, end, duration)
return resp.cloud
def sweep_param_to_tilt_param(angle_begin, angle_end, duration):
amplitude = abs(angle_end - angle_begin)/2.0
offset = (angle_end + angle_begin)/2.0
period = duration*2.0
return {'amplitude': amplitude, 'offset':offset, 'period': period}
class PointCloudReceiver:
def __init__(self, topic):
self.listener = ru.GenericListener('point_cloud_receiver', sm.PointCloud, topic, .2)
self.topic = topic
def read(self):
cur_time = rospy.Time.now().to_sec()
not_fresh = True
while not_fresh:
pcmsg = self.listener.read(allow_duplication=False, willing_to_wait=True, warn=False, quiet=True)
if not (pcmsg.header.stamp.to_sec() < cur_time):
not_fresh = False
tdif = rospy.Time.now().to_sec() - cur_time
if tdif > 10.:
rospy.logerr('Have not heard from %s for %.2f seconds.' % (self.topic, tdif))
rospy.sleep(.1)
return pcmsg
| [
[
1,
0,
0.0317,
0.0159,
0,
0.66,
0,
531,
0,
1,
0,
0,
531,
0,
0
],
[
1,
0,
0.0476,
0.0159,
0,
0.66,
0.125,
326,
0,
1,
0,
0,
326,
0,
0
],
[
1,
0,
0.0952,
0.0159,
0,
0... | [
"import sensor_msgs.msg as sm",
"import pr2_arm_navigation_perception.srv as snp",
"import rospy",
"import numpy as np",
"import hrl_lib.rutils as ru",
"def pressure_state_to_mat(contact_msgs):\n times = np.array([c.header.stamp.to_time() for c in contact_msgs])\n left, right = zip(*[[list(c.l_finge... |
#
# Temoprarily in this package. Advait needs to move it to a better
# location.
#
import numpy as np, math
import copy
import roslib; roslib.load_manifest('hrl_pr2_lib')
import rospy
import hrl_lib.util as ut
## Class defining the core EPC function and a few simple examples.
# More complex behaviors that use EPC should have their own ROS
# packages.
class EPC():
def __init__(self, robot):
self.robot = robot
self.f_list = []
self.ee_list = []
self.cep_list = []
##
# @param equi_pt_generator: function that returns stop, ea where ea: equilibrium angles and stop: string which is '' for epc motion to continue
# @param rapid_call_func: called in the time between calls to the equi_pt_generator can be used for logging, safety etc. returns string which is '' for epc motion to continue
# @param time_step: time between successive calls to equi_pt_generator
# @param arg_list - list of arguments to be passed to the equi_pt_generator
# @return stop (the string which has the reason why the epc
# motion stopped.), ea (last commanded equilibrium angles)
def epc_motion(self, equi_pt_generator, time_step, arm, arg_list,
rapid_call_func=None, control_function=None):
stop, ea = equi_pt_generator(*arg_list)
t_end = rospy.get_time()
while stop == '':
if rospy.is_shutdown():
stop = 'rospy shutdown'
continue
t_end += time_step
#self.robot.set_jointangles(arm, ea)
#import pdb; pdb.set_trace()
control_function(arm, *ea)
# self.robot.step() this should be within the rapid_call_func for the meka arms.
t1 = rospy.get_time()
while t1<t_end:
if rapid_call_func != None:
stop = rapid_call_func(arm)
if stop != '':
break
#self.robot.step() this should be within the rapid_call_func for the meka arms
rospy.sleep(0.01)
t1 = rospy.get_time()
if stop == '':
stop, ea = equi_pt_generator(*arg_list)
if stop == 'reset timing':
stop = ''
t_end = rospy.get_time()
return stop, ea
## Pull back along a straight line (-ve x direction)
# @param arm - 'right_arm' or 'left_arm'
# @param distance - how far back to pull.
def pull_back_cartesian_control(self, arm, distance, logging_fn):
cep, _ = self.robot.get_cep_jtt(arm)
cep_end = cep + distance * np.matrix([-1., 0., 0.]).T
self.dist_left = distance
def eq_gen_pull_back(cep):
logging_fn(arm)
if self.dist_left <= 0.:
return 'done', None
step_size = 0.01
cep[0,0] -= step_size
self.dist_left -= step_size
if cep[0,0] < 0.4:
return 'very close to the body: %.3f'%cep[0,0], None
return '', (cep, None)
arg_list = [cep]
s = self.epc_motion(eq_gen_pull_back, 0.1, arm, arg_list,
control_function = self.robot.set_cep_jtt)
print s
def move_till_hit(self, arm, vec=np.matrix([0.3,0.,0.]).T, force_threshold=3.0,
speed=0.1, bias_FT=True):
unit_vec = vec/np.linalg.norm(vec)
time_step = 0.1
dist = np.linalg.norm(vec)
step_size = speed * time_step
cep_start, _ = self.robot.get_cep_jtt(arm)
cep = copy.copy(cep_start)
def eq_gen(cep):
force = self.robot.get_wrist_force(arm, base_frame = True)
force_projection = force.T*unit_vec *-1 # projection in direction opposite to motion.
print 'force_projection:', force_projection
if force_projection>force_threshold:
return 'done', None
elif np.linalg.norm(force)>45.:
return 'large force', None
elif np.linalg.norm(cep_start-cep) >= dist:
return 'reached without contact', None
else:
cep_t = cep + unit_vec * step_size
cep[0,0] = cep_t[0,0]
cep[1,0] = cep_t[1,0]
cep[2,0] = cep_t[2,0]
return '', (cep, None)
if bias_FT:
self.robot.bias_wrist_ft(arm)
rospy.sleep(0.5)
return self.epc_motion(eq_gen, time_step, arm, [cep],
control_function = self.robot.set_cep_jtt)
def cep_gen_surface_follow(self, arm, move_dir, force_threshold,
cep, cep_start):
wrist_force = self.robot.get_wrist_force(arm, base_frame=True)
if wrist_force[0,0] < -3.:
cep[0,0] -= 0.002
if wrist_force[0,0] > -1.:
cep[0,0] += 0.003
if cep[0,0] > (cep_start[0,0]+0.05):
cep[0,0] = cep_start[0,0]+0.05
step_size = 0.002
cep_t = cep + move_dir * step_size
cep[0,0] = cep_t[0,0]
cep[1,0] = cep_t[1,0]
cep[2,0] = cep_t[2,0]
v = cep - cep_start
if (wrist_force.T * move_dir)[0,0] < -force_threshold:
stop = 'got a hook'
elif np.linalg.norm(wrist_force) > 50.:
stop = 'force is large %f'%(np.linalg.norm(wrist_force))
elif (v.T * move_dir)[0,0] > 0.20:
stop = 'moved a lot without a hook'
else:
stop = ''
return stop, (cep, None)
if __name__ == '__main__':
import pr2_arms as pa
rospy.init_node('epc_pr2', anonymous = True)
rospy.logout('epc_pr2: ready')
pr2_arms = pa.PR2Arms()
epc = EPC(pr2_arms)
r_arm, l_arm = 0, 1
arm = r_arm
# #----- testing move_till_hit ------
# p1 = np.matrix([0.6, -0.22, -0.05]).T
# epc.robot.go_cep_jtt(arm, p1)
# epc.move_till_hit(arm)
raw_input('Hit ENTER to close')
pr2_arms.close_gripper(arm)
raw_input('Hit ENTER to search_and_hook')
p1 = np.matrix([0.8, -0.22, -0.05]).T
epc.search_and_hook(arm, p1)
epc.pull_back_cartesian_control(arm, 0.3)
d = {
'f_list': epc.f_list, 'ee_list': epc.ee_list,
'cep_list': epc.cep_list
}
ut.save_pickle(d, 'pr2_pull_'+ut.formatted_time()+'.pkl')
# if False:
# ea = [0, 0, 0, 0, 0, 0, 0]
# ea = epc.robot.get_joint_angles(arm)
# rospy.logout('Going to starting position')
# epc.robot.set_jointangles(arm, ea, duration=4.0)
# raw_input('Hit ENTER to pull')
# epc.pull_back(arm, ea, tr.Rx(0), 0.2)
#
# if False:
# p = np.matrix([0.9, -0.3, -0.15]).T
# rot = tr.Rx(0.)
# rot = tr.Rx(math.radians(90.))
#
# rospy.logout('Going to starting position')
# # epc.robot.open_gripper(arm)
# epc.robot.set_cartesian(arm, p, rot)
# # raw_input('Hit ENTER to close the gripper')
# # epc.robot.close_gripper(arm)
# raw_input('Hit ENTER to pull')
# epc.pull_back_cartesian_control(arm, p, rot, 0.4)
| [
[
1,
0,
0.0343,
0.0049,
0,
0.66,
0,
954,
0,
2,
0,
0,
954,
0,
0
],
[
1,
0,
0.0392,
0.0049,
0,
0.66,
0.1429,
739,
0,
1,
0,
0,
739,
0,
0
],
[
1,
0,
0.049,
0.0049,
0,
0... | [
"import numpy as np, math",
"import copy",
"import roslib; roslib.load_manifest('hrl_pr2_lib')",
"import roslib; roslib.load_manifest('hrl_pr2_lib')",
"import rospy",
"import hrl_lib.util as ut",
"class EPC():\n def __init__(self, robot):\n self.robot = robot\n self.f_list = []\n ... |
#! /usr/bin/python
import roslib
roslib.load_manifest("rospy")
roslib.load_manifest("sensor_msgs")
import rospy
from sensor_msgs.msg import PointCloud2
class Poller:
def __init__(self):
self.ind = 0
def callback(self,msg):
self.ind += 1
node_name = 'kinect_poller'
rospy.init_node(node_name)
pc_topic = rospy.get_param(node_name+'/topic_name')
poller = Poller()
rospy.sleep(1.0)
sub = rospy.Subscriber(pc_topic, PointCloud2, poller.callback)
r = rospy.Rate(100)
while not rospy.is_shutdown():
if poller.ind != 0:
break
r.sleep()
print "Polling %s" % pc_topic
rospy.spin()
| [
[
1,
0,
0.0741,
0.037,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.1111,
0.037,
0,
0.66,
0.0667,
630,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.1481,
0.037,
0,
0.66,... | [
"import roslib",
"roslib.load_manifest(\"rospy\")",
"roslib.load_manifest(\"sensor_msgs\")",
"import rospy",
"from sensor_msgs.msg import PointCloud2",
"class Poller:\n def __init__(self):\n self.ind = 0\n def callback(self,msg):\n self.ind += 1",
" def __init__(self):\n se... |
import roslib; roslib.load_manifest('hrl_pr2_lib')
import rospy
import numpy as np
import pr2_msgs.msg as pm
class PressureListener:
def __init__(self, topic='/pressure/l_gripper_motor', safe_pressure_threshold = 4000):
rospy.Subscriber(topic, pm.PressureState, self.press_cb)
self.lmat = None
self.rmat = None
self.lmat0 = None
self.rmat0 = None
self.lmat_raw = None
self.rmat_raw = None
self.safe_pressure_threshold = safe_pressure_threshold
self.exceeded_safe_threshold = False
self.threshold = None
self.exceeded_threshold = False
def rezero(self):
self.lmat0 = None
self.rmat0 = None
self.exceeded_threshold = False
self.exceeded_safe_threshold = False
def check_safety_threshold(self):
r = self.exceeded_safe_threshold
self.exceeded_safe_threshold = False #reset
return r
def check_threshold(self):
r = self.exceeded_threshold
self.exceeded_threshold = False
return r
def set_threshold(self, threshold):
self.threshold = threshold
def get_pressure_readings(self):
return self.lmat, self.rmat
def press_cb(self, pmsg):
lmat = np.matrix((pmsg.l_finger_tip)).T
rmat = np.matrix((pmsg.r_finger_tip)).T
if self.lmat0 == None:
self.lmat0 = lmat
self.rmat0 = rmat
return
self.lmat_raw = lmat
self.rmat_raw = rmat
lmat = lmat - self.lmat0
rmat = rmat - self.rmat0
#touch detected
if np.any(np.abs(lmat) > self.safe_pressure_threshold) or np.any(np.abs(rmat) > self.safe_pressure_threshold):
self.exceeded_safe_threshold = True
if self.threshold != None and (np.any(np.abs(lmat) > self.threshold) or np.any(np.abs(rmat) > self.threshold)):
#print 'EXCEEDED threshold', self.threshold
#print 'PressureListener: ', np.max(np.abs(lmat)), np.max(np.abs(rmat)), 'threshold', self.threshold
self.exceeded_threshold = True
self.lmat = lmat
self.rmat = rmat
| [
[
1,
0,
0.0141,
0.0141,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.0141,
0.0141,
0,
0.66,
0.2,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.0282,
0.0141,
0,
0.66,... | [
"import roslib; roslib.load_manifest('hrl_pr2_lib')",
"import roslib; roslib.load_manifest('hrl_pr2_lib')",
"import rospy",
"import numpy as np",
"import pr2_msgs.msg as pm",
"class PressureListener:\n def __init__(self, topic='/pressure/l_gripper_motor', safe_pressure_threshold = 4000):\n rospy... |
import roslib; roslib.load_manifest('hrl_pr2_lib')
import rospy
import pr2_gripper_reactive_approach.reactive_grasp as rgr
import pr2_gripper_reactive_approach.controller_manager as con
import object_manipulator.convert_functions as cf
from actionlib_msgs.msg import GoalStatus
from geometry_msgs.msg import Pose, PoseStamped, Point, Quaternion
from pr2_gripper_sensor_msgs.msg import PR2GripperEventDetectorGoal
#import collision_monitor as cmon
#import hrl_pr2_lib.devices as de
import hrl_lib.tf_utils as tfu
import hrl_pr2_lib.pressure_listener as pm
import numpy as np
import tf
import pdb
import time
import hrl_lib.util as ut
import math
class RobotSafetyError(Exception):
def __init__(self, value):
self.parameter = value
def __str__(self):
return repr(self.parameter)
## NOT THREAD SAFE
class ArmStoppedDetector:
def __init__(self, pos_thres=0.0001, rot_thres=0.001, time_settle=1., hz=30., n_step=3000):
self.pos_diff = []
self.rot_diff = []
self.times = []
self.last_pos = None
self.last_t = None
self.n_step = n_step
self.hz = hz
self.time_settle = time_settle
self.pos_thres = pos_thres
self.rot_thres = rot_thres
self.start_time = time.time()
def record_diff(self, loc_mat):
cur_t = time.time() - self.start_time
if self.last_t == None or (cur_t - self.last_t) > (1./self.hz):
pos, rot = tfu.matrix_as_tf(loc_mat)
if self.last_pos != None:
self.pos_diff.append(np.linalg.norm(np.matrix(pos) - np.matrix(self.last_pos[0])))
lp = np.array(self.last_pos[1]) / np.linalg.norm(self.last_pos[1])
r = np.array(rot) / np.linalg.norm(rot)
#pdb.set_trace()
self.rot_diff.append(np.linalg.norm(lp - r))
self.times.append(cur_t)
sidx = len(self.pos_diff) - self.n_step
self.pos_diff = self.pos_diff[sidx:]
self.pose_diff = self.rot_diff[sidx:]
self.last_pos = tfu.matrix_as_tf(loc_mat)
self.last_t = cur_t
def is_stopped(self):
cur_t = time.time() - self.start_time
pos_over_thres_idx = np.where(np.array(self.pos_diff) > self.pos_thres)[0]
rot_over_thres_idx = np.where(np.array(self.rot_diff) > self.rot_thres)[0]
if len(pos_over_thres_idx) > 0 or len(rot_over_thres_idx) > 0:
max_times = []
if len(pos_over_thres_idx) > 0:
max_times.append(self.times[pos_over_thres_idx[-1]])
if len(rot_over_thres_idx) > 0:
max_times.append(self.times[rot_over_thres_idx[-1]])
tmax = np.max(max_times)
if (cur_t - tmax) > self.time_settle:
print cur_t - tmax, tmax, self.time_settle, max_times
return True
else:
return False
elif len(self.pos_diff) > (self.time_settle * self.hz):
return True
else:
return False
#if (np.any(np.array(self.pos_diff)) < self.pos_thres and
# np.any(np.array(self.rot_diff)) < self.rot_thres):
# return False
#else:
# return True
class LinearReactiveMovement:
##
# @param arm 'l' or 'r'
# @param pr2 Pr2 object (pr2.py)
# @param tf_listener a tf.TransformListener()
def __init__(self, arm, pr2, tf_listener, using_slip_controller=1, using_slip_detection=1):
if tf_listener == None:
self.tf_listener = tf.TransformListener()
else:
self.tf_listener = tf_listener
self.pr2 = pr2
if arm == 'l':
self.ik_frame = 'l_wrist_roll_link'
self.tool_frame = 'l_gripper_tool_frame'
self.arm_obj = self.pr2.left
ptopic = '/pressure/l_gripper_motor'
else:
self.ik_frame = 'r_wrist_roll_link'
self.tool_frame = 'r_gripper_tool_frame'
self.arm_obj = self.pr2.right
ptopic = '/pressure/r_gripper_motor'
self.pressure_listener = pm.PressureListener(ptopic, 5000)
print 'INITIALIZING CONTROLLER MANAGER'
self.cman = con.ControllerManager(arm, self.tf_listener, using_slip_controller,
using_slip_detection)
print 'INITIALIZAING REACTIVE GRASPER'
self.reactive_gr = rgr.ReactiveGrasper(self.cman)
#self.collision_monitor = cmon.CollisionClient(arm)
#cpy from kaijen code
#gripper_event_detector_action_name = arm+'_gripper_sensor_controller/event_detector'
#self.gripper_event_detector_action_client = actionlib.SimpleActionClient(gripper_event_detector_action_name, \
# PR2GripperEventDetectorAction)
self.movement_mode = 'cart' #or cart
#self.cman.start_joint_controllers()
#self.cman.start_gripper_controller()
self.timeout = 50.
##
# TODO is this redundant?
# @return 3x1 pos matrix, and 4x1 orientation matrix both in base_link
#def current_location(self):
# pos, rot = tfu.matrix_as_tf(self.arm_obj.pose_cartesian())
# return np.matrix(pos).T, np.matrix(rot).T
##
# Moves to a given position, orientation
#
# @param loc (3x1 position matrix, 4x1 orientation matrix) in base_link
# @param stop 'pressure_accel', 'pressure'
# @param pressure pressure to use
def move_absolute_old(self, loc, stop='pressure_accel', pressure=300):
self.set_pressure_threshold(pressure)
stop_funcs = self._process_stop_option(stop)
self.set_movement_mode_cart()
#pdb.set_trace()
self._move_cartesian(loc[0], loc[1], stop_funcs, timeout=self.timeout, settling_time=5.0)
self.set_movement_mode_ik()
r = self._move_cartesian(loc[0], loc[1], stop_funcs, timeout=self.timeout, settling_time=5.0)
#tfu.matrix_as_tf(self.arm_obj.pose_cartesian())[0]
#diff = loc[0] - self.current_location()[0]
diff = loc[0] - self.arm_obj.pose_cartesian_tf()[0]
rospy.loginfo('move_absolute: diff is %s' % str(diff.T))
rospy.loginfo('move_absolute: dist %.3f' % np.linalg.norm(diff))
return r, np.linalg.norm(diff)
def move_absolute(self, loc, stop='pressure_accel', pressure=300, frame='base_link'):
self.set_pressure_threshold(pressure)
stop_funcs = self._process_stop_option(stop)
r = self._move_cartesian(loc[0], loc[1], stop_funcs, timeout=self.timeout,
settling_time=5.0, frame=frame)
diff = loc[0] - self.arm_obj.pose_cartesian_tf()[0]
rospy.loginfo('move_absolute: diff is %s' % str(diff.T))
rospy.loginfo('move_absolute: dist %.3f' % np.linalg.norm(diff))
return r, np.linalg.norm(diff)
##
# Moves relative to an arbitrary frame
#
# @param movement_target 3x1 matrix a displacement in the target frame
# @param target_frame string id of the frame in which the movement is defined
# @param stop 'pressure_accel', 'pressure'
# @param pressure pressure to use
def move_relative(self, movement_target, target_frame, stop='pressure_accel', pressure=150):
base_T_target = tfu.transform('base_link', target_frame, self.tf_listener)
movement_base = base_T_target[0:3, 0:3] * movement_target
return self.move_relative_base(movement_base, stop=stop, pressure=pressure)
##
# Moves relative to tool frame
#
# @param movement_tool 3x1 matrix a displacement in the tool frame
# @param stop 'pressure_accel', 'pressure'
# @param pressure pressure to use
def move_relative_gripper(self, movement_tool, stop='pressure_accel', pressure=150):
base_T_tool = tfu.transform('base_link', self.tool_frame, self.tf_listener)
movement_base = base_T_tool[0:3, 0:3] * movement_tool # np.concatenate((movement_tool, np.matrix([1])))
return self.move_relative_base(movement_base, stop=stop, pressure=pressure)
##
# Moves relative to base frame
#
# @param movement 3x1 matrix displacement in base_frame
# @param stop 'pressure_accel', 'pressure'
# @param pressure pressure to use
def move_relative_base(self, movement, stop='pressure_accel', pressure=150):
self.set_pressure_threshold(pressure)
trans, rot = self.arm_obj.pose_cartesian_tf()
ntrans = trans + movement
stop_funcs = self._process_stop_option(stop)
r = self._move_cartesian(ntrans, rot, stop_funcs, \
timeout=self.timeout, settling_time=5.0)
diff = self.arm_obj.pose_cartesian_tf()[0] - (trans + movement)
rospy.loginfo('move_relative_base: diff is ' + str(diff.T))
rospy.loginfo('move_relative_base: dist %.3f' % np.linalg.norm(diff))
return r, np.linalg.norm(diff)
##
# Close gripper
def gripper_close(self):
self.reactive_gr.compliant_close()
##
# Open gripper
def gripper_open(self):
self.reactive_gr.cm.command_gripper(.1, -1, 1)
def set_pressure_threshold(self, t):
self.pressure_listener.set_threshold(t)
##
# Change which set of controllers are being used for move_* commands
def set_movement_mode_ik(self):
self.movement_mode = 'ik'
self.reactive_gr.cm.switch_to_joint_mode()
self.reactive_gr.cm.freeze_arm()
##
# Change which set of controllers are being used for move_* commands
def set_movement_mode_cart(self):
self.movement_mode = 'cart'
def _move_cartesian(self, position, orientation, \
stop_funcs=[], timeout = 3.0, settling_time = 0.5, \
frame='base_link', vel=.15):
if self.movement_mode == 'ik':
return self._move_cartesian_ik(position, orientation, stop_funcs, \
timeout, settling_time, frame, vel=.15)
elif self.movement_mode == 'cart':
return self._move_cartesian_cart(position, orientation, stop_funcs, \
timeout, settling_time, frame)
##
# move the wrist to a desired Cartesian pose while watching the fingertip sensors
# settling_time is how long to wait after the controllers think we're there
def _move_cartesian_cart(self, position, orientation, \
stop_funcs=[], timeout = 3.0, settling_time = 0.5, frame='base_link'):
# TODO: Test this function...
# Transform the pose from 'frame' to 'base_link'
self.tf_listener.waitForTransform('base_link', frame, rospy.Time(),
rospy.Duration(10))
frame_T_base = tfu.transform('base_link', frame, self.tf_listener)
init_cart_pose = tfu.tf_as_matrix((position.A1.tolist(),
orientation.A1.tolist()))
base_cart_pose = frame_T_base*init_cart_pose
# Get IK from tool frame to wrist frame for control input
self.tf_listener.waitForTransform(self.ik_frame, self.tool_frame, rospy.Time(), rospy.Duration(10))
toolframe_T_ikframe = tfu.transform(self.tool_frame, self.ik_frame, self.tf_listener)
#base_cart_pose = tfu.tf_as_matrix((base_position.A1.tolist(), base_orientation.A1.tolist()))
base_cart_pose = base_cart_pose * toolframe_T_ikframe
base_position, base_orientation = tfu.matrix_as_tf(base_cart_pose)
pose_stamped = cf.create_pose_stamped(base_position.tolist() + base_orientation.tolist())
rg = self.reactive_gr
rg.check_preempt()
#send the goal to the Cartesian controllers
#rospy.loginfo("sending goal to Cartesian controllers")
(pos, rot) = cf.pose_stamped_to_lists(rg.cm.tf_listener, pose_stamped, 'base_link')
rg.move_cartesian_step(pos+rot, timeout, settling_time)
#watch the fingertip/palm sensors until the controllers are done and then some
start_time = rospy.get_rostime()
done_time = None
#stopped = False
stop_trigger = None
#print 'enterning loop'
stop_detector = ArmStoppedDetector()
while(1):
rg.check_preempt()
if len(stop_funcs) > 0:
for f, name in stop_funcs:
if f():
rg.cm.switch_to_joint_mode()
rg.cm.freeze_arm()
#stopped = True
stop_trigger = name
rospy.loginfo('"%s" requested that motion should be stopped.' % (name))
break
if stop_trigger != None:
break
#if stop_func != None and stop_func():
# rg.cm.switch_to_joint_mode()
# rg.cm.freeze_arm()
# stopped = True
# break
#check if we're actually there
if rg.cm.check_cartesian_near_pose(pose_stamped, .0025, .05):
rospy.loginfo("_move_cartesian_cart: reached pose")
#stop_trigger = 'at_pose'
break
stop_detector.record_diff(self.arm_obj.pose_cartesian())
if stop_detector.is_stopped():
rospy.loginfo("_move_cartesian_cart: arm stopped")
#stop_trigger = 'stopped'
break
# if rg.cm.check_cartesian_really_done(pose_stamped, .0025, .05):
# #rospy.loginfo("actually got there")
# break
#
# #check if the controllers think we're done
# if not done_time and rg.cm.check_cartesian_done():
# #rospy.loginfo("check_cartesian_done returned 1")
# done_time = rospy.get_rostime()
# #done settling
# if done_time and rospy.get_rostime() - done_time > rospy.Duration(settling_time):
# rospy.loginfo("done settling")
# break
#timed out
#if timeout != 0. and rospy.get_rostime() - start_time > rospy.Duration(timeout):
# rospy.loginfo("_move_cartesian_cart: timed out")
# break
#if stop_trigger == 'pressure_safety' or stop_trigger == 'self_collision':
if stop_trigger == 'pressure_safety':
print 'ROBOT SAFETY ERROR'
#raise RobotSafetyError(stop_trigger)
#name = ut.formatted_time() + '_stop_detector.pkl'
#print 'saved', name
#ut.save_pickle(stop_detector, name)
return stop_trigger
def _move_cartesian_ik(self, position, orientation, \
stop_funcs=[], timeout = 30., settling_time = 0.25, \
frame='base_link', vel=.15):
#pdb.set_trace()
#self.arm_obj.set_cart_pose_ik(cart_pose, total_time=motion_length, frame=frame, block=False)
#cart_pose = tfu.tf_as_matrix((position.A1.tolist(), orientation.A1.tolist()))
self.tf_listener.waitForTransform(self.ik_frame, self.tool_frame, rospy.Time(), rospy.Duration(10))
toolframe_T_ikframe = tfu.transform(self.tool_frame, self.ik_frame, self.tf_listener)
cart_pose = tfu.tf_as_matrix((position.A1.tolist(), orientation.A1.tolist()))
cart_pose = cart_pose * toolframe_T_ikframe
position, orientation = tfu.matrix_as_tf(cart_pose)
#goal_pose_ps = create_pose_stamped(position.A1.tolist() + orientation.A1.tolist(), frame)
goal_pose_ps = cf.create_pose_stamped(position.tolist() + orientation.tolist(), frame)
r = self.reactive_gr.cm.move_cartesian_ik(goal_pose_ps, blocking=0, step_size=.005, \
pos_thres=.02, rot_thres=.1, timeout=rospy.Duration(timeout),
settling_time=rospy.Duration(settling_time), vel=vel)
if not (r == 'sent goal' or r == 'success'):
return r
#move_cartesian_ik(self, goal_pose, collision_aware = 0, blocking = 1,
# step_size = .005, pos_thres = .02, rot_thres = .1,
# timeout = rospy.Duration(30.),
# settling_time = rospy.Duration(0.25), vel = .15):
stop_trigger = None
done_time = None
start_time = rospy.get_rostime()
while stop_trigger == None:
for f, name in stop_funcs:
if f():
self.arm_obj.stop_trajectory_execution()
stop_trigger = name
rospy.loginfo('"%s" requested that motion should be stopped.' % (name))
break
if timeout != 0. and rospy.get_rostime() - start_time > rospy.Duration(timeout):
rospy.loginfo("_move_cartesian_ik: motion timed out")
break
if (not done_time) and (not self.arm_obj.has_active_goal()):
#rospy.loginfo("check_cartesian_done returned 1")
done_time = rospy.get_rostime()
if done_time and rospy.get_rostime() - done_time > rospy.Duration(settling_time):
rospy.loginfo("_move_cartesian_ik: done settling")
break
if stop_trigger == 'pressure_safety':
print 'ROBOT SAFETY ERROR'
#raise RobotSafetyError(stop_trigger)
return stop_trigger
def _check_gripper_event(self):
#state = self.gripper_event_detector_action_client.get_state()
state = self.cman.get_gripper_event_detector_state()
if state not in [GoalStatus.ACTIVE, GoalStatus.PENDING]:
rospy.loginfo('Gripper event detected.')
return True
else:
return False
##start up gripper event detector to detect when an object hits the table
#or when someone is trying to take an object from the robot
def _start_gripper_event_detector(self, event_type = 'all', accel = 8.25, slip=.008, blocking = 0, timeout = 15.):
goal = PR2GripperEventDetectorGoal()
if event_type == 'accel':
goal.command.trigger_conditions = goal.command.ACC
elif event_type == 'slip':
goal.command.trigger_conditions = goal.command.SLIP
elif event_type == 'press_accel':
goal.command.trigger_conditions = goal.command.FINGER_SIDE_IMPACT_OR_ACC
elif event_type == 'slip_accel':
goal.command.trigger_conditions = goal.command.SLIP_AND_ACC
else:
goal.command.trigger_conditions = goal.command.FINGER_SIDE_IMPACT_OR_SLIP_OR_ACC #use either slip or acceleration as a contact condition
#goal.command.trigger_conditions = goal.command.FINGER_SIDE_IMPACT_OR_SLIP_OR_ACC #use either slip or acceleration as a contact condition
goal.command.acceleration_trigger_magnitude = accel #contact acceleration used to trigger
goal.command.slip_trigger_magnitude = slip #contact slip used to trigger
rospy.loginfo("starting gripper event detector")
self.cman.gripper_event_detector_action_client.send_goal(goal)
#if blocking is requested, wait until the action returns
if blocking:
finished_within_time = self.cman.gripper_event_detector_action_client.wait_for_result(rospy.Duration(timeout))
if not finished_within_time:
rospy.logerr("Gripper didn't see the desired event trigger before timing out")
return 0
state = self.cman.gripper_event_detector_action_client.get_state()
if state == GoalStatus.SUCCEEDED:
result = self.cman.gripper_event_detector_action_client.get_result()
if result.data.placed:
return 1
return 0
def _process_stop_option(self, stop):
stop_funcs = []
self.pressure_listener.check_safety_threshold()
#self.collision_monitor.check_self_contacts()
#stop_funcs.append([self.pressure_listener.check_safety_threshold, 'pressure_safety'])
#stop_funcs.append([self.collision_monitor.check_self_contacts, 'self_collision'])
if stop == 'pressure':
self.pressure_listener.check_threshold()
stop_funcs.append([self.pressure_listener.check_threshold, 'pressure'])
elif stop == 'pressure_accel':
#print 'USING ACCELEROMETERS'
#set a threshold for pressure & check for accelerometer readings
self.pressure_listener.check_threshold()
stop_funcs.append([self.pressure_listener.check_threshold, 'pressure'])
self._start_gripper_event_detector(event_type='accel', timeout=self.timeout)
stop_funcs.append([self._check_gripper_event, 'accel'])
return stop_funcs
if __name__ == '__main__':
mode = 'run'
if mode == 'plot':
import pylab as pb
import sys
a = ut.load_pickle(sys.argv[1])
print len(a.pos_diff)
pb.plot(a.pos_diff)
pb.show()
exit(0)
else:
import hrl_pr2_lib.pr2 as pr2
rospy.init_node('test_linear_move')
arm = 'r'
tflistener = tf.TransformListener()
robot = pr2.PR2(tflistener)
movement = LinearReactiveMovement(arm, robot, tflistener)
if mode == 'save':
poses = []
print 'going.....'
while True:
print 'waiting for input'
r = raw_input()
if r != 's':
print 'getting pose.'
p = movement.arm_obj.pose_cartesian()
print 'pose is', p
poses.append(p)
else:
break
ut.save_pickle(poses, 'saved_poses.pkl')
elif mode == 'run':
poses = ut.load_pickle('saved_poses.pkl')
for p in poses:
print 'hit enter to move'
r = raw_input()
pos, rot = tfu.matrix_as_tf(p)
movement.set_movement_mode_cart()
movement.move_absolute2((np.matrix(pos), np.matrix(rot)))
| [
[
1,
0,
0.0019,
0.0019,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.0019,
0.0019,
0,
0.66,
0.05,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.0038,
0.0019,
0,
0.66... | [
"import roslib; roslib.load_manifest('hrl_pr2_lib')",
"import roslib; roslib.load_manifest('hrl_pr2_lib')",
"import rospy",
"import pr2_gripper_reactive_approach.reactive_grasp as rgr",
"import pr2_gripper_reactive_approach.controller_manager as con",
"import object_manipulator.convert_functions as cf",
... |
import numpy as np, math
import copy
from threading import RLock
import roslib; roslib.load_manifest('hrl_pr2_lib')
roslib.load_manifest('equilibrium_point_control')
import rospy
from equilibrium_point_control.msg import MechanismKinematicsRot
from equilibrium_point_control.msg import MechanismKinematicsJac
from equilibrium_point_control.msg import ForceTrajectory
from geometry_msgs.msg import Point32
from std_msgs.msg import Empty
import epc
import hrl_lib.util as ut
class Door_EPC(epc.EPC):
def __init__(self, robot):
epc.EPC.__init__(self, robot)
self.mech_kinematics_lock = RLock()
self.fit_circle_lock = RLock()
rospy.Subscriber('mechanism_kinematics_rot',
MechanismKinematicsRot,
self.mechanism_kinematics_rot_cb)
rospy.Subscriber('epc/stop', Empty, self.stop_cb)
# used in the ROS stop_cb and equi_pt_generator_control_radial_force
self.force_traj_pub = rospy.Publisher('epc/force_test', ForceTrajectory)
self.mech_traj_pub = rospy.Publisher('mechanism_trajectory', Point32)
def init_log(self):
self.f_list = []
self.cep_list = []
self.ee_list = []
self.ft = ForceTrajectory()
if self.mechanism_type != '':
self.ft.type = self.mechanism_type
else:
self.ft.type = 'rotary'
def log_state(self, arm):
# only logging the right arm.
f = self.robot.get_wrist_force(arm, base_frame=True)
self.f_list.append(f.A1.tolist())
cep, _ = self.robot.get_cep_jtt(arm, hook_tip=True)
self.cep_list.append(cep.A1.tolist())
ee, _ = self.robot.get_ee_jtt(arm)
self.ee_list.append(ee.A1.tolist())
if self.started_pulling_on_handle == False:
if f[0,0] > 5.:
self.started_pulling_on_handle_count += 1
else:
self.started_pulling_on_handle_count = 0
self.init_log() # reset logs until started pulling on the handle.
self.init_tangent_vector = None
if self.started_pulling_on_handle_count > 1:
self.started_pulling_on_handle = True
return ''
## ROS callback. Stop and maintain position.
def stop_cb(self, cmd):
self.stopping_string = 'stop_cb called.'
def common_stopping_conditions(self):
stop = ''
# right arm only.
wrist_force = self.robot.get_wrist_force(0, base_frame=True)
print 'wrist_force:', wrist_force
mag = np.linalg.norm(wrist_force)
if mag > self.eq_force_threshold:
stop = 'force exceed'
if mag < 1.2 and self.hooked_location_moved:
if (self.prev_force_mag - mag) > 30.:
stop = 'slip: force step decrease and below thresold.'
else:
self.slip_count += 1
else:
self.slip_count = 0
if self.slip_count == 10:
stop = 'slip: force below threshold for too long.'
return stop
def mechanism_kinematics_rot_cb(self, mk):
self.fit_circle_lock.acquire()
self.cx_start = mk.cx
self.cy_start = mk.cy
self.cz_start = mk.cz
self.rad = mk.rad
self.fit_circle_lock.release()
## constantly update the estimate of the kinematics and move the
# equilibrium point along the tangent of the estimated arc, and
# try to keep the radial force constant.
# @param h_force_possible - True (hook side) or False (hook up).
# @param v_force_possible - False (hook side) or True (hook up).
# Is maintaining a radial force possible or not (based on hook
# geometry and orientation)
# @param cep_vel - tangential velocity of the cep in m/s
def cep_gen_control_radial_force(self, arm, cep, cep_vel):
self.log_state(arm)
if self.started_pulling_on_handle == False:
cep_vel = 0.02
#step_size = 0.01 * cep_vel
step_size = 0.1 * cep_vel # 0.1 is the time interval between calls to the equi_generator function (see pull)
stop = self.common_stopping_conditions()
wrist_force = self.robot.get_wrist_force(arm, base_frame=True)
mag = np.linalg.norm(wrist_force)
curr_pos, _ = self.robot.get_ee_jtt(arm)
if len(self.ee_list)>1:
start_pos = np.matrix(self.ee_list[0]).T
else:
start_pos = curr_pos
#mechanism kinematics.
if self.started_pulling_on_handle:
self.mech_traj_pub.publish(Point32(curr_pos[0,0],
curr_pos[1,0], curr_pos[2,0]))
self.fit_circle_lock.acquire()
rad = self.rad
cx_start, cy_start = self.cx_start, self.cy_start
cz_start = self.cz_start
self.fit_circle_lock.release()
cx, cy = cx_start, cy_start
cz = cz_start
print 'cx, cy, r:', cx, cy, rad
radial_vec = curr_pos - np.matrix([cx,cy,cz]).T
radial_vec = radial_vec/np.linalg.norm(radial_vec)
if cy_start < start_pos[1,0]:
tan_x,tan_y = -radial_vec[1,0],radial_vec[0,0]
else:
tan_x,tan_y = radial_vec[1,0],-radial_vec[0,0]
if tan_x > 0. and (start_pos[0,0]-curr_pos[0,0]) < 0.09:
tan_x = -tan_x
tan_y = -tan_y
if cy_start > start_pos[1,0]:
radial_vec = -radial_vec # axis to the left, want force in
# anti-radial direction.
rv = radial_vec
force_vec = np.matrix([rv[0,0], rv[1,0], 0.]).T
tangential_vec = np.matrix([tan_x, tan_y, 0.]).T
tangential_vec_ts = tangential_vec
radial_vec_ts = radial_vec
force_vec_ts = force_vec
if arm == 'right_arm' or arm == 0:
if force_vec_ts[1,0] < 0.: # only allowing force to the left
force_vec_ts = -force_vec_ts
else:
if force_vec_ts[1,0] > 0.: # only allowing force to the right
force_vec_ts = -force_vec_ts
f_vec = -1*np.array([wrist_force[0,0], wrist_force[1,0],
wrist_force[2,0]])
f_rad_mag = np.dot(f_vec, force_vec.A1)
err = f_rad_mag-2.
if err>0.:
kp = -0.1
else:
kp = -0.2
radial_motion_mag = kp * err # radial_motion_mag in cm (depends on eq_motion step size)
radial_motion_vec = force_vec * radial_motion_mag
eq_motion_vec = copy.copy(tangential_vec)
eq_motion_vec += radial_motion_vec
self.prev_force_mag = mag
if self.init_tangent_vector == None or self.started_pulling_on_handle == False:
self.init_tangent_vector = copy.copy(tangential_vec_ts)
c = np.dot(tangential_vec_ts.A1, self.init_tangent_vector.A1)
ang = np.arccos(c)
if np.isnan(ang):
ang = 0.
tangential_vec = tangential_vec / np.linalg.norm(tangential_vec) # paranoia abot vectors not being unit vectors.
dist_moved = np.dot((curr_pos - start_pos).A1, tangential_vec_ts.A1)
ftan = abs(np.dot(wrist_force.A1, tangential_vec.A1))
self.ft.tangential_force.append(ftan)
self.ft.radial_force.append(f_rad_mag)
if self.ft.type == 'rotary':
self.ft.configuration.append(ang)
else: # drawer
print 'dist_moved:', dist_moved
self.ft.configuration.append(dist_moved)
if self.started_pulling_on_handle:
self.force_traj_pub.publish(self.ft)
# if self.started_pulling_on_handle == False:
# ftan_pull_test = -np.dot(wrist_force.A1, tangential_vec.A1)
# print 'ftan_pull_test:', ftan_pull_test
# if ftan_pull_test > 5.:
# self.started_pulling_on_handle_count += 1
# else:
# self.started_pulling_on_handle_count = 0
# self.init_log() # reset logs until started pulling on the handle.
# self.init_tangent_vector = None
#
# if self.started_pulling_on_handle_count > 1:
# self.started_pulling_on_handle = True
if abs(dist_moved) > 0.09 and self.hooked_location_moved == False:
# change the force threshold once the hook has started pulling.
self.hooked_location_moved = True
self.eq_force_threshold = ut.bound(mag+30.,20.,80.)
self.ftan_threshold = 1.2 * self.ftan_threshold + 20.
if self.hooked_location_moved:
if abs(tangential_vec_ts[2,0]) < 0.2 and ftan > self.ftan_threshold:
stop = 'ftan threshold exceed: %f'%ftan
else:
self.ftan_threshold = max(self.ftan_threshold, ftan)
if self.hooked_location_moved and ang > math.radians(90.):
print 'Angle:', math.degrees(ang)
self.open_ang_exceed_count += 1
if self.open_ang_exceed_count > 2:
stop = 'opened mechanism through large angle: %.1f'%(math.degrees(ang))
else:
self.open_ang_exceed_count = 0
cep_t = cep + eq_motion_vec * step_size
cep_t = cep + np.matrix([-1., 0., 0.]).T * step_size
if cep_t[0,0] > 0.1:
cep[0,0] = cep_t[0,0]
cep[1,0] = cep_t[1,0]
cep[2,0] = cep_t[2,0]
print 'CEP:', cep.A1
stop = stop + self.stopping_string
return stop, (cep, None)
def pull(self, arm, force_threshold, cep_vel, mechanism_type=''):
self.mechanism_type = mechanism_type
self.stopping_string = ''
self.eq_pt_not_moving_counter = 0
self.init_log()
self.init_tangent_vector = None
self.open_ang_exceed_count = 0.
self.eq_force_threshold = force_threshold
self.ftan_threshold = 2.
self.hooked_location_moved = False # flag to indicate when the hooking location started moving.
self.prev_force_mag = np.linalg.norm(self.robot.get_wrist_force(arm))
self.slip_count = 0
self.started_pulling_on_handle = False
self.started_pulling_on_handle_count = 0
ee_pos, _ = self.robot.get_ee_jtt(arm)
self.cx_start = ee_pos[0,0]
self.rad = 10.0
self.cy_start = ee_pos[1,0]-self.rad
self.cz_start = ee_pos[2,0]
cep, _ = self.robot.get_cep_jtt(arm)
arg_list = [arm, cep, cep_vel]
result, _ = self.epc_motion(self.cep_gen_control_radial_force,
0.1, arm, arg_list, self.log_state,
#0.01, arm, arg_list,
control_function = self.robot.set_cep_jtt)
print 'EPC motion result:', result
print 'Original force threshold:', force_threshold
print 'Adapted force threshold:', self.eq_force_threshold
print 'Adapted ftan threshold:', self.ftan_threshold
d = {
'f_list': self.f_list, 'ee_list': self.ee_list,
'cep_list': self.cep_list, 'ftan_list': self.ft.tangential_force,
'config_list': self.ft.configuration, 'frad_list': self.ft.radial_force
}
ut.save_pickle(d,'pr2_pull_'+ut.formatted_time()+'.pkl')
def search_and_hook(self, arm, hook_loc, hooking_force_threshold = 5.,
hit_threshold=2., hit_motions = 1,
hook_direction = 'left'):
# this needs to be debugged. Hardcoded for now.
#if arm == 'right_arm' or arm == 0:
# hook_dir = np.matrix([0., 1., 0.]).T # hook direc in home position
# offset = -0.03
#elif arm == 'left_arm' or arm == 1:
# hook_dir = np.matrix([0., -1., 0.]).T # hook direc in home position
# offset = -0.03
#else:
# raise RuntimeError('Unknown arm: %s', arm)
#start_loc = hook_loc + rot_mat.T * hook_dir * offset
if hook_direction == 'left':
offset = np.matrix([0., -0.03, 0.]).T
move_dir = np.matrix([0., 1., 0.]).T
elif hook_direction == 'up':
offset = np.matrix([0., 0., -0.03]).T
move_dir = np.matrix([0., 0., 1.]).T
start_loc = hook_loc + offset
# vector normal to surface and pointing into the surface.
normal_tl = np.matrix([1.0, 0., 0.]).T
pt1 = start_loc - normal_tl * 0.1
self.robot.go_cep_jtt(arm, pt1)
raw_input('Hit ENTER to go')
vec = normal_tl * 0.2
rospy.sleep(1.)
for i in range(hit_motions):
s = self.move_till_hit(arm, vec=vec, force_threshold=hit_threshold, speed=0.07)
cep_start, _ = self.robot.get_cep_jtt(arm)
cep = copy.copy(cep_start)
arg_list = [arm, move_dir, hooking_force_threshold, cep, cep_start]
s = self.epc_motion(self.cep_gen_surface_follow, 0.1, arm,
arg_list, control_function = self.robot.set_cep_jtt)
return s
if __name__ == '__main__':
import pr2_arms as pa
rospy.init_node('epc_pr2', anonymous = True)
rospy.logout('epc_pr2: ready')
pr2_arms = pa.PR2Arms()
door_epc = Door_EPC(pr2_arms)
r_arm, l_arm = 0, 1
arm = r_arm
raw_input('Hit ENTER to close')
pr2_arms.close_gripper(arm)
raw_input('Hit ENTER to start Door Opening')
# for cabinets.
#p1 = np.matrix([0.8, -0.40, -0.04]).T # pos 3
#p1 = np.matrix([0.8, -0.10, -0.04]).T # pos 2
p1 = np.matrix([0.8, -0.1, -0.04]).T # pos 1
door_epc.search_and_hook(arm, p1, hook_direction='left')
door_epc.pull(arm, force_threshold=40., cep_vel=0.05)
# # hrl toolchest drawer.
# p1 = np.matrix([0.8, -0.2, -0.17]).T
# door_epc.search_and_hook(arm, p1, hook_direction='up')
# door_epc.pull(arm, force_threshold=40., cep_vel=0.05)
| [
[
1,
0,
0.0055,
0.0028,
0,
0.66,
0,
954,
0,
2,
0,
0,
954,
0,
0
],
[
1,
0,
0.0083,
0.0028,
0,
0.66,
0.0667,
739,
0,
1,
0,
0,
739,
0,
0
],
[
1,
0,
0.011,
0.0028,
0,
0... | [
"import numpy as np, math",
"import copy",
"from threading import RLock",
"import roslib; roslib.load_manifest('hrl_pr2_lib')",
"import roslib; roslib.load_manifest('hrl_pr2_lib')",
"roslib.load_manifest('equilibrium_point_control')",
"import rospy",
"from equilibrium_point_control.msg import Mechanis... |
#!/usr/bin/python
import roslib; roslib.load_manifest("pr2_laser_pointer_grasp")
import rospy
import copy
from std_msgs.msg import Bool, Float64
from pr2_msgs.msg import PressureState
from pr2_laser_pointer_grasp.srv import GripperMonitor
from numpy import sqrt
def loginfo(str):
rospy.loginfo("PressureMonitor: " + str)
class PressureMonitor():
def __init__(self, grip_top, bias_thresh):
self.bias_pub = rospy.Publisher("/pressure/" + grip_top + "/bias_dist", Float64)
self.NUM_SENSORS = 22
self.SENSOR_WEIGHTS = [1.0] * self.NUM_SENSORS
if bias_thresh == 0.0:
self.BIAS_DIST_THRESH = 900.0
else:
self.BIAS_DIST_THRESH = bias_thresh
self.BIAS_TIME = 0.3
self.setup()
def setup(self):
self.l_bias_sum = [0.0] * self.NUM_SENSORS
self.r_bias_sum = [0.0] * self.NUM_SENSORS
self.l_bias = [0.0] * self.NUM_SENSORS
self.r_bias = [0.0] * self.NUM_SENSORS
self.bias_done = False
self.st_bias_time = None
self.num_samples = 0
self.pressure_trigger = False
def bias_dist(self, x, y):
def subsq(a, b): return (a - b) ** 2
return sqrt(sum(map(subsq,x,y)))
def pressure_biaser(self, msg):
if self.st_bias_time is None:
self.st_bias_time = rospy.Time.now().to_sec()
self.l_bias_sum = copy.copy(msg.l_finger_tip)
self.r_bias_sum = copy.copy(msg.r_finger_tip)
self.num_samples = 1
elapsed = rospy.Time.now().to_sec() - self.st_bias_time
if elapsed > self.BIAS_TIME:
def div(x): return x/self.num_samples
self.l_bias = map(div, self.l_bias_sum)
self.r_bias = map(div, self.r_bias_sum)
self.bias_done = True
def add(x,y): return x+y
self.l_bias_sum = map(add, self.l_bias_sum, msg.l_finger_tip)
self.r_bias_sum = map(add, self.r_bias_sum, msg.r_finger_tip)
self.num_samples += 1
def pressure_monitor(self, msg):
total_bias_dist = (self.bias_dist(msg.l_finger_tip,self.l_bias) +
self.bias_dist(msg.r_finger_tip,self.r_bias))
self.bias_pub.publish(total_bias_dist)
# import pdb; pdb.set_trace()
if total_bias_dist > self.BIAS_DIST_THRESH:
self.pressure_trigger = True
def monitor(msg):
pm = PressureMonitor(msg.gripper_topic, msg.bias_thresh)
pbsub = rospy.Subscriber('/pressure/' + msg.gripper_topic, PressureState, pm.pressure_biaser)
loginfo("Subscribing to " + msg.gripper_topic + ", biasing starting")
while not pm.bias_done:
rospy.sleep(0.4)
pbsub.unregister()
loginfo("Biasing complete, monitoring...")
pmsub = rospy.Subscriber('/pressure/' + msg.gripper_topic, PressureState, pm.pressure_monitor)
while not pm.pressure_trigger:
rospy.sleep(0.1)
loginfo("Pressure difference detected!")
pmsub.unregister()
pm.setup()
return True
if __name__ == "__main__":
rospy.init_node('gripper_monitor_service')
svc = rospy.Service('gripper_monitor', GripperMonitor, monitor)
loginfo("Offering gripper_monitor service.")
rospy.spin()
| [
[
1,
0,
0.023,
0.0115,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.023,
0.0115,
0,
0.66,
0.0909,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.0345,
0.0115,
0,
0.66... | [
"import roslib; roslib.load_manifest(\"pr2_laser_pointer_grasp\")",
"import roslib; roslib.load_manifest(\"pr2_laser_pointer_grasp\")",
"import rospy",
"import copy",
"from std_msgs.msg import Bool, Float64",
"from pr2_msgs.msg import PressureState",
"from pr2_laser_pointer_grasp.srv import GripperMonit... |
#!/usr/bin/python
import roslib; roslib.load_manifest('hrl_pr2_lib')
import rospy
import math
from geometry_msgs.msg import WrenchStamped, PoseStamped, Point, PointStamped
from tf import TransformListener, transformations
from visualization_msgs.msg import Marker
class Pointmass_Adjust:
pub_marker = True #Set to (True) or to not(False) publish rviz marker showing force vector
mass = 1.0463 #kg 1.0213
pos_x = 0.0853 #m, in 'l_wrist_roll_link'
pos_y = 0.0
pos_z = 0.0
x_force_offset = 5.62 #5.70 -- These values determined from experiment, used values are adjusted for better qualitative results using rviz
y_force_offset = -13.56 #14.10
z_force_offset = 4.30 #-3.88
x_torque_offset = -0.4025 #0.3899
y_torque_offset = -0.4175 #0.3804
z_torque_offset = -0.21875
adjustment = WrenchStamped()
def __init__(self):
rospy.init_node("ft_pointmass_adjustment")
rospy.Subscriber("netft_data", WrenchStamped, self.adjust)
self.ft_out = rospy.Publisher('ft_data_pm_adjusted', WrenchStamped)
self.force_vec_out = rospy.Publisher('ft_force_vector_marker', Marker)
self.tfl = TransformListener()
def adjust(self, ft_in):
ft_out = WrenchStamped()
ft_out.header.stamp = rospy.Time.now()
ft_out.header.frame_id = ft_in.header.frame_id
ft_out.wrench.force.x = ft_in.wrench.force.x - self.x_force_offset + self.adjustment.wrench.force.x
ft_out.wrench.force.y = ft_in.wrench.force.y - self.y_force_offset + self.adjustment.wrench.force.y
ft_out.wrench.force.z = ft_in.wrench.force.z - self.z_force_offset + self.adjustment.wrench.force.z
ft_out.wrench.torque.x = ft_in.wrench.torque.x - self.x_torque_offset - self.adjustment.wrench.torque.x
ft_out.wrench.torque.y = ft_in.wrench.torque.y - self.y_torque_offset - self.adjustment.wrench.torque.y
ft_out.wrench.torque.z = ft_in.wrench.torque.z - self.z_torque_offset - self.adjustment.wrench.torque.z
self.ft_out.publish(ft_out)
if self.pub_marker:
marker = self.form_marker(ft_out)
self.force_vec_out.publish(marker)
def form_marker(self, ws):
origin = Point()
force_point = Point()
force_point.x = 0.1*ws.wrench.force.x
force_point.y = 0.1*ws.wrench.force.y
force_point.z = 0.1*ws.wrench.force.z
force_vec = Marker()
force_vec.header.stamp = rospy.Time.now()
force_vec.header.frame_id = '/l_netft_frame'
force_vec.ns = "ft_sensor"
force_vec.action = 0
force_vec.type = 0
force_vec.scale.x = 0.1
force_vec.scale.y = 0.2
force_vec.scale.z = 1
force_vec.color.a = 0.75
force_vec.color.r = 0.0
force_vec.color.g = 1.0
force_vec.color.b = 0.1
force_vec.lifetime = rospy.Duration(1)
force_vec.points.append(origin)
force_vec.points.append(force_point)
return force_vec
def calc_adjustment(self):
try:
(pos, quat) = self.tfl.lookupTransform('/base_link', '/l_netft_frame', rospy.Time(0))
except:
return
rot = transformations.euler_from_quaternion(quat)
self.adjustment.wrench.torque.x = self.mass*9.80665*self.pos_x*math.sin(rot[0])
self.adjustment.wrench.torque.y = self.mass*9.80665*self.pos_x*math.sin(rot[1])
self.adjustment.wrench.torque.z = 0
grav = PointStamped() # Generate a 'vector' of the force due to gravity at the ft sensor
grav.header.stamp = rospy.Time(0) #Used to tell tf to grab latest available transform in transformVector3
grav.header.frame_id = '/base_link'
grav.point.x = pos[0]
grav.point.y = pos[1]
grav.point.z = pos[2] - 9.80665*self.mass
netft_grav = self.tfl.transformPoint('/l_netft_frame', grav) #Returns components of the 'gravity force' in each axis of the 'l_netft_frame'
self.adjustment.wrench.force.x = netft_grav.point.x
self.adjustment.wrench.force.y = netft_grav.point.y
self.adjustment.wrench.force.z = netft_grav.point.z
self.adjustment.header.stamp=rospy.Time.now()
#self.form_marker(self.adjustment)
if __name__ == "__main__":
PMC = Pointmass_Adjust()
r=rospy.Rate(1000)
while not rospy.is_shutdown():
PMC.calc_adjustment()
r.sleep()
| [
[
1,
0,
0.0288,
0.0096,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.0288,
0.0096,
0,
0.66,
0.125,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.0385,
0.0096,
0,
0.6... | [
"import roslib; roslib.load_manifest('hrl_pr2_lib')",
"import roslib; roslib.load_manifest('hrl_pr2_lib')",
"import rospy",
"import math",
"from geometry_msgs.msg import WrenchStamped, PoseStamped, Point, PointStamped",
"from tf import TransformListener, transformations",
"from visualization_msgs.msg im... |
#! /usr/bin/python
import roslib; roslib.load_manifest('hrl_pr2_lib')
import rospy
import sensor_msgs.msg as sm
# import planning_environment_msgs.srv as psrv
import arm_navigation_msgs.srv as psrv
import numpy as np
import time
import hrl_pr2_lib.msg as hmsg
class CollisionClient:
def __init__(self, arm):
rospy.Subscriber('contacts_' + arm, hmsg.OnlineContact, self.collision_cb, tcp_nodelay=True)
self.contacted_with_self = [False, None, None]
def collision_cb(self, msg):
for c in msg.contacts:
if c.contact_body_1 == 'points' or c.contact_body_2 == 'points' \
or c.contact_body_1 == None or c.contact_body_2 == None:
continue
else:
self.contacted_with_self = [True, c.contact_body_1, c.contact_body_2]
def check_self_contacts(self):
r = self.contacted_with_self
self.contacted_with_self = [False, None, None]
if r[0] == True:
rospy.loginfo('Contact made between %s and %s.' % (r[1], r[2]))
return r[0]
class CollisionMonitor:
def __init__(self, arm):
rospy.init_node('collision_monitor_' + arm)
self.name_dict = None
link_names = ['_shoulder_pan_joint', '_shoulder_lift_joint',
'_upper_arm_roll_joint', '_elbow_flex_joint',
'_forearm_roll_joint', '_wrist_flex_joint', '_wrist_roll_joint']
self.arm_name = [arm + l for l in link_names]
if arm == 'l':
service_name = 'environment_server_left_arm/get_state_validity'
else:
service_name = 'environment_server_right_arm/get_state_validity'
rospy.loginfo('waiting for ' + service_name)
rospy.wait_for_service(service_name)
self.check_state_validity_client = rospy.ServiceProxy(service_name, \
psrv.GetStateValidity, persistent=True)
rospy.Subscriber('joint_states', sm.JointState, self.joint_state_cb, \
queue_size=5, tcp_nodelay=True)
self.contact_pub = rospy.Publisher('contacts_' + arm, hmsg.OnlineContact)
def joint_state_cb(self, msg):
if self.name_dict == None:
self.name_dict = {}
for i, n in enumerate(msg.name):
self.name_dict[n] = i
arm_indices = [self.name_dict[n] for n in self.arm_name]
arm_list = np.array(msg.position)[arm_indices].tolist()
req = psrv.GetStateValidityRequest()
req.robot_state.joint_state.name = self.arm_name
req.robot_state.joint_state.position = arm_list
req.robot_state.joint_state.header.stamp = rospy.get_rostime()
req.check_collisions = True
res = self.check_state_validity_client(req)
if not (res.error_code.val == res.error_code.SUCCESS):
#contact_with_points = False
#for c in res.contacts:
# if c.contact_body_1 == 'points' or c.contact_body_2 == 'points':
# contact_with_points = True
# else:
# print 'contact between', c.contact_body_1, c.contact_body_2
m = hmsg.OnlineContact()
m.contacts = res.contacts
self.contact_pub.publish(m)
#if not contact_with_points:
# rospy.loginfo('state is in COLLISION')
def call_collision_monitor(arm):
a = CollisionMonitor(arm)
rospy.loginfo('ready')
r = rospy.Rate(10)
while not rospy.is_shutdown():
r.sleep()
def call_get_state_validity():
rospy.init_node('test_get_state_validity')
service_name = 'environment_server_left_arm/get_state_validity'
rospy.loginfo('waiting for ' + service_name)
rospy.wait_for_service(service_name)
check_state_validity_client = rospy.ServiceProxy('environment_server_left_arm/get_state_validity', \
psrv.GetStateValidity, persistent=True)
req = psrv.GetStateValidityRequest()
req.robot_state.joint_state.name = ['l_shoulder_pan_joint', 'l_shoulder_lift_joint',
'l_upper_arm_roll_joint', 'l_elbow_flex_joint',
'l_forearm_roll_joint', 'l_wrist_flex_joint', 'l_wrist_roll_joint']
req.robot_state.joint_state.position = 7 * [0.0]
#while not rospy.is_shutdown():
t = time.time()
for i in range(1000):
req.robot_state.joint_state.header.stamp = rospy.get_rostime()
req.check_collisions = True
res = check_state_validity_client(req)
diff = time.time() - t
time_per_call = diff / 1000
print time_per_call, 'rate', 1 / time_per_call
#if res.error_code.val == res.error_code.SUCCESS:
# rospy.loginfo('state is NOT in collision')
#else:
# rospy.loginfo('state is in collision')
if __name__ == '__main__':
import sys
call_collision_monitor(sys.argv[1])
#call_get_state_validity()
| [
[
1,
0,
0.0106,
0.0053,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.0106,
0.0053,
0,
0.66,
0.0833,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.0159,
0.0053,
0,
0.... | [
"import roslib; roslib.load_manifest('hrl_pr2_lib')",
"import roslib; roslib.load_manifest('hrl_pr2_lib')",
"import rospy",
"import sensor_msgs.msg as sm",
"import arm_navigation_msgs.srv as psrv",
"import numpy as np",
"import time",
"import hrl_pr2_lib.msg as hmsg",
"class CollisionClient:\n de... |
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Willow Garage, Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
## @author Hai Nguyen/hai@gatech.edu
import numpy as np
import itertools as it
import functools as ft
import time
class Dataset:
def __init__(self, inputs, outputs):
"""
inputs coded as numpy array, column vectors
outputs also as numpy array, column vectors
"""
self.inputs = inputs
self.outputs = outputs
assert(inputs.shape[1] == outputs.shape[1])
def num_examples(self):
return self.inputs.shape[1]
def num_attributes(self):
return self.inputs.shape[0]
def split_continuous(self, attribute, split_point):
selected_attribute = self.inputs[attribute, :]
leq_bool = selected_attribute <= split_point
_, leq_col = np.where(leq_bool)
#print 'leq_col', leq_col
if leq_col.shape[1] > 0:
leq_dataset = Dataset(self.inputs[:, leq_col.A[0]], self.outputs[:, leq_col.A[0]])
else:
leq_dataset = Dataset(np.matrix([]), np.matrix([]))
_, gt_col = np.where(~leq_bool)
if gt_col.shape[1] > 0:
gt_dataset = Dataset(self.inputs[:, gt_col.A[0]], self.outputs[:, gt_col.A[0]])
else:
gt_dataset = Dataset(np.matrix([]), np.matrix([]))
ret_sets = []
if leq_dataset.num_examples() > 0:
ret_sets.append(leq_dataset)
if gt_dataset.num_examples() > 0:
ret_sets.append(gt_dataset)
return ret_sets
def unique_values(self, attribute_number, set='input'):
if set == 'input':
examples = self.inputs
else:
examples = self.outputs
values = dict()
for instance_idx in xrange(examples.shape[1]):
values[examples[attribute_number, instance_idx]] = True
k = values.keys()
k.sort()
return k
def bootstrap_samples(self, number_samples, points_per_sample):
for i in xrange(number_samples):
selected_pts = np.random.randint(0, self.inputs.shape[1], points_per_sample)
selected_inputs = self.inputs[:, selected_pts]
selected_outputs = self.outputs[:, selected_pts]
#print 'Dataset.bootstrap count', i
yield Dataset(selected_inputs, selected_outputs)
def entropy_discrete(self):
values = self.unique_values(0, 'output')
#print 'entropy_discrete: values', values
#for each output class calculate
def calc_class_entropy(value):
number_in_class = np.sum(self.outputs[0,:] == value)
percentage_in_class = (number_in_class / float(self.num_examples()))
return -percentage_in_class * np.log2(percentage_in_class)
return np.sum(map(calc_class_entropy, values))
def append(self, another_dataset):
self.inputs = np.concatenate((self.inputs, another_dataset.inputs), axis=1)
self.outputs = np.concatenate((self.outputs, another_dataset.outputs), axis=1)
class LinearDimReduceDataset(Dataset):
def __init__(self, inputs, outputs):
Dataset.__init__(self, inputs, outputs)
def set_projection_vectors(self, vec):
'''
projection vectors are assumed to be columnwise
'''
self.projection_basis = vec
print 'LinearDimReduceDataset: projection_basis', vec.shape
def reduce(self, data_points):
return self.projection_basis.T * data_points
def reduce_input(self):
'''
reduce dimensionality of this dataset
'''
self.inputs = self.projection_basis.T * self.inputs
def binary_less_than(attribute, threshold, input_vec):
return input_vec[attribute,0] <= threshold
def binary_greater_than(attribute, threshold, input_vec):
return input_vec[attribute,0] > threshold
def create_binary_tests(attribute, threshold):
return [ft.partial(binary_less_than, attribute, threshold),
ft.partial(binary_greater_than, attribute, threshold)]
def mode_exhaustive(set):
'''
Finds the mode of a given set
'''
#Count, store in dictionary
mdict = dict()
for s in set:
has_stored = False
for k in mdict.keys():
if k == s:
mdict[k] = 1+mdict[k]
has_stored = True
if not has_stored:
mdict[s] = 1
#Find the key with maximum votes
max_key = None
max_count = -1
for k in mdict.keys():
if mdict[k] > max_count:
max_key = k
max_count = mdict[k]
#print 'mode_exhaustive: ', mdict
return max_key, mdict
def min_entropy_split(dataset):
'''
Find the split that produces subsets with the minimum combined entropy
return splitting attribute & splitting point for that attribute
'''
#print 'in min_entropy_split'
# Assume inputs are continuous, and are column vectors.
hypotheses = []
entropies = []
# For each attribute find the best split point.
for attribute in xrange(dataset.num_attributes()):
values = dataset.unique_values(attribute)
#Iterate over the possible values of split & calculate entropy for each split.
for split_point in values:
def calc_entropy(data_set):
num_points = data_set.num_examples()
return (num_points / float(dataset.num_examples())) * data_set.entropy_discrete()
split_entropy = map(calc_entropy, dataset.split_continuous(attribute, split_point))
hypotheses.append((attribute, split_point))
entropies.append(sum(split_entropy))
# Select the attribute split pair that has the lowest entropy.
entropies = np.matrix(entropies)
min_idx = np.argmin(entropies)
return hypotheses[min_idx]
def random_subset(subset_size, total_size):
#print 'in random_subset'
assert(subset_size <= total_size)
occupancy = np.matrix(np.zeros((1, total_size)))
while occupancy.sum() < subset_size:
occupancy[0, np.random.randint(0, total_size)] = 1
rows, columns = np.where(occupancy > 0)
return columns.A[0]
def split_random_subset(subset_size, total_size):
assert(subset_size <= total_size)
occupancy = np.matrix(np.zeros((1, total_size)))
while occupancy.sum() < subset_size:
occupancy[0, np.random.randint(0, total_size)] = 1
bool_sel = occupancy > 0
rows, columns_subset = np.where(bool_sel)
rows, columns_remaining = np.where(np.invert(bool_sel))
return columns_subset.A[0], columns_remaining.A[0]
def random_subset_split(num_subset, dataset):
''' splitter in decision tree '''
#print 'in random_subset_split'
#print 'num_subset', num_subset, dataset, 'dataset.input.shape', dataset.inputs.shape
subset_indexes = random_subset(num_subset, dataset.num_attributes())
sub_dataset = Dataset(dataset.inputs[subset_indexes,:], dataset.outputs)
attribute, point = min_entropy_split(sub_dataset)
return subset_indexes[attribute], point
def totally_random_split(dataset):
#print 'totally random'
attr = np.random.randint(0, dataset.num_attributes())
split_pt = dataset.inputs[attr, np.random.randint(0, dataset.num_examples())]
return attr, split_pt
class DecisionTree:
def __init__(self, dataset=None, splitting_func=min_entropy_split):
self.children = None
self.prediction = None
if dataset is not None:
self.train(dataset, splitting_func=splitting_func)
def train(self, dataset, splitting_func=min_entropy_split):
if not self.make_leaf(dataset):
#print 'in train.splitting', dataset.num_examples()
self.split_attribute, self.split_point = splitting_func(dataset)
#print 'self.split_attribute, self.split_point', self.split_attribute, self.split_point
data_sets = dataset.split_continuous(self.split_attribute, self.split_point)
if len(data_sets) < 2:
self.prediction = dataset.outputs
return
def tree_split(set):
#print 'tree', set.num_examples()
return DecisionTree(set, splitting_func=splitting_func)
# Create & train child decision nodes
tests = create_binary_tests(self.split_attribute, self.split_point)
self.children = zip(tests, map(tree_split, data_sets))
def make_leaf(self, dataset):
if np.all(dataset.outputs[:,0] == dataset.outputs):
self.prediction = dataset.outputs[:,0]
#print 'leaf'
return True
elif np.all(dataset.inputs[:,0] == dataset.inputs):
self.prediction = dataset.outputs
#print 'leaf'
return True
else:
return False
def predict(self, input):
if self.prediction is not None:
return self.prediction[:, np.random.randint(0, self.prediction.shape[1])]
else:
for test, child in self.children:
if test(input):
return child.predict(input)
raise RuntimeError("DecisionTree: splits not exhaustive, unable to split for input" + str(input.T))
class RFBase:
def __init__(self, dataset=None, number_of_dimensions=None, number_of_learners=100):
"""
number_of_dimensions unclear which direction, but should be around 10-20% of original
data dimension
number_of_learners limited by processor performance, higher is better
"""
self.number_of_learners = number_of_learners
self.number_of_dimensions = number_of_dimensions
if dataset != None:
self.train(dataset)
def predict(self, data, vote_combine_function=None):
def predict_(learner):
return learner.predict(learner.transform_input(data))
predictions = map(predict_,self.learners)
if vote_combine_function is not None:
return vote_combine_function(predictions)
else:
return mode_exhaustive(predictions)
def train(self, dataset):
pass
def identity(x):
return x
class RFBreiman(RFBase):
def train(self, dataset):
def train_trees(examples_subset):
tree = DecisionTree()
#tree.train(examples_subset, splitting_func=ft.partial(random_subset_split, self.number_of_dimensions))
tree.train(examples_subset, splitting_func=totally_random_split)
#use identity function
tree.transform_input = identity
return tree
if self.number_of_dimensions == None:
self.number_of_dimensions = min(np.log2(dataset.num_attributes()) + 1, 1)
points_per_sample = dataset.num_examples() * 1.0 / 3.0
self.learners = map(train_trees, dataset.bootstrap_samples(self.number_of_learners, points_per_sample))
class RFRandomInputSubset(RFBase):
def train(self, dataset):
def train_trees(examples_subset):
#select a subset of dimensions
dims = random_subset(self.number_of_dimensions, examples_subset.num_attributes())
subset_input = examples_subset.inputs[dims, :]
reduced_sample = Dataset(subset_input, examples_subset.outputs)
tree = DecisionTree(reduced_sample)
tree.dimensions_subset = dims
def transform_input(input):
return input[dims, :]
tree.transform_input = transform_input
return tree
if self.number_of_dimensions == None:
self.number_of_dimensions = min(np.log2(dataset.num_attributes()) + 1, 1)
points_per_sample = dataset.num_examples() * 1.0 / 3.0
self.learners = map(train_trees, dataset.bootstrap_samples(self.number_of_learners, points_per_sample))
def evaluate_classifier(building_func, data, times=10.0, percentage=None, extra_args={}, test_pca=False):
'''
Evaluate classifier by dividing dataset into training and test set.
@param building_func Function that will build classifier given data and args in extra_args.
@param data Dataset to use for evaluation/training.
@param times The number of bootstrap samples to take.
@param percentage The percentage of data to use for training.
@param extra_args Extra arguments to pass to building_func.
'''
print 'evaluate_classifier: extra_args', extra_args
total_pts = data.num_examples()
testing_errors = []
training_errors = []
build_times = []
classification_times = []
for i in range(times):
if percentage == None:
percentage = (i+1)/times
num_examples = int(round(total_pts*percentage))
print 'Evaluate classifier built with', percentage*100, '% data, num examples', num_examples
subset, unselected = split_random_subset(num_examples, total_pts)
i = data.inputs[:, subset]
o = data.outputs[:, subset]
print "Building classifier..."
if test_pca:
print ' TESTING PCA'
import dimreduce as dr
subseted_dataset = LinearDimReduceDataset(i,o)
subseted_dataset.set_projection_vectors(dr.pca_vectors(subseted_dataset.inputs, percent_variance=.95))
subseted_dataset.reduce_input()
print 'subseted_dataset.num_attributes(), subseted_dataset.num_examples()', subseted_dataset.num_attributes(), subseted_dataset.num_examples()
else:
subseted_dataset = Dataset(i,o)
start_time = time.time()
classifier = building_func(subseted_dataset, **extra_args)
build_times.append(time.time() - start_time)
print "done building..."
##########################################
#Classify training set
##########################################
count_selected = []
for i, idx in enumerate(subset):
start_time = time.time()
if test_pca:
prediction, _ = classifier.predict(data.reduce(data.inputs[:,idx]))
else:
prediction, _ = classifier.predict(data.inputs[:,idx])
classification_times.append(time.time() - start_time)
true_val = data.outputs[:,idx]
if prediction == true_val:
count_selected.append(1)
else:
count_selected.append(0)
if i%100 == 0:
print i
count_selected = np.matrix(count_selected)
##########################################
#Classify testing set
##########################################
confusion_matrix = dict()
count_unselected = []
print 'Total points', total_pts
for idx in unselected:
start_time = time.time()
if test_pca:
prediction, _ = classifier.predict(data.reduce(data.inputs[:,idx]))
else:
prediction, _ = classifier.predict(data.inputs[:,idx])
classification_times.append(time.time() - start_time)
true_val = data.outputs[:,idx]
if prediction == true_val:
count_unselected.append(1)
else:
count_unselected.append(0)
if confusion_matrix.has_key(true_val[0,0]):
if confusion_matrix[true_val[0,0]].has_key(prediction[0,0]):
confusion_matrix[true_val[0,0]][prediction[0,0]] = confusion_matrix[true_val[0,0]][prediction[0,0]] + 1
else:
confusion_matrix[true_val[0,0]][prediction[0,0]] = 1
else:
confusion_matrix[true_val[0,0]] = dict()
confusion_matrix[true_val[0,0]][prediction[0,0]] = 1
training_error = 100.0 * np.sum(count_selected) / float(len(subset))
testing_error = 100.0 * np.sum(count_unselected) / float(len(unselected))
testing_errors.append(testing_error)
training_errors.append(training_error)
print 'Correct on training set', training_error, '%'
print ' on testing set', testing_error, '%'
print 'Confusion'
for k in confusion_matrix.keys():
sum = 0.0
for k2 in confusion_matrix[k]:
sum = sum + confusion_matrix[k][k2]
for k2 in confusion_matrix[k]:
print 'true class', k, 'classified as', k2, 100.0 * (confusion_matrix[k][k2] / sum), '% of the time'
def print_stats(name, list_data):
m = np.matrix(list_data)
print '%s: average %f std %f' % (name, m.mean(), np.std(m))
print_stats('training error', training_errors)
print_stats('testing error', testing_errors)
print_stats('build time', build_times)
print_stats('classification time', classification_times)
if __name__ == '__main__':
test_iris = False
test_pickle = True
test_number_trees = False
test_pca = False
if test_iris:
#Setup for repeated testing
iris_array = np.matrix(np.loadtxt('iris.data', dtype='|S30', delimiter=','))
inputs = np.float32(iris_array[:, 0:4]).T
outputs = iris_array[:, 4].T
dataset = Dataset(inputs, outputs)
print '================================'
print "Test DecisionTree"
evaluate_classifier(DecisionTree, dataset, 5, .9)
print '================================'
#print "Test random forest"
#for i in range(4):
# #print "Test RFRandomInputSubset"
# #evaluate_classifier(RFRandomInputSubset, dataset, 1, .7)
# print "Test RFBreiman"
# evaluate_classifier(RFEntropySplitRandomInputSubset, dataset, 1, .7)
if test_pickle:
import pickle as pk
def load_pickle(filename):
p = open(filename, 'r')
picklelicious = pk.load(p)
p.close()
return picklelicious
def print_separator(times=2):
for i in xrange(times):
print '==============================================================='
dataset = load_pickle('PatchClassifier.dataset.pickle')
#if test_pca:
# print_separator(1)
# print_separator(1)
# dataset.reduce_input()
if test_number_trees:
tree_types = [RFBreiman, RFRandomInputSubset]
#tree_types = [RFBreiman]
for tree_type in tree_types:
print_separator()
print 'Testing', tree_type
for i in range(10):
print tree_type, 'using', (i+1)*10, 'trees'
evaluate_classifier(tree_type, dataset, 3, .95,
extra_args={'number_of_learners': (i+1)*10}, test_pca=test_pca)
else:
tree_types = [RFBreiman, RFRandomInputSubset]
#tree_types = [RFRandomInputSubset]
for tree_type in tree_types:
print_separator()
print tree_type
evaluate_classifier(tree_type, dataset, 10, .95,
extra_args={'number_of_learners': 70}, test_pca=test_pca)
| [
[
1,
0,
0.0574,
0.002,
0,
0.66,
0,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0594,
0.002,
0,
0.66,
0.0476,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0614,
0.002,
0,
0.6... | [
"import numpy as np",
"import itertools as it",
"import functools as ft",
"import time",
"class Dataset:\n def __init__(self, inputs, outputs):\n \"\"\"\n inputs coded as numpy array, column vectors\n outputs also as numpy array, column vectors\n \"\"\"\n self.i... |
#from sound_play.libsoundplay import SoundClient
import hrl_lib.tf_utils as tfu
from std_msgs.msg import String
import rospy
import tf
import subprocess as sb
import numpy as np
import geometry_msgs.msg as gms
import os
class LaserPointerClient:
def __init__(self, target_frame='/base_link', tf_listener=None):
self.dclick_cbs = []
self.point_cbs = []
self.target_frame = target_frame
self.laser_point_base = None
self.base_sound_path = (sb.Popen(["rospack", "find", "laser_interface"], stdout=sb.PIPE).communicate()[0]).strip()
#self.sound = SoundClient()
if tf_listener == None:
self.tf_listener = tf.TransformListener()
else:
self.tf_listener = tf_listener
rospy.Subscriber('cursor3d', gms.PointStamped, self.laser_point_handler)
self.double_click = rospy.Subscriber('mouse_left_double_click', String, self.double_click_cb)
os.system("aplay %s" % (self.base_sound_path + '/sounds/beep_beep.wav'))
#self.sound.waveSound().play()
def transform_point(self, point_stamped):
point_head = point_stamped.point
#Tranform into base link
base_T_head = tfu.transform(self.target_frame, point_stamped.header.frame_id, self.tf_listener)
point_mat_head = tfu.translation_matrix([point_head.x, point_head.y, point_head.z])
point_mat_base = base_T_head * point_mat_head
t_base, _ = tfu.matrix_as_tf(point_mat_base)
return np.matrix(t_base).T
def laser_point_handler(self, point_stamped):
#self.sound.waveSound(self.base_sound_path + '/sounds/blow.wav').play()
#os.system("aplay %s" % (self.base_sound_path + '/sounds/beeeeeep.wav'))
self.laser_point_base = self.transform_point(point_stamped)
for f in self.point_cbs:
f(self.laser_point_base)
def double_click_cb(self, a_str):
rospy.loginfo('Double CLICKED')
#self.sound.waveSound(self.base_sound_path + '/sounds/beep.wav').play()
os.system("aplay %s" % (self.base_sound_path + '/sounds/beep_beep.wav'))
#if self.laser_point_base != None:
for f in self.dclick_cbs:
f(self.laser_point_base)
self.laser_point_base = None
def add_double_click_cb(self, func):
self.dclick_cbs.append(func)
def add_point_cb(self, func):
self.point_cbs.append(func)
| [
[
1,
0,
0.0323,
0.0161,
0,
0.66,
0,
5,
0,
1,
0,
0,
5,
0,
0
],
[
1,
0,
0.0484,
0.0161,
0,
0.66,
0.125,
366,
0,
1,
0,
0,
366,
0,
0
],
[
1,
0,
0.0645,
0.0161,
0,
0.66,... | [
"import hrl_lib.tf_utils as tfu",
"from std_msgs.msg import String",
"import rospy",
"import tf",
"import subprocess as sb",
"import numpy as np",
"import geometry_msgs.msg as gms",
"import os",
"class LaserPointerClient:\n\n def __init__(self, target_frame='/base_link', tf_listener=None):\n ... |
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Willow Garage, Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
## @author Hai Nguyen/hai@gatech.edu
import os
import sys
import camera as cam
import re
import time
import random_forest as rf
#import opencv as cv
#import opencv.highgui as hg
import cv
import util as ut
from laser_detector import *
def count_down(times=3):
for i in range(times):
print 'in ', times - i
time.sleep(1)
def evaluate_classifier():
rf.evaluate_classifier(rf.RFBreiman, load_pickle('PatchClassifier.dataset.pickle'), 1, .7)
def show_processed(image, masks, detection, blobs, detector):
masker = Mask(image)
splitter = SplitColors(image)
r, g, b = splitter.split(image)
thresholded_image = masker.mask(masks[0], r, g, b)
draw_detection(thresholded_image, detection)
cv.ShowImage('thresholded', thresholded_image)
draw_detection(image, detection)
draw_blobs(image, blobs)
make_visible_binary_image(masks[0])
draw_detection(masks[0], detection)
make_visible_binary_image(masks[1])
make_visible_binary_image(masks[2])
cv.ShowImage("video", image)
cv.ShowImage('motion', masks[1])
cv.ShowImage('intensity', masks[2])
key = cv.WaitKey(10)
if detector != None:
if key == 'T': #down
detector.intensity_filter.thres_high = detector.intensity_filter.thres_high - 5
print 'detector.intensity_filter.thres =', detector.intensity_filter.thres_high
if key == 'R':
detector.intensity_filter.thres_high = detector.intensity_filter.thres_high + 5
print 'detector.intensity_filter.thres =', detector.intensity_filter.thres_high
if key == ' ':
cv.WaitKey()
def confirmation_prompt(confirm_phrase):
print confirm_phrase
print 'y(es)/n(no)'
k = cv.WaitKey()
if k == 'y':
return True
else:
return False
def learn_run(exposure = LaserPointerDetector.SUN_EXPOSURE, num_examples_to_collect=200, display_during_run = True):
cv.NamedWindow("video", 1)
cv.NamedWindow("thresholded", 1)
cv.NamedWindow('motion', 1)
cv.NamedWindow('intensity', 1)
cv.MoveWindow("video", 0, 0)
cv.MoveWindow("thresholded", 800, 0)
cv.MoveWindow("intensity", 0, 600)
cv.MoveWindow("motion", 800, 600)
#TODO: plug in some image source
#video = cam.VidereStereo(0, gain=96, exposure=exposure)
frames = video.next()
detector = LaserPointerDetector(frames[0], exposure=exposure,
dataset=PatchClassifier.DEFAULT_DATASET_FILE,
use_color=False, use_learning=False)
detector2 = LaserPointerDetector(frames[1], exposure=exposure,
dataset=PatchClassifier.DEFAULT_DATASET_FILE,
use_color=False, use_learning=False)
def append_examples_to_file(dataset, file = PatchClassifier.DEFAULT_DATASET_FILE):
try:
loaded_set = load_pickle(file)
dataset.append(loaded_set)
except IOError:
pass
dump_pickle(dataset, file)
print 'Saved examples!'
#Gather positive examples from laser detector
if confirmation_prompt('gather positive examples?'):
print 'Lets gather some positive examples... we need', num_examples_to_collect, 'examples'
positive_examples_for_classifier = []
count_down(0)
for i in xrange(10):
frames = video.next()
detector.detect(frames[0])
detector2.detect(frames[1])
for img in video:
image = None
combined = None
motion = None
intensity = None
laser_blob = None
intensity_motion_blob = None
for raw_image, detect in zip(img, [detector, detector2]):
before = time.time()
image, combined, laser_blob, intensity_motion_blob = detect.detect(raw_image)
diff = time.time() - before
#print 'took %.2f seconds to run or %.2f fps' % (diff, 1.0/diff)
if laser_blob != None:
instance = blob_to_input_instance(image, laser_blob)
if instance is not None:
positive_examples_for_classifier.append(instance)
print 'got', len(positive_examples_for_classifier), 'instances'
motion, intensity = detect.get_motion_intensity_images()
show_processed(image, [combined, motion, intensity], laser_blob, intensity_motion_blob, detector2)
if len(positive_examples_for_classifier) > num_examples_to_collect:
break
positive_instances_dataset = matrix_to_dataset(ut.list_mat_to_mat(positive_examples_for_classifier, axis=1))
append_examples_to_file(positive_instances_dataset)
if confirmation_prompt('gather negative examples?'):
#Gather negative examples from laser detector
print 'lets gather some negative examples... we need', num_examples_to_collect,' examples'
negative_examples_for_classifier = []
count_down(10)
for i in xrange(10):
frames = video.next()
detector.detect(frames[0])
detector2.detect(frames[1])
for img in video:
image = None
combined = None
motion = None
intensity = None
laser_blob = None
intensity_motion_blob = None
for raw_image, detect in zip(img, [detector, detector2]):
image, combined, laser_blob, intensity_motion_blob = detect.detect(raw_image)
if laser_blob != None:
instance = blob_to_input_instance(image, laser_blob)
if instance is not None:
negative_examples_for_classifier.append(instance)
print 'got', len(negative_examples_for_classifier), 'instances'
motion, intensity = detect.get_motion_intensity_images()
show_processed(image, [combined, motion, intensity], laser_blob, intensity_motion_blob, detector2)
if len(negative_examples_for_classifier) > (num_examples_to_collect*2):
break
negative_instances_dataset = matrix_to_dataset(ut.list_mat_to_mat(negative_examples_for_classifier, axis=1))
append_examples_to_file(negative_instances_dataset)
if confirmation_prompt('run classifier?'):
run(exposure, video = video, display=display_during_run)
def run(exposure, video=None, display=False, debug=False):
if display:
cv.NamedWindow("video", 1)
cv.MoveWindow("video", 0, 0)
if debug:
cv.NamedWindow('right', 1)
cv.MoveWindow("right", 800, 0)
cv.NamedWindow("thresholded", 1)
cv.NamedWindow('motion', 1)
cv.NamedWindow('intensity', 1)
cv.MoveWindow("thresholded", 800, 0)
cv.MoveWindow("intensity", 0, 600)
cv.MoveWindow("motion", 800, 600)
if video is None:
#video = cam.VidereStereo(0, gain=96, exposure=exposure)
video = cam.StereoFile('measuring_tape_red_left.avi','measuring_tape_red_right.avi')
frames = video.next()
detector = LaserPointerDetector(frames[0], LaserPointerDetector.SUN_EXPOSURE,
use_color=False, use_learning=True)
detector_right = LaserPointerDetector(frames[1], LaserPointerDetector.SUN_EXPOSURE,
use_color=False, use_learning=True, classifier=detector.classifier)
stereo_cam = cam.KNOWN_CAMERAS['videre_stereo2']
for i in xrange(10):
frames = video.next()
detector.detect(frames[0])
detector_right.detect(frames[1])
lt = cv.CreateImage((640,480), 8, 3)
rt = cv.CreateImage((640,480), 8, 3)
for l, r in video:
start_time = time.time()
#l = stereo_cam.camera_left.undistort_img(l)
#r = stereo_cam.camera_right.undistort_img(r)
cv.Copy(l, lt)
cv.Copy(r, rt)
l = lt
r = rt
undistort_time = time.time()
_, _, right_cam_detection, stats = detector_right.detect(r)
if debug:
draw_blobs(r, stats)
draw_detection(r, right_cam_detection)
cv.ShowImage('right', r)
image, combined, left_cam_detection, stats = detector.detect(l)
detect_time = time.time()
if debug:
motion, intensity = detector.get_motion_intensity_images()
show_processed(l, [combined, motion, intensity], left_cam_detection, stats, detector)
elif display:
#draw_blobs(l, stats)
draw_detection(l, left_cam_detection)
cv.ShowImage('video', l)
cv.WaitKey(10)
if right_cam_detection != None and left_cam_detection != None:
x = np.matrix(left_cam_detection['centroid']).T
xp = np.matrix(right_cam_detection['centroid']).T
result = stereo_cam.triangulate_3d(x, xp)
print '3D point located at', result['point'].T,
print 'distance %.2f error %.3f' % (np.linalg.norm(result['point']), result['error'])
triangulation_time = time.time()
diff = time.time() - start_time
print 'Main: Running at %.2f fps, took %.4f s' % (1.0 / diff, diff)
#print ' undistort took %.4f s' % (undistort_time - start_time)
#print ' detection took %.4f s' % (detect_time - undistort_time)
#print ' triangulation took %.4f s' % (triangulation_time - detect_time)
if __name__ == '__main__':
exposure = 0
if sys.argv[2] == 'sun':
exposure = LaserPointerDetector.SUN_EXPOSURE
print 'sun exposure!'
else:
exposure = LaserPointerDetector.NO_SUN_EXPOSURE
if sys.argv[1] == 'run':
print 'Running only...'
run(exposure = exposure, display = True)
if sys.argv[1] == 'learn':
print 'Running only...'
learn_run(exposure = exposure)
##=================================================================================================
##=================================================================================================
#def display_single(detection_source, mask_window='masked', detection_window='cam'):
# for frame, mask, loc, blobs in detection_source:
# make_visible_binary_image(mask)
# hg.cvShowImage(mask_window, mask)
# draw_detection(frame, loc)
# hg.cvShowImage(detection_window, frame)
# hg.cvWaitKey(10)
# yield frame, mask, loc, blobs
#def save_detection(prefix, frame_number, detection_bundle):
# #frame_number = 1
# #for frame, mask, loc, blobs in detection_source:
# frame, mask, loc, blobs = detection_bundle
# frame_name = prefix + 'frame' + str(frame_number) + '.png'
# hg.cvSaveImage(frame_name, frame)
# hg.cvSaveImage(prefix + 'frame' + str(frame_number) + '_mask.png', mask)
#
# pickle_file = open(prefix + 'frame' + str(frame_number) + '.pickle', 'w')
# pk.dump(loc, pickle_file)
# pickle_file.close()
#
# pickle_file = open(prefix + 'frame' + str(frame_number) + '_blobs.pickle', 'w')
# pk.dump(blobs, pickle_file)
# pickle_file.close()
#
# #frame_number = frame_number + 1
# #yield frame, mask, loc, blobs
# return frame, mask, loc, blobs
##=================================================================================================
##=================================================================================================
#def record_videos(stereo, prefix, folder):
# videos = []
# MPEG4 = 0x58564944
# count = 0
# while True:
# key = hg.cvWaitKey()
# while key != ' ':
# key = hg.cvWaitKey()
# left_file = folder + '/' + prefix+str(count) + '_left.avi'
# right_file = folder + '/' + prefix+str(count) + '_right.avi'
# lwrite = hg.cvCreateVideoWriter(left_file, MPEG4, 30, cvSize(640,480))
# rwrite = hg.cvCreateVideoWriter(right_file, MPEG4, 30, cvSize(640,480))
# for left, right in stereo:
# hg.cvWriteFrame(lwrite, left)
# hg.cvWriteFrame(rwrite, right)
# hg.cvShowImage('cam', left)
# key = hg.cvWaitKey(10)
# if key == ' ':
# break
# count = count + 1
# videos.append(left_file)
# videos.append(right_file)
#
# print 'Do you want to record another clip?'
# key = hg.cvWaitKey()
# if key == 'y':
# continue
# if key == 'n':
# break
# return videos
#def record_learn(session_name):
# '''
# NOTE: THIS SET OF FUNCTIONS NEED TO BE TESTED
# '''
# os.mkdir(session_name)
# hg.cvNamedWindow('cam', 1)
# sample_image = cv.cvCreateImage(cv.cvSize(640,480), 8, 3)
# hg.cvShowImage('cam', image)
# video = cam.VidereStereo(0, gain=96, exposure=LaserPointerDetector.SUN_EXPOSURE)
#
# print 'Let\'s gather positive examples, press space bar then point the laser pointer',
# print ' at various objects. Remember to not move the camera! Press spacebar again to stop.'
# positive_files = record_videos(video, 'positive', session_name)
#
# print 'Let\'s gather negative examples, press space bar then point the laser pointer',
# print ' at various objects. Remember to not move the camera! Press spacebar again to stop.'
# negative_files = record_videos(video, 'negative', session_name)
#
# print 'Performing detections, writing out images...'
# files_sets = [('positive/', positive_files), ('negative/', negative_files)]
# for label, files in files_sets:
# start_dir = session_name + '/' + label
# os.mkdir(start_dir)
# idx = 0
# for pair in files:
# for file in pair:
# video = cam.video_file(file)
# detector = LaserPointerDetector(cv.cvCreateImage(cv.cvSize(640,480), 8, 3), use_color=False, use_learning=False)
# frame_number = 0
# for img in video:
# image, mask, laser_blob, intensity_motion_blob = detector.detect(img)
# save_detection(start_dir + str(idx), frame_number, (image, mask, laser_blob, intensity_motion_blob))
# frame_number = frame_number + 1
# idx = idx + 1
#
# print 'running color learner'
# run_color_learner(session_name + '/positive')
#
# print 'running forest learner...'
# run_forest_learner(session_name)
##=================================================================================================
##=================================================================================================
#def as_iter_block(func, input):
# for p in input:
# yield func(p)
#def get_frames_from_folder(folder):
#
# def files_in(folder):
# root, dirs, files = os.walk(folder).next()
# return root, files
#
# def dir_in(folder):
# root, dirs, files = os.walk(folder).next()
# return root, dirs
#
# def select_frames(reg, name):
# return None != reg.match(name)
#
# def append_pref(pref, file):
# return pref + '/' + file
#
# reg = re.compile('\dframe\d*\.png')
# root, files = files_in(folder)
# selected_files = map(ft.partial(append_pref, root), filter(ft.partial(select_frames, reg), files))
# return selected_files
#def run_color_learner(folder):
# cf = ColorFilter((640,480))
# def bw_img_loader(filename):
# return hg.cvLoadImage(filename, hg.CV_LOAD_IMAGE_GRAYSCALE)
# files = get_frames_from_folder(folder)
# cf.learn_sequence(it.izip(cam.file_sequence(selected_files, hg.cvLoadImage),
# cam.file_sequence(selected_files, bw_img_loader, '_mask.png'),
# cam.file_sequence(selected_files, load_pickle, '.pickle')))
#def run_forest_learner(folder):
# pfiles = get_frames_from_folder(folder + '/positive')
# nfiles = get_frames_from_folder(folder + '/negative')
# pc = PatchClassifier()
# pc.learn(positive_examples = it.izip(cam.file_sequence(pfiles, hg.cvLoadImage),
# cam.file_sequence(pfiles, load_pickle, '_blobs.pickle')),
# negative_examples = it.izip(cam.file_sequence(nfiles, hg.cvLoadImage),
# cam.file_sequence(nfiles, load_pickle, '_blobs.pickle')))
##=================================================================================================
##=================================================================================================
#run(exposure = LaserPointerDetector.SUN_EXPOSURE)
#import sys
#session_name = sys.argv[1]
#record_learn(session_name)
##=================================================================================================
##=================================================================================================
## SAND BOX
##=================================================================================================
##=================================================================================================
## ===> Sand!
#def triangulate_cressel(camera, left_coord, right_coord, return_dict = True ):
# """ left_coord, right_coord -> cvPoint
# returns -> (3X1) vector in stereohead coordinate frame, error.
# stereohead coord frame is as defined in transforms.py
# code copied and modified slightly from self.get_3d_coord
# """
#
# right_point = cv.cvCreateMat(3,1,cv.CV_32F)
# left_point = cv.cvCreateMat(3,1,cv.CV_32F)
#
# if left_coord.__class__ == cv.cvPoint(0,0).__class__:
# left_point[0] = float(left_coord.x) # u
# left_point[1] = float(left_coord.y) # v
#
# left_point[2] = 1.0
# else:
# left_point[0] = float(left_coord[0]) # u
# left_point[1] = float(left_coord[1]) # v
# left_point[2] = 1.0
#
# if right_coord.__class__ == cv.cvPoint(0,0).__class__:
# right_point[0] = float(right_coord.x)
# right_point[1] = float(right_coord.y)
# right_point[2] = 1.0
# else:
# right_point[0] = float(right_coord[0])
# right_point[1] = float(right_coord[1])
# right_point[2] = 1.0
# # in the normalized image plane _point is the vector denoted as [ u; v; 1 ]
#
# right_vector = cv.cvCreateMat(3,1,cv.CV_32F)
# left_vector = cv.cvCreateMat(3,1,cv.CV_32F)
# output_vector = cv.cvCreateMat(3,1,cv.CV_32F)
#
# left_inv_intrinsic = camera.camera_left.inv_intrinsic_mat_cv
# right_inv_intrinsic = camera.camera_right.inv_intrinsic_mat_cv
# cv.cvGEMM(left_inv_intrinsic , left_point, 1, None, 1, left_vector, 0)
# cv.cvGEMM(right_inv_intrinsic, right_point, 1, None, 1, right_vector, 0)
#
# lv = np.matrix([left_vector[0], left_vector[1], left_vector[2]]).T
# rv = np.matrix([right_vector[0], right_vector[1], right_vector[2]]).T
#
# te = camera.R * lv
#
# a = cv.cvCreateMat( 3, 2, cv.CV_32F )
# a[0,0], a[1,0], a[2,0] = te[0,0], te[1,0], te[2,0]
# a[0,1], a[1,1], a[2,1] = rv[0,0], rv[1,0], rv[2,0]
#
# params = cv.cvCreateMat( 2, 1, cv.CV_32F )
#
# #linear least squares [X1 -X2]*[al;bet] - trans ~ 0
# # [left right]*[params] -translation ~0
# translation = cv.cvCreateMat(3,1,cv.CV_32F)
# translation[0] = -camera.T[0,0]
# translation[1] = -camera.T[1,0]
# translation[2] = -camera.T[2,0]
#
# cv.cvSolve( a, translation, params , cv.CV_SVD )
# alpha = params[0]
# beta = -params[1]
#
# vec_l = alpha * te + camera.T
# vec_r = beta * rv
#
# #compute reprojection error
# detection_error = np.linalg.norm(vec_r-vec_l)
#
# p = (vec_l + vec_r)/2.
#
# p = np.row_stack((p, np.matrix([1.])))
# # my xyz and cressel's are aligned and so I can use the
# # same transformation matrix -- advait
# #p = tr._stereoT['right'] * p
# p = p[0:3]/p[3,0]
#
# if return_dict:
# return {'output_vector': p, 'error':detection_error}
# else:
# return p, detection_error
##=================================================================================================
##=================================================================================================
| [
[
1,
0,
0.0512,
0.0018,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.053,
0.0018,
0,
0.66,
0.0667,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0548,
0.0018,
0,
0... | [
"import os",
"import sys",
"import camera as cam",
"import re",
"import time",
"import random_forest as rf",
"import cv",
"import util as ut",
"from laser_detector import *",
"def count_down(times=3):\n for i in range(times):\n print('in ', times - i)\n time.sleep(1)",
" for ... |
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Willow Garage, Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
## @author Hai Nguyen/hai@gatech.edu
import numpy as np
#from pylab import *
def pca_gain_threshold(s, percentage_change_threshold=.15):
if s.__class__ != np.ndarray:
raise ValueError('Need ndarray as input.')
shifted = np.concatenate((s[1:].copy(), np.array([s[-1]])), axis=1)
diff = s - shifted
percent_diff = diff / s
positions = np.where(percent_diff < percentage_change_threshold)
return positions[0][0]
def pca_variance_threshold(eigen_values, percent_variance=.9):
eigen_sum = np.sum(eigen_values)
#print 'pca_variance_threshold: eigen_sum', eigen_sum
eigen_normed = np.cumsum(eigen_values) / eigen_sum
positions = np.where(eigen_normed > percent_variance)
print 'pca_variance_threshold: percent_variance', percent_variance
#print positions
return positions[0][0]
def pca(data):
cov_data = np.cov(data)
u, s, vh = np.linalg.svd(cov_data)
return u,s,vh
def pca_vectors(data, percent_variance):
u, s, vh = pca(data)
number_of_vectors = pca_variance_threshold(s, percent_variance=percent_variance)
return np.matrix(u[:,0:number_of_vectors+1])
def randomized_vectors(dataset, number_of_vectors):
rvectors = np.matrix(np.random.random_sample((dataset.num_attributes(), number_of_vectors))) * 2 - 1.0
lengths = np.diag(1.0 / np.power(np.sum(np.power(rvectors, 2), axis=0), 0.5))
return rvectors * lengths
| [
[
1,
0,
0.4462,
0.0154,
0,
0.66,
0,
954,
0,
1,
0,
0,
954,
0,
0
],
[
2,
0,
0.5462,
0.1231,
0,
0.66,
0.2,
171,
0,
2,
1,
0,
0,
0,
5
],
[
4,
1,
0.5154,
0.0308,
1,
0.83,... | [
"import numpy as np",
"def pca_gain_threshold(s, percentage_change_threshold=.15):\n if s.__class__ != np.ndarray:\n raise ValueError('Need ndarray as input.') \n shifted = np.concatenate((s[1:].copy(), np.array([s[-1]])), axis=1)\n diff = s - shifted\n percent_diff = diff / s\n ... |
from pkg import *
import cv
import laser_interface.blob as blob
class CombineMasks:
def __init__(self, sample_image, channels=1):
self.combined = cv.CreateImage(cv.GetSize(sample_image), 8 , channels)
def combine(self, images):
cv.Set(self.combined, 1)
for img in images:
cv.Mul(self.combined, img, self.combined)
return self.combined
class Mask:
def __init__(self, sample_image):
self.thres_red_img = cv.CreateImage(cv.GetSize(sample_image), 8 , 1)
self.thres_green_img = cv.CreateImage(cv.GetSize(sample_image), 8 , 1)
self.thres_blue_img = cv.CreateImage(cv.GetSize(sample_image), 8 , 1)
self.merged_frame = cv.CreateImage(cv.GetSize(sample_image), 8 , 3)
def mask(self, mask, r, g, b):
cv.Mul(r, mask, self.thres_red_img)
cv.Mul(g, mask, self.thres_green_img)
cv.Mul(b, mask, self.thres_blue_img)
cv.Merge(self.thres_blue_img, self.thres_green_img, self.thres_red_img, None, self.merged_frame);
return self.merged_frame
class SplitColors:
def __init__(self, sample_image):
self.green_img = cv.CreateImage(cv.GetSize(sample_image), 8 , 1)
self.red_img = cv.CreateImage(cv.GetSize(sample_image), 8 , 1)
self.blue_img = cv.CreateImage(cv.GetSize(sample_image), 8 , 1)
def split(self, image):
cv.Split(image, self.blue_img, self.green_img, self.red_img, None);
return (self.red_img, self.green_img, self.blue_img)
class BrightnessThreshold:
def __init__(self, sample_image, max_area): #, tune=False):
#self.thres_low = thres_low
#self.thres_high = thres_high
self.max_area = max_area
#self.set_thresholds([thres_low, thres_high])
#self.csplit = SplitColors(sample_image)
#if should_mask:
# self.mask = Mask(sample_image)
self.thresholded_low = cv.CreateImage(cv.GetSize(sample_image), 8 , 1)
self.thresholded_high = cv.CreateImage(cv.GetSize(sample_image), 8 , 1)
self.thresholded_combined = cv.CreateImage(cv.GetSize(sample_image), 8 , 1)
#self.should_mask = should_mask
#self.channel = channel
#self.debug = False
#self.tune = tune
#if tune:
# cv.NamedWindow('low', 1)
# cv.NamedWindow('high', 1)
#def set_thresholds(self, thresholds):
# self.thres_low = thresholds[0]
# self.thresh_high = thresholds[1]
def get_thresholded_image(self):
return self.thresholded_combined
def threshold(self, thres_low, thres_high, thres_chan):
result_val = 1 #Change result_val to 255 if need to view image
cv.Threshold(thres_chan, self.thresholded_low, thres_low, result_val, cv.CV_THRESH_BINARY)
cv.Dilate(self.thresholded_low, self.thresholded_low) #thresholded_low thresholded image using threshold for dark regions
blob.remove_large_blobs(self.thresholded_low, self.max_area)
cv.Threshold(thres_chan, self.thresholded_high, thres_high, result_val, cv.CV_THRESH_BINARY)
cv.Dilate(self.thresholded_high, self.thresholded_high) #thresholded_high thresholded image using threshold for bright regions
blob.remove_large_blobs(self.thresholded_high, self.max_area)#, show=True)
cv.Or(self.thresholded_low, self.thresholded_high, self.thresholded_combined)
return self.thresholded_combined
class MotionSubtract:
def __init__(self, sample_image, max_area, adaptation_rate=0.8, threshold=10):
self.max_area = max_area
self.accumulator = cv.CreateImage(cv.GetSize(sample_image), 32, 1)
cv.SetZero(self.accumulator)
self.thresholded_img = cv.CreateImage(cv.GetSize(sample_image), 8 , 1)
self.difference_img = cv.CreateImage(cv.GetSize(sample_image), 32 , 1)
self.green32_img = cv.CreateImage(cv.GetSize(sample_image), 32 , 1)
self.adaptation_rate = adaptation_rate
self.threshold = threshold
def get_thresholded_image(self):
return self.thresholded_img
def subtract(self, thres_chan):
cv.RunningAvg(thres_chan, self.accumulator, self.adaptation_rate)
cv.CvtScale(thres_chan, self.green32_img)
cv.Sub(self.green32_img, self.accumulator, self.difference_img)
cv.Threshold(self.difference_img, self.thresholded_img, self.threshold, 1, cv.CV_THRESH_BINARY)
cv.Dilate(self.thresholded_img, self.thresholded_img, iterations=1)
blob.remove_large_blobs(self.thresholded_img, max_area = self.max_area)
return self.thresholded_img
def make_visible_binary_image(img):
cv.Threshold(img, img, 0, 255, cv.CV_THRESH_BINARY)
| [
[
1,
0,
0.0095,
0.0095,
0,
0.66,
0,
489,
0,
1,
0,
0,
489,
0,
0
],
[
1,
0,
0.019,
0.0095,
0,
0.66,
0.125,
492,
0,
1,
0,
0,
492,
0,
0
],
[
1,
0,
0.0286,
0.0095,
0,
0.... | [
"from pkg import *",
"import cv",
"import laser_interface.blob as blob",
"class CombineMasks:\n def __init__(self, sample_image, channels=1):\n self.combined = cv.CreateImage(cv.GetSize(sample_image), 8 , channels)\n\n def combine(self, images):\n cv.Set(self.combined, 1)\n for img ... |
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Willow Garage, Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
## @author Hai Nguyen/hai@gatech.edu
#from opencv import cv
#from opencv import highgui
import numpy as np
import pickle as pk
def list_mat_to_mat(list_mat, axis=0):
return np.concatenate(tuple(list_mat), axis=axis)
def load_pickle(filename):
p = open(filename, 'r')
picklelicious = pk.load(p)
p.close()
return picklelicious
def dump_pickle(object, filename):
pickle_file = open(filename, 'w')
pk.dump(object, pickle_file)
pickle_file.close()
#import Image as Image
#cv2np_type_dict = {cv.CV_16S : (np.int16, 1),
# cv.CV_16SC : (np.int16, 1),
# cv.CV_16SC1 : (np.int16, 1),
# cv.CV_16SC2 : (np.int16, 2),
# cv.CV_16SC3 : (np.int16, 3),
# cv.CV_16SC4 : (np.int16, 4),
# cv.CV_16U : (np.uint16, 1),
# cv.CV_16UC : (np.uint16, 1),
# cv.CV_16UC1 : (np.uint16, 1),
# cv.CV_16UC2 : (np.uint16, 2),
# cv.CV_16UC3 : (np.uint16, 3),
# cv.CV_16UC4 : (np.uint16, 4),
# cv.CV_32F : (np.float32, 1),
# cv.CV_32FC : (np.float32, 1),
# cv.CV_32FC1 : (np.float32, 1),
# cv.CV_32FC2 : (np.float32, 2),
# cv.CV_32FC3 : (np.float32, 3),
# cv.CV_32FC4 : (np.float32, 4),
# cv.CV_32S : (np.int32, 1),
# cv.CV_32SC : (np.int32, 1),
# cv.CV_32SC1 : (np.int32, 1),
# cv.CV_32SC2 : (np.int32, 2),
# cv.CV_32SC3 : (np.int32, 3),
# cv.CV_32SC4 : (np.int32, 4),
# cv.CV_64F : (np.float64, 1),
# cv.CV_64FC : (np.float64, 1),
# cv.CV_64FC1 : (np.float64, 1),
# cv.CV_64FC2 : (np.float64, 2),
# cv.CV_64FC3 : (np.float64, 3),
# cv.CV_64FC4 : (np.float64, 4),
# cv.CV_8S : (np.int8, 1),
# cv.CV_8SC : (np.int8, 1),
# cv.CV_8SC1 : (np.int8, 1),
# cv.CV_8SC2 : (np.int8, 2),
# cv.CV_8SC3 : (np.int8, 3),
# cv.CV_8SC4 : (np.int8, 4),
# cv.CV_8U : (np.uint8, 1),
# cv.CV_8UC : (np.uint8, 1),
# cv.CV_8UC1 : (np.uint8, 1),
# cv.CV_8UC2 : (np.uint8, 2),
# cv.CV_8UC3 : (np.uint8, 3),
# cv.CV_8UC4 : (np.uint8, 4)}
#def numpymat2cvmat(nmat):
# raise RuntimeError("numpymat2cvmat: use something else")
# #cvmat = cv.cvCreateMat(nmat.shape[0],nmat.shape[1],cv.CV_32FC1)
# #for i in range(nmat.shape[0]):
# # for j in range(nmat.shape[1]):
# # #print cvmat[i][j]
# # #print nmat[i,j]
# # cvmat[i,j] = nmat[i,j]
# #return cvmat
#
#def cvmat2numpymat(cvmat):
# raise RuntimeError("cvmat2numpymat: use something else")
# #nmat = np.zeros((cvmat.width,cvmat.height))
# #for i in range(cvmat.width):
# # for j in range(cvmat.height):
# # nmat[i][j] = cvmat[i][j]
# #return nmat
#
#def cv2np(im, format='RGB'):
# raise RuntimeError("cv2np: use something else")
# #if format == 'BGR':
# # cv.cvCvtColor( im, im, cv.CV_BGR2RGB )
# #numpy_type, nchannels = cv2np_type_dict[cv.cvGetElemType(im)]
# #array_size = [im.height, im.width, nchannels]
# #np_im = np.frombuffer(im.imageData, dtype=numpy_type,
# # count=im.height*im.width*nchannels*(im.depth/8))
# #return np.reshape(np_im, array_size)
#def np2cv(im):
# raise RuntimeError("np2cv: use something else")
# #image = np2pil( im )
# #image.save('test.bmp', 'BMP')
# #cvim = highgui.cvLoadImage('test.bmp')
# #return cvim
#def np2pil( im ):
# """ for grayscale - all values must be between 0 and 255.
# not sure about color yet.
# """
# raise RuntimeError("np2pil: moved to hrl_lib.util")
# ##TODO: print 'util.np2cv: works for texseg.py'
# ##TODO: print 'util.np2cv: more extensive tests would be useful'
# #if len(im.shape) == 3:
# # shp = im.shape
# # channels = shp[2]
# # height, width = shp[0], shp[1]
# #elif len(im.shape) == 2:
# # height, width = im.shape
# # channels = 1
# #else:
# # raise AssertionError("unrecognized shape for the input image. should be 3 or 2, but was %d." % len(im.shape))
# #
# #if channels == 3:
# # image = Image.fromstring( "RGB", (width, height), im.tostring() )
# #if channels == 1:
# # im = np.array(im, dtype=np.uint8)
# # image = Image.fromarray(im)
# # #image = Image.fromstring( "L", (width, height), im.tostring() )
# #
# #return image
| [
[
1,
0,
0.1813,
0.0058,
0,
0.66,
0,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.1871,
0.0058,
0,
0.66,
0.25,
848,
0,
1,
0,
0,
848,
0,
0
],
[
2,
0,
0.2018,
0.0117,
0,
0.... | [
"import numpy as np",
"import pickle as pk",
"def list_mat_to_mat(list_mat, axis=0):\n\treturn np.concatenate(tuple(list_mat), axis=axis)",
"\treturn np.concatenate(tuple(list_mat), axis=axis)",
"def load_pickle(filename):\n p = open(filename, 'r')\n picklelicious = pk.load(p)\n p.close()\n retu... |
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Willow Garage, Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
import roslib
roslib.load_manifest('laser_interface')
import rospy
CURSOR_TOPIC = 'cursor3d'
VIZ_TOPIC = 'viz_cursor_3d'
MOUSE_CLICK_TOPIC = 'mouse_click'
MOUSE_R_CLICK_TOPIC = 'mouse_r_click'
MOUSE_DOUBLE_CLICK_TOPIC = 'mouse_left_double_click'
MOUSE_R_DOUBLE_CLICK_TOPIC = 'mouse_right_double_click'
LASER_MODE_TOPIC = 'laser_mode'
| [
[
1,
0,
0.7297,
0.027,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.7568,
0.027,
0,
0.66,
0.1111,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.7838,
0.027,
0,
0.66,... | [
"import roslib",
"roslib.load_manifest('laser_interface')",
"import rospy",
"CURSOR_TOPIC = 'cursor3d'",
"VIZ_TOPIC = 'viz_cursor_3d'",
"MOUSE_CLICK_TOPIC = 'mouse_click'",
"MOUSE_R_CLICK_TOPIC = 'mouse_r_click'",
"MOUSE_DOUBLE_CLICK_TOPIC = 'mouse_left_double_click'",
"MOUSE_R_DOUBLE_C... |
from pkg import *
from geometry_msgs.msg import Point
import sys
class Echo:
def echo(self, point):
print 'x y z', point.x, point.y, point.z
rospy.Publisher(CURSOR_TOPIC, Point, Echo().echo)
rospy.init_node('cursor3d_listener')
rospy.spin()
| [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
489,
0,
1,
0,
0,
489,
0,
0
],
[
1,
0,
0.125,
0.0625,
0,
0.66,
0.1667,
951,
0,
1,
0,
0,
951,
0,
0
],
[
1,
0,
0.1875,
0.0625,
0,
0... | [
"from pkg import *",
"from geometry_msgs.msg import Point",
"import sys",
"class Echo:\n def echo(self, point):\n print('x y z', point.x, point.y, point.z)",
" def echo(self, point):\n print('x y z', point.x, point.y, point.z)",
" print('x y z', point.x, point.y, point.z)",
"r... |
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Willow Garage, Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
## @author Hai Nguyen/hai@gatech.edu
#import videre as vd
#import opencv as cv
#from opencv import highgui as hg
from pkg import *
import cv
import numpy as np
from sensor_msgs.msg import CameraInfo
import util as ut
import math as m
import time
###################################################################################################
# Cameras
# The camera classes in this file are separated into two different types of
# classes. In the first group are hardware camera classes meant for
# abstracting away hardware devices that provide a grid of pixels at every
# time step. The second group contain abstract mathematical camera classes
# which satisfies the definition of a camera as a device that transform 3D
# world points into 2D coordinates in a plane.
#
# This was done so that different hardware camera classes can be swapped in
# and out without requiring that the mathematical abstract camera be changed.
# For example, to work off of a video recorded from disk the geometric camera class
# can remain the same while the hardware camera class is swapped for one that
# provide images from a file.
###################################################################################################
###################################################################################################
# Geometric reasoning functions
###################################################################################################
def homo_transform3d(R, t):
T = np.matrix(np.zeros((4,4)))
T[0:3, 0:3] = R
T[0:3, 3] = t
T[3,3] = 1.0
return T
#Rotates the coordinate frame counterclockwise
def Rx(a):
return np.matrix([[1, 0, 0,],
[0, m.cos(a), m.sin(a)],
[0, -m.sin(a), m.cos(a)]])
#Rotates the coordinate frame counterclockwise
def Ry(a):
return np.matrix([[m.cos(a), 0, -m.sin(a)],
[0, 1, 0],
[m.sin(a), 0, m.cos(a)]])
#Rotates the coordinate frame counterclockwise
def Rz(a):
return np.matrix([[ m.cos(a), m.sin(a), 0],
[-m.sin(a), m.cos(a), 0],
[ 0, 0, 1]])
def rotation(rx,ry,rz):
return Rx(rx) * Ry(ry) * Rz(rz)
def points_on_line(homogeneous2d_line, img_height):
a = homogeneous2d_line[0,0]
b = homogeneous2d_line[1,0]
c = homogeneous2d_line[2,0]
if b == 0:
x = -c/a
return [np.matrix([x, 0, 1]).T,
np.matrix([x, img_height, 1])]
else:
return [np.matrix([-c/a, 0, 1]),
np.matrix([(-b/a) * img_height - (c/a), img_height, 1])]
def tuple_to_homo(p):
return np.matrix([p[0], p[1], 1]).T
def cvpoint_to_homo(p):
return np.matrix([p.x, p.y, 1]).T
def homo_to_cvpoint(p):
p = p / p[-1,0]
#return cv.Point(int(round(p[0,0])), int(round(p[1,0])))
return (int(round(p[0,0])), int(round(p[1,0])))
def rodrigues(vec):
cvvec = ut.numpymat2cvmat(vec)
dst = cv.CreateMat(3, 3, cv.CV_32FC1)
cv.Rodrigues2(cvvec, dst)
return ut.cvmat2numpymat(dst).T
def normalize_homo_point(point):
point = point / point[-1,0]
return point
def homo_to_point(homo_point):
p = normalize_homo_point(homo_point)
return p[0:-1,:]
def point_to_homo(point):
return np.concatenate((point, 1.0+np.zeros((1,point.shape[1]))), axis=0)
def general_projection_matrix():
P = np.matrix(np.zeros((3,4)))
P[0:3, 0:3] = np.eye(3)
return P
###################################################################################################
# Hardware Cameras
###################################################################################################
class ROSStereoListener:
def __init__(self, topics, rate=30.0, name='stereo_listener'):
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import hrl_lib.rutils as ru
self.listener = ru.GenericListener(name, [Image, Image], topics, rate)
self.lbridge = CvBridge()
self.rbridge = CvBridge()
def next(self):
#print 'ros_stereo_listener'
lros, rros = self.listener.read(allow_duplication=False, willing_to_wait=True, warn=False, quiet=True)
lcv = self.lbridge.imgmsg_to_cv(lros, 'bgr8')
rcv = self.rbridge.imgmsg_to_cv(rros, 'bgr8')
return lcv, rcv
class StereoFile:
def __init__(self, left_file, right_file):
self.left = cv.CreateFileCapture(left_file);
self.right = cv.CreateFileCapture(right_file);
#self.total_frames = hg.cvGetCaptureProperty(self.left, hg.CV_CAP_PROP_FRAME_COUNT)
def next(self):
tup = (cv.QueryFrame(self.left), cv.QueryFrame(self.right))
#frame_numb = hg.cvGetCaptureProperty(self.left, hg.CV_CAP_PROP_POS_FRAMES )
#if tup[0] == None or tup[1] == None or frame_numb >= self.total_frames:
if tup[0] == None or tup[1] == None:
raise StopIteration()
return tup
def __iter__(self):
return self
###################################################################################################
# Geometric Cameras
###################################################################################################
# StereoCamera(ROSCameraCalibration('/wide_stereo/left/image_rect_color'), ROSCameraCalibration('/wide_stereo/right/image_rect_color'))
class ROSStereoCalibration:
def __init__(self, left_chan, right_chan):
self.left = ROSCameraCalibration(left_chan)
self.right = ROSCameraCalibration(right_chan)
while not self.right.has_msg:
time.sleep(.2)
self.R = np.matrix(np.eye(3)) #Using rectified images, no R needed.
self.T = self.right.P[:, 3].copy() #Copy so that we don't modify P by accident
self.T[0,0] = -self.T[0,0] / self.right.P[0,0] #Adjust for scaling term in projection matrix
##
# @param x
# @param xright 2x1 matrices
def triangulate_3d(self, xleft, xright):
#Klp = np.linalg.inv(self.left.K)
#Krp = np.linalg.inv(self.right.K)
# Use the K embedded in P instead K as
# rectified images are the result of P
Klp = np.linalg.inv(self.left.P[0:3, 0:3])
Krp = np.linalg.inv(self.right.P[0:3, 0:3])
wleft = Klp * point_to_homo(xleft)
wright = Krp * point_to_homo(xright)
print 'ROSStereoCalibration: xleft', wleft.T
print 'ROSStereoCalibration: xright', wright.T
A = np.concatenate((wleft, -self.R * wright), axis=1)
b = self.T
x_hat = np.linalg.inv(A.T * A) * A.T * b
left_estimate = x_hat[0,0] * wleft
right_estimate = x_hat[1,0] * self.R * wright + self.T
print 'ROSStereoCalibration: alpha, beta', x_hat
print 'ROSStereoCalibration: left est', left_estimate.T
print 'ROSStereoCalibration: right est', right_estimate.T
print 'A * x_hat', (A * x_hat).T
print 'T', b.T
print 'A*x-b', np.linalg.norm((A*x_hat) - b)
p = (left_estimate + right_estimate)/2.0
print 'ROSStereoCalibration: p', p.T
return {'point': p, 'error':np.linalg.norm(left_estimate- right_estimate)}
class ROSCameraCalibration:
def __init__(self, channel):
rospy.Subscriber(channel, CameraInfo, self.camera_info)
self.has_msg = False
def camera_info(self, msg):
self.distortion = np.matrix(msg.D)
self.K = np.reshape(np.matrix(msg.K), (3,3))
self.R = np.reshape(np.matrix(msg.R), (3,3))
self.P = np.reshape(np.matrix(msg.P), (3,4))
self.w = msg.width
self.h = msg.height
self.has_msg = True
def project(self, p):
return self.P * p
if __name__ == "__main__":
KNOWN_CAMERAS = {}
test = "test_gain"
if 'test_hdr' == test:
cv.NamedWindow("left_eye", 1)
cv.NamedWindow("right_eye", 1)
cv.NamedWindow("left_eye_low", 1)
cv.NamedWindow("right_eye_low", 1)
cam = VidereHDR(0)
base_exposure = 100
for ll, lr, l, r in cam:
cv.ShowImage("left_eye_low", ll)
cv.ShowImage("right_eye_low", lr)
cv.ShowImage("left_eye", l)
cv.ShowImage("right_eye", r)
key = cv.WaitKey(10)
if 'R' == key: #up
base_exposure = base_exposure + 1
vd.set_exposure(cam.camera.capture, base_exposure)
print base_exposure
elif 'T' == key:
base_exposure = base_exposure - 1
vd.set_exposure(cam.camera.capture, base_exposure)
print base_exposure
| [
[
1,
0,
0.1172,
0.0037,
0,
0.66,
0,
489,
0,
1,
0,
0,
489,
0,
0
],
[
1,
0,
0.1245,
0.0037,
0,
0.66,
0.04,
492,
0,
1,
0,
0,
492,
0,
0
],
[
1,
0,
0.1282,
0.0037,
0,
0.... | [
"from pkg import *",
"import cv",
"import numpy as np",
"from sensor_msgs.msg import CameraInfo",
"import util as ut",
"import math as m",
"import time",
"def homo_transform3d(R, t):\n T = np.matrix(np.zeros((4,4)))\n T[0:3, 0:3] = R\n T[0:3, 3] = t\n T[3,3] = 1.0\n return T",
... |
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Willow Garage, Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
## @author Hai Nguyen/hai@gatech.edu
from pkg import *
from std_msgs.msg import Position
from std_msgs.msg import BaseVel
from std_msgs.msg import RobotBase2DOdom
import sys
import numpy as np
import nodes as n
import camera as cam
import math
from pyrob.voice import say
from StringIO import StringIO
class FollowBehavior:
def __init__(self, velocity_topic):
self.not_inited = True
self.velocity_topic = velocity_topic
self.last_said = ''
def init_pose(self, robot_pose):
R = cam.Rx(math.radians(90)) * cam.Ry(math.radians(-90))
T = np.matrix([-.095, 0,.162]).T
self.base_T_camera = cam.homo_transform3d(R, T)
self.robot_pose = n.ConstNode(robot_pose)
self.local_pos = n.nav.V_KeepLocal_P2d_V(self.robot_pose, n.ConstNode(np.matrix([0.0, 0.0]).T))
self.attr = n.nav.V_LinearAttract_V(self.local_pos, dead_zone = 0.20, far_dist = 1.0)
self.cmd = n.nav.R_Conv_V(self.attr, allow_backwards_driving = False)
self.should_stop = self.attr.is_done()
self.cmd.max_vel = .5
self.has_stopped = False
self.count = 0
self.attr.verbosity = -1
print 'FollowBehavior: ready!'
def cursor_moved(self, point):
#Transform into base's coordinate frame
point3d = np.matrix([point.x, point.y, point.z, 1.0]).T
print 'FollowBehavior.cursor_moved: got point', point3d.T
new_point = self.base_T_camera * point3d
sio = StringIO()
print >>sio, int(round(np.linalg.norm(point3d[0:3]) * 100.0))
new_saying = sio.getvalue()
if new_saying != self.last_said:
say(new_saying)
self.last_said = new_saying
#Drop the z, store as homogeneous coordinates
goal2d = new_point[0:2, 0]
print 'FollowBehavior.cursor_moved: 2d goal', goal2d.T
self.local_pos.remember(n.ConstNode(goal2d))
self.has_stopped = False
def robot_moved(self, update):
if self.not_inited:
self.init_pose(n.Pose2D(update.pos.x, update.pos.y, update.pos.th))
self.not_inited = False
else:
self.robot_pose.const = n.Pose2D(update.pos.x, update.pos.y, update.pos.th)
def run(self):
if self.not_inited:
return
#base_command = self.cmd.val(self.count)
#print 'publishing', base_command.forward_vel, base_command.rot_vel
if self.should_stop.val(self.count) and not self.has_stopped:
self.velocity_topic.publish(BaseVel(0,0))
#print 'stoppping'
self.has_stopped = True
say('done')
elif not self.has_stopped:
#print 'HAS STOPPED'
base_command = self.cmd.val(self.count)
msg = BaseVel(base_command.forward_vel, base_command.rot_vel)
#print 'publishing', base_command.forward_vel, base_command.rot_vel
self.velocity_topic.publish(msg)
self.count = self.count + 1
class FakeTopic:
def publish(self, something):
pass
class FakePoint:
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
if __name__ == '__main__':
import time
pub = rospy.TopicPub('cmd_vel', BaseVel)
follow_behavior = FollowBehavior(pub)
rospy.TopicSub('odom', RobotBase2DOdom, follow_behavior.robot_moved)
rospy.TopicSub(CURSOR_TOPIC, Position, follow_behavior.cursor_moved)
rospy.ready(sys.argv[0])
#follow_behavior.cursor_moved(FakePoint(0.0,0.0,1.0))
while not rospy.isShutdown():
follow_behavior.run()
time.sleep(0.016)
#follow_behavior = FollowBehavior(FakeTopic())
#def transform2D(o_p, o_angle):
# """
# Takes as input o_P_* and angle, both descriptions of the new coordinate
# frame in the original frame (frame o). Returns a transfrom *_T_o that
# describes points in the new coordinate frame (frame *).
# The transformation applies a translation then a rotation.
# """
# t = numpy.matrix(numpy.eye(3))
# t[0:2][:,2] = -1 * o_p
# return rot_mat(o_angle) * t
#
#def rot_mat(a):
# """
# Makes a homogeneous rotation matrix that rotates the coordinate system
# counter cw
# i.e. rotates points clockwise
# """
# return numpy.matrix([[math.cos(a), math.sin(a), 0],
# [-1*math.sin(a), math.cos(a), 0],
# [0, 0, 1]])
#
#class FollowLight:
# def __init__(self, velocity_topic):
# self.base_T_camera = np.matrix(np.zeros((3,4)))
# self.dead_zone = 0.02
# self.far_dist = 1.0 #Distance beyond which we don't care
# self.min_attr = 0.3 #Set min attraction to be 30% of maximum speed
#
# self.velocity_topic = velocity_topic
# self.goal_b = [0.0, 0.0]
# self.A_T_O = transform2d(np.matrix([0.0, 0.0]).T, 0.0)
#
# def cursor_moved(self, point):
# #Transform into base's coordinate frame
# point3d = np.matrix([point.x, point.y, point.z, 1.0]).T
# new_point = self.base_T_camera * point3d
#
# #Drop the z, store as homogeneous coordinates
# self.goal_b = new_point[0:2, 0]
#
# def robot_moved(self, update):
# #Frames
# # A previous position of robot in global frame
# # B current position of robot in global frame
# # O global frame
# B_T_O = transform2d(np.matrix([update.pos.x, update.pos.y]).T,
# update.pos.th)
#
# #transform goal with this update
# goal_a = self.goal_b
# B_T_A = B_T_O * np.linalg.inv(self.A_T_O)
# self.goal_b = B_T_A * goal_a
# self.A_T_O = B_T_O
#
# def run(self):
# #given goal position, calculate velocity vector
# distance = np.linalg.norm(goal)
# if distance > self.dead_zone:
# mag = ((1 - self.min_attr) / (self.far_dist - self.dead_zone)) * norm_dist + self.min_attr
# mag = min(max(mag, self.min_attr), 1.0)
# out = mag * (goal / dist)
# vx =
# else:
# vw =
#
# #send to robot
# self.velocity_topic.publish(BaseVel(vx,vw))
| [
[
1,
0,
0.1078,
0.0037,
0,
0.66,
0,
489,
0,
1,
0,
0,
489,
0,
0
],
[
1,
0,
0.1115,
0.0037,
0,
0.66,
0.0714,
366,
0,
1,
0,
0,
366,
0,
0
],
[
1,
0,
0.1152,
0.0037,
0,
... | [
"from pkg import *",
"from std_msgs.msg import Position",
"from std_msgs.msg import BaseVel",
"from std_msgs.msg import RobotBase2DOdom",
"import sys",
"import numpy as np",
"import nodes as n",
"import camera as cam",
"import math",
"from pyrob.voice import say",
"from StringIO import StringIO"... |
import roslib
roslib.load_manifest('laser_interface')
import laser_interface.camera as cam
from laser_interface.laser_detector import *
import rospy
import cv
stereo_camera = '/wide_stereo'
image_type = 'image_rect_color'
coi = 1
stereo = cam.ROSStereoListener([stereo_camera + '/left/' + image_type, stereo_camera + '/right/' + image_type])
sample_frame, r = stereo.next()
threshold = [100, 240]
splitter = SplitColors(sample_frame)
intensity_filter = BrightnessThreshold(sample_frame, thres_low=threshold[0], thres_high=threshold[1], tune=True)
#intensity_filtered = intensity_filter.threshold(coi)
cv.NamedWindow('low', 1)
cv.NamedWindow('high', 1)
cv.NamedWindow('combined', 1)
cv.NamedWindow('original', 1)
def low_thresh_func(val):
threshold[0] = val
intensity_filter.set_thresholds(threshold)
print 'low', val
def high_thresh_func(val):
threshold[1] = val
intensity_filter.set_thresholds(threshold)
print 'high', val
cv.CreateTrackbar('low_threshold', 'low', threshold[0], 255, low_thresh_func)
cv.CreateTrackbar('high_threshold', 'high', threshold[1], 255, high_thresh_func)
#for image, _ in stereo:
while not rospy.is_shutdown():
image, _ = stereo.next()
r, g, b = splitter.split(image)
filtered_image = intensity_filter.threshold(g)
cv.ShowImage('low', intensity_filter.thresholded_low)
cv.ShowImage('high', intensity_filter.thresholded_high)
#cv.ShowImage('original', g)
cv.ShowImage('combined', filtered_image)
cv.WaitKey(33)
| [
[
1,
0,
0.02,
0.02,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.04,
0.02,
0,
0.66,
0.0455,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.06,
0.02,
0,
0.66,
0.09... | [
"import roslib",
"roslib.load_manifest('laser_interface')",
"import laser_interface.camera as cam",
"from laser_interface.laser_detector import *",
"import rospy",
"import cv",
"stereo_camera = '/wide_stereo'",
"image_type = 'image_rect_color'",
"coi = 1",
"stereo = cam.ROSStereoListener([stereo... |
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Willow Garage, Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
import roslib
roslib.load_manifest('laser_interface')
import rospy
CURSOR_TOPIC = 'cursor3d'
VIZ_TOPIC = 'viz_cursor_3d'
MOUSE_CLICK_TOPIC = 'mouse_click'
MOUSE_R_CLICK_TOPIC = 'mouse_r_click'
MOUSE_DOUBLE_CLICK_TOPIC = 'mouse_left_double_click'
MOUSE_R_DOUBLE_CLICK_TOPIC = 'mouse_right_double_click'
LASER_MODE_TOPIC = 'laser_mode'
| [
[
1,
0,
0.7297,
0.027,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.7568,
0.027,
0,
0.66,
0.1111,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.7838,
0.027,
0,
0.66,... | [
"import roslib",
"roslib.load_manifest('laser_interface')",
"import rospy",
"CURSOR_TOPIC = 'cursor3d'",
"VIZ_TOPIC = 'viz_cursor_3d'",
"MOUSE_CLICK_TOPIC = 'mouse_click'",
"MOUSE_R_CLICK_TOPIC = 'mouse_r_click'",
"MOUSE_DOUBLE_CLICK_TOPIC = 'mouse_left_double_click'",
"MOUSE_R_DOUBLE_C... |
#!/usr/bin/env python
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Willow Garage, Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
## @author Hai Nguyen/hai@gatech.edu
from pkg import *
from std_msgs.msg import String
import wx, time, sys
def key_to_command(key):
ret = None
if key == u'g':
ret = 'debug'
if key == u'd':
ret = 'display'
if key == u'v':
ret = 'verbose'
if key == u' ':
ret = 'rebuild'
if key == u'p':
ret = 'positive'
if key == u'c':
ret = 'clear'
return ret
class KeyHandler(wx.Window):
def __init__(self, parent):
wx.Window.__init__(self, parent, -1, style=wx.WANTS_CHARS, name="sink")
self.Bind(wx.EVT_KEY_DOWN, self.on_key_down)
self.Bind(wx.EVT_LEFT_DOWN, self.on_left_down)
self.Bind(wx.EVT_LEFT_UP, self.on_left_up)
self.Bind(wx.EVT_LEFT_DCLICK, self.on_left_double_click)
self.Bind(wx.EVT_RIGHT_DOWN, self.on_right_down)
self.Bind(wx.EVT_RIGHT_UP, self.on_right_up)
self.Bind(wx.EVT_RIGHT_DCLICK, self.on_right_double_click)
self.Bind(wx.EVT_PAINT, self.on_paint)
self.Bind(wx.EVT_SET_FOCUS, self.on_set_focus)
self.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus)
self.Bind(wx.EVT_SIZE, self.on_size)
self.Bind(wx.EVT_UPDATE_UI, self.on_size)
wx.UpdateUIEvent.SetUpdateInterval(500)
self.mouse_click_pub = rospy.Publisher(MOUSE_CLICK_TOPIC, String).publish
self.mouse_r_click_pub = rospy.Publisher(MOUSE_R_CLICK_TOPIC, String).publish
self.laser_mode_pub = rospy.Publisher(LASER_MODE_TOPIC, String).publish
self.mouse_double_click_pub = rospy.Publisher(MOUSE_DOUBLE_CLICK_TOPIC, String).publish
self.mouse_r_double_click_pub = rospy.Publisher(MOUSE_R_DOUBLE_CLICK_TOPIC, String).publish
rospy.init_node('user_interface_node')
self.SetBackgroundColour(wx.BLACK)
self.focus = False
self.text = ''
self.time = time.time()
self.interval = 1.0
def set_text(self, text):
self.text = text
self.time = time.time()
def on_size(self, evt):
self.Refresh()
def on_set_focus(self, evt):
self.focus = True
self.Refresh()
def on_kill_focus(self, evt):
self.focus = False
self.Refresh()
def on_left_double_click(self, evt):
self.mouse_double_click_pub('True')
self.set_text('DOUBLE CLICKED')
def on_left_down(self, evt):
self.mouse_click_pub('True')
self.set_text('cli....')
self.Refresh()
def on_left_up(self, evt):
self.mouse_click_pub('False')
self.set_text('...cked')
self.Refresh()
def on_right_double_click(self, evt):
self.mouse_r_double_click_pub('True')
self.set_text('R DOUBLE CLICKED')
def on_right_down(self, evt):
self.mouse_r_click_pub('True')
self.set_text('right cli....')
self.Refresh()
def on_right_up(self, evt):
self.mouse_r_click_pub('False')
self.set_text('...cked')
self.Refresh()
def on_key_down(self, evt):
c = unichr(evt.GetRawKeyCode())
command = key_to_command(c)
if command is not None:
#print 'publishing', command
self.laser_mode_pub(command)
self.set_text(command)
else:
self.set_text(unichr(evt.GetRawKeyCode()))
self.Refresh()
def on_paint(self, evt):
dc = wx.PaintDC(self)
font = dc.GetFont()
font.SetPointSize(20)
dc.SetFont(font)
rect = self.GetClientRect()
if self.focus:
dc.SetTextForeground(wx.GREEN)
dc.DrawLabel("Focused.", rect, wx.ALIGN_CENTER)
else:
dc.SetTextForeground(wx.RED)
dc.DrawLabel("Got no focus.", rect, wx.ALIGN_CENTER)
dc.SetTextForeground(wx.WHITE)
dc.DrawLabel('g - debug\nd - display\nv - verbose\np - positive\nc - clear\nspace - rebuild', rect, wx.ALIGN_LEFT | wx.ALIGN_TOP)
if (time.time() - self.time) < self.interval:
dc.SetFont(wx.Font(20, wx.MODERN, wx.NORMAL, wx.NORMAL))
dc.SetTextForeground(wx.WHITE)
dc.DrawLabel(self.text, rect, wx.ALIGN_BOTTOM | wx.ALIGN_CENTER)
app = wx.PySimpleApp()
frame = wx.Frame(None, wx.ID_ANY, name='Clickable World GUI', size=(800,600))
win = KeyHandler(frame)
frame.Show(True)
win.SetFocus()
#rospy.ready(sys.argv[0])
app.MainLoop()
| [
[
1,
0,
0.1734,
0.0058,
0,
0.66,
0,
489,
0,
1,
0,
0,
489,
0,
0
],
[
1,
0,
0.1792,
0.0058,
0,
0.66,
0.1,
366,
0,
1,
0,
0,
366,
0,
0
],
[
1,
0,
0.185,
0.0058,
0,
0.66... | [
"from pkg import *",
"from std_msgs.msg import String",
"import wx, time, sys",
"def key_to_command(key):\n ret = None\n\n if key == u'g':\n ret = 'debug'\n\n if key == u'd':\n ret = 'display'",
" ret = None",
" if key == u'g':\n ret = 'debug'",
" ret = 'debug'... |
#!/usr/bin/python
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Jason Okerman (Healthcare Robotics Lab, Georgia Tech.)
import roslib; roslib.load_manifest('pr2_clutter_helper')
#depnds on sensor_msgs, opencv2, cv_bridge
import rospy
from sensor_msgs.msg import PointCloud
import cv #version 2.1 expected
from cv_bridge import CvBridge
#may need image_transport?
import time #sleep
from random import * #randint
TOPIC_NAME = "tilt_laser_cloud"
global_ros_data = None
'''
Comments:
Traps exactly one message from the topic specified. This is
To run 'main', this assumes the launch of "pr2_laser_snapshotter" with mapping to "tilt_laser_cloud"
Basic use is to import and call "subscribe_once" method.
'''
def init():
rospy.init_node('my_listener', anonymous=True)
def myCallback(data):
print 'callback called'
global global_ros_data
global_ros_data = data
##def listener():
## rospy.init_node('my_listener', anonymous=True)
## rospy.Subscriber("tilt_laser_cloud", PointCloud, cloudCallback)
## rospy.spin()
def subscribe_once(topic_name=TOPIC_NAME, msg_type=PointCloud):
init()
#if not something, init.
s = rospy.Subscriber(topic_name, msg_type, myCallback)
#spin until 1 message is received.
print 'sleeping now: waitin for topic', topic_name
while (not global_ros_image):
time.sleep(.1)
print 'waking and exiting now'
s.unregister()
global global_ros_data
return global_ros_data #value will be returned as 'global_ros_data'
if __name__ == 'main':
data = subscribe_once(TOPIC_NAME, PointCloud)
#assume global_ros_data is defined.
#do something with the pointcloud
for i in range(10):
pt = data.points[i]
print "(%f, %f, %f)" %(pt.x, pt.y, pt.z)
| [
[
1,
0,
0.3444,
0.0111,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.3444,
0.0111,
0,
0.66,
0.0714,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.3667,
0.0111,
0,
0.... | [
"import roslib; roslib.load_manifest('pr2_clutter_helper')",
"import roslib; roslib.load_manifest('pr2_clutter_helper')",
"import rospy",
"from sensor_msgs.msg import PointCloud",
"import cv #version 2.1 expected",
"from cv_bridge import CvBridge",
"import time #sleep",
"from random import * #randint"... |
#!/usr/bin/python
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Jason Okerman (Healthcare Robotics Lab, Georgia Tech.)
"""
Grab data from topic <given> of generic <type>.
"""
import roslib; roslib.load_manifest('pr2_clutter_helper')
#depnds on sensor_msgs, opencv2, cv_bridge
import rospy
from sensor_msgs.msg import PointCloud
import cv #version 2.1 expected
from cv_bridge import CvBridge
#may need image_transport?
import time #sleep
from random import * #randint
TOPIC_NAME = "tilt_laser_cloud"
global_ros_data = None
NODE_NAME = 'my_listener'
'''
Comments:
Traps exactly one message from the topic specified. This is
To run 'main', this assumes the launch of "pr2_laser_snapshotter" with mapping to "tilt_laser_cloud"
Basic use is to import and call "subscribe_once" method.
'''
def init(node_name = NODE_NAME):
rospy.init_node(node_name, anonymous=True)
def myCallback(data):
print 'callback called'
global global_ros_data
global_ros_data = data
##def listener():
## rospy.init_node('my_listener', anonymous=True)
## rospy.Subscriber("tilt_laser_cloud", PointCloud, cloudCallback)
## rospy.spin()
def subscribe_once(topic_name=TOPIC_NAME, msg_type=PointCloud):
init()
#if not something, init.
s = rospy.Subscriber(topic_name, msg_type, myCallback)
#spin until 1 message is received.
print 'sleeping now: waitin for topic', topic_name
while (not global_ros_data):
rospy.sleep(.1)
if rospy.is_shutdown(): #catch a CTRL-C
print '\n Forcing exit'
return False; #check for 'false' on output to catch error results.
print 'waking and exiting now'
s.unregister()
global global_ros_data
return global_ros_data #value will be returned as 'global_ros_data'
if __name__ == 'main':
data = subscribe_once(TOPIC_NAME, PointCloud)
#assume global_ros_data is defined.
#do something with the pointcloud
for i in range(10):
pt = data.points[i]
print "(%f, %f, %f)" %(pt.x, pt.y, pt.z)
| [
[
8,
0,
0.3367,
0.0306,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3571,
0.0102,
0,
0.66,
0.0625,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.3571,
0.0102,
0,
0.66... | [
"\"\"\"\nGrab data from topic <given> of generic <type>.\n\"\"\"",
"import roslib; roslib.load_manifest('pr2_clutter_helper')",
"import roslib; roslib.load_manifest('pr2_clutter_helper')",
"import rospy",
"from sensor_msgs.msg import PointCloud",
"import cv #version 2.1 expected",
"from cv_bridge import... |
#!/usr/bin/python
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Jason Okerman (Healthcare Robotics Lab, Georgia Tech.)
import roslib; roslib.load_manifest('pr2_clutter_helper')
from sensor_msgs.msg import CameraInfo
import sys
import rospy
from pr2_lcs_helper.srv import * #Get four .srv definitions
''' Usage: topic_name = None for default topic (listed in launch file), or
a string refering to ROS topic; msg_type is string refering to
returned msg type; and srv_type is a srv object (not string) generally
named 'Get'+msg_type
This client should be run to demonstrate success of the get_msg_server.py service.
'''
def get_single_msg(topic_name, msg_type, srv_type):
service_name = 'get_'+msg_type
rospy.wait_for_service(service_name)
try:
get_one_msg = rospy.ServiceProxy(service_name, srv_type)
return get_one_msg(topic_name, msg_type)
except:
print 'Failed to acquire message from topic', topic_name
return None
def create_cam_model( info_msg):
from image_geometry import PinholeCameraModel
import numpy as np
cam_model = PinholeCameraModel()
# <have an info message >
cam_model.fromCameraInfo(info_msg)
print 'cam_model = ', np.array( cam_model.intrinsicMatrix() )
print 'cam tf = ', cam_model.tfFrame()
return cam_model
def grab_tf(child_id = '/wide_stereo_optical_frame', frame_id = '/base_footprint'):
#hopefully unused
topic = 'tf'
tf_msg = None
#tf publishes tfMessage which is a container holding a TransformStamped
n=0
# < grab tf messages until correct one is fetched >
while not tf_msg:
print 'try #', n; n+=1
resp = get_single_msg(topic, 'tfMessage', GettfMessage)
tf_msg = resp.transform
if tf_msg.header.frame_id == frame_id and tf_msg.child_frame_id==child_id:
break;
else: tf_msg = None
print 'Got a tf', tf_msg, tf_msg.child_frame_id
return tf_msg
def usage():
return "%s [x y]"%sys.argv[0]
if __name__ == "__main__":
topic = '/wide_stereo/right/camera_info'
resp = get_single_msg(topic, 'CameraInfo', GetCameraInfo)
info_msg = resp.info
topic = '/wide_stereo/right/image_rect_color'
resp = get_single_msg(topic, 'Image', GetImage)
image_msg = resp.image
print 'got image with h=', image_msg.height
topic = '/wide_stereo/right/image_rect_color'
resp = get_single_msg(topic, 'Image', GetImage)
image_msg = resp.image
print "creating_cam_model"
cam_model = create_cam_model(info_msg)
print "Done ; next is to write transform"
#---------------------------------------------
'''
frame_id = 'base_footprint'
acquisition_time = info_msg.header.stamp #type is ros.Time
timeout = rospy.Duration(10) #at most wait 5 seconds
do_some_tf():
cam_frame = '/wide_stereo_optical_frame' #cam_model.tfFrame()
other_frame = '/base_footprint'
print "cam model frame :", cam_model.tfFrame()
import tf
# <frame1 to frame2, time, timeout >
try:
rospy.init_node('client_calling_tf')
print 'make listener'
tf_listener = tf.TransformListener()
print 'wait'
latest = rospy.Time(0) #hack -- actually want time synchronized.
#tf_listener.waitForTransform(cam_frame, other_frame, acquisition_time, timeout);
#(trans,rot)
print 'get tf now'
print 'skipping transform'
#transform = tf_listener.lookupTransform(cam_frame, other_frame);
except:
print "[get] TF exception: "
return
print "the transform is ", transform
return transform
do_some_tf()
print "tf done"
'''
| [
[
1,
0,
0.2041,
0.0068,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.2041,
0.0068,
0,
0.66,
0.0833,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.2109,
0.0068,
0,
0.... | [
"import roslib; roslib.load_manifest('pr2_clutter_helper')",
"import roslib; roslib.load_manifest('pr2_clutter_helper')",
"from sensor_msgs.msg import CameraInfo",
"import sys",
"import rospy",
"from pr2_lcs_helper.srv import * #Get four .srv definitions",
"''' Usage: topic_name = None for default topic... |
#!/usr/bin/python
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Jason Okerman (Healthcare Robotics Lab, Georgia Tech.)
import roslib; roslib.load_manifest('pr2_clutter_helper')
#depnds on sensor_msgs, opencv2, cv_bridge
import rospy
from sensor_msgs.msg import PointCloud
import cv #version 2.1 expected
from cv_bridge import CvBridge
#may need image_transport?
import time #sleep
from random import * #randint
TOPIC_NAME = "tilt_laser_cloud"
global_ros_data = None
'''
Comments:
traps exactly one message from the topic specified. This is
assumes the launch of "pr2_laser_snapshotter" with mapping to "tilt_laser_cloud"
'''
def myCallback(data):
print 'callback called'
global global_ros_data
global_ros_data = data
##def listener():
## rospy.init_node('my_listener', anonymous=True)
## rospy.Subscriber("tilt_laser_cloud", PointCloud, cloudCallback)
## rospy.spin()
def subscribe_once(topic_name=TOPIC_NAME, msg_type=PointCloud):
rospy.init_node('my_listener', anonymous=True)
s = rospy.Subscriber(topic_name, msg_type, myCallback)
#spin until 1 message is received.
print 'sleeping now'
while (not global_ros_image):
rospy.sleep(.1)
print 'waking and exiting now'
s.unregister()
return #value will be returned as 'global_ros_data'
if __name__ == 'main':
subscribe_once(TOPIC_NAME, PointCloud)
#assume global_ros_data is defined.
#do something with the pointcloud
for i in range(10):
pt = global_ros.points[i]
print "(%f, %f, %f)" %(pt.x, pt.y, pt.z)
| [
[
1,
0,
0.3614,
0.012,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.3614,
0.012,
0,
0.66,
0.0769,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.3855,
0.012,
0,
0.66,... | [
"import roslib; roslib.load_manifest('pr2_clutter_helper')",
"import roslib; roslib.load_manifest('pr2_clutter_helper')",
"import rospy",
"from sensor_msgs.msg import PointCloud",
"import cv #version 2.1 expected",
"from cv_bridge import CvBridge",
"import time #sleep",
"from random import * #randint"... |
#!/usr/bin/python
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Jason Okerman (Healthcare Robotics Lab, Georgia Tech.)
import roslib; roslib.load_manifest('pr2_clutter_helper')
from pr2_lcs_helper.srv import *
import rospy
from std_msgs.msg import String
from sensor_msgs.msg import PointCloud
from sensor_msgs.msg import ChannelFloat32
from geometry_msgs.msg import Point32
'''
This function publishes a sensor_msgs.msg.PointCloud object for rviz
It doesn't import anything but generates points in a rectangular region and
lets this region move accross the screen over time.
The frame is '/my_frame', so rviz view frame must be changed accordingly.
NOT FINISHED YET, have not tested -- hope to soon!
'''
pub=''
def handle_service_request(req):
#<generate data to send in this function>
cloud = req.cloud
try:
#cloud = local_rand_cloud()
#cloud.header.frame_id = '/my_frame'
#cloud.header.stamp = rospy.Time.now()
print 'sending cloud at time', cloud.header.stamp, '&', rospy.Time.now()
global pub
pub.publish(cloud)
return True
except:
return False
def start_server():
rospy.init_node('cloud_broadcaster_node')
s = rospy.Service('pub_cloud_service', CloudPub, handle_service_request)
print "Ready to publish cloud"
global pub
pub = start_publisher()
rospy.spin()
#rospy.sleep(.5) #possibly publish periodically
def start_publisher():
#global pub
pub = rospy.Publisher('my_cloud_chatter', PointCloud)
#rospy.init_node('point_cloud_broadcaster')
## while not rospy.is_shutdown():
#cloud = local_rand_cloud()
#cloud.header.frame_id = '/my_frame'
#cloud.header.stamp = rospy.Time.now()
#print 'NOT YET sending cloud at time', cloud.header.stamp
#pub.publish(cloud)
## rospy.sleep(1) #one second
return pub
if __name__ == '__main__':
try:
# talker()
start_server()
except rospy.ROSInterruptException: pass
'''
def local_rand_cloud()
### Create a new cloud object and stuff it
from random import *
ROS_pointcloud = PointCloud() #sensor_msgs.msg.PointCloud()
x = 0 #const offset easy to change.
#stuff point cloud with random points in a rectangle which drifts over time.
#Add an extra intensity channel as well.
intensity_channel = ChannelFloat32()
intensity_channel.name = 'intensities'
for i in range(3000):
intensity_channel.values += [random()]
for i in range(3000):
ROS_pointcloud.points += [Point32(random()*5-x,random(), intensity_channel.values[i])]
#rgb color has maximum value of 0xFFFFFF
rgb_channel = ChannelFloat32()
rgb_channel.name = 'rgb'
rgb_channel.values = normList(intensity_channel.values, 0xFF)
#Separate r,g,b channels range betweeon 0 and 1.0.
r, g, b = [], [], []
for pt in ROS_pointcloud.points:
b += [pt.y];
r += [pt.z];
g += [0];
r_channel = ChannelFloat32(name='r', values = normList(r) )
g_channel = ChannelFloat32(name='g', values = normList(g) )
b_channel = ChannelFloat32(name='b', values = b)
ROS_pointcloud.channels = (intensity_channel, rgb_channel, r_channel, g_channel, b_channel)
return ROS_pointcloud
def normList(L, normalizeTo=1):
### normalize values of a list to make its max = normalizeTo
vMax = max(L)
if vMax == 0: vMax = 1; #avoid divide by zero
return [ x/(vMax*1.0)*normalizeTo for x in L]
'''
| [
[
1,
0,
0.2123,
0.0068,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.2123,
0.0068,
0,
0.66,
0.0714,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.2192,
0.0068,
0,
0.... | [
"import roslib; roslib.load_manifest('pr2_clutter_helper')",
"import roslib; roslib.load_manifest('pr2_clutter_helper')",
"from pr2_lcs_helper.srv import *",
"import rospy",
"from std_msgs.msg import String",
"from sensor_msgs.msg import PointCloud",
"from sensor_msgs.msg import ChannelFloat32",
"from... |
#!/usr/bin/python
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Jason Okerman (Healthcare Robotics Lab, Georgia Tech.)
import roslib; roslib.load_manifest('pr2_clutter_helper')
from pr2_lcs_helper.srv import * #specifically, get CameraInfo.srv"
from sensor_msgs.msg import CameraInfo, PointCloud, Image
#from geometry_msgs.msg import TransformStamped
from tf.msg import tfMessage
import sys
#depnds on sensor_msgs, opencv2, cv_bridge
import rospy
NODE_NAME = 'get_camera_info_server'
TOPIC_NAME = "wide_stereo/right/camera_info"
# Defaults for global values
global msg_type, srv_type, response_type
msg_type = CameraInfo
srv_type = GetCameraInfo
resp_type = GetCameraInfoResponse
global_ros_data = None
'''
Comments:
Traps exactly one message from the topic specified.
Subscribes to the topic, but returns as a service request.
'''
def sub_callback(data):
print '[get] callback called'
global global_ros_data
global_ros_data = data
def subscribe_once(topic_name=TOPIC_NAME, once_msg_type=msg_type):
s = rospy.Subscriber(topic_name, once_msg_type, sub_callback)
#spin until 1 message is received.
print 'sleeping now: waiting for topic', topic_name
global global_ros_data
while (not global_ros_data):
rospy.sleep(.1)
if rospy.is_shutdown(): #catch a CTRL-C
print '\n Forcing exit'
return False; #check for 'false' on output to catch error results.
print 'Returning received message from:', topic_name
s.unregister()
return global_ros_data #value will be returned as 'global_ros_data'
def handle_service_request(req):
topic_name = req.topic_name
#<ignore message type, must be set earlier. Subscribe to topic.>
data = subscribe_once(topic_name, msg_type)
#<generate data to send in this function>
return resp_type( data )
''' Ex: node_name = my_node, service_name = 'get_camera_info'
'''
def get_one_server(node_name, service_name):
rospy.init_node(node_name)
s = rospy.Service(service_name, srv_type, handle_service_request)
print "Ready to get", request
rospy.spin()
#for arg in sys.argv:
# print arg
if __name__ == '__main__':
print 'starting get_server.py'
#request = rospy.resolve_name('request') #wrong syntax
for arg in sys.argv: print '[arg] ', arg
try:
request = sys.argv[1]
print '[get] using msg type of', request
except:
print '[get] using defaults of CameraInfo'
request = 'CameraInfo'
try: default_topic_name = sys.argv[2]
except: print '[get] ignoring default topic name'
try: default_reference_frame = sys.argv[3]
except: print '[get] ignoring default reference frame'
unique_node_name = request + '_server'
unique_service_name = 'get_'+ request
print 'starting service with name: "%s" ' %unique_service_name
msg = {'CameraInfo':CameraInfo, 'Image':Image,
'PointCloud':PointCloud,
'tfMessage': tfMessage}
srv = {'CameraInfo':GetCameraInfo, 'Image':GetImage,
'PointCloud':GetPointCloud,
'tfMessage': GettfMessage}
resp = {'CameraInfo':GetCameraInfoResponse,
'Image':GetImageResponse,
'PointCloud':GetPointCloudResponse,
'tfMessage': GettfMessageResponse}
try:
#global msg_type, srv_type, response_type
msg_type = msg[request]
srv_type = srv[request]
resp_type = resp[request]
except:
print '[get service] unable to handle requested service of type: ', request
sys.exit()
get_one_server(unique_node_name, unique_service_name)
| [
[
1,
0,
0.0233,
0.0233,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.0233,
0.0233,
0,
0.66,
0.1,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.0465,
0.0233,
0,
0.66,... | [
"import roslib; roslib.load_manifest('pr2_clutter_helper')",
"import roslib; roslib.load_manifest('pr2_clutter_helper')",
"from pr2_lcs_helper.srv import * #specifically, get CameraInfo.srv\"",
"from sensor_msgs.msg import CameraInfo, PointCloud, Image",
"from tf.msg import tfMessage",
"import sys",
"im... |
#!/usr/bin/python
#
# Copyright (c) 2010, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# \author Jason Okerman (Healthcare Robotics Lab, Georgia Tech.)
import roslib; roslib.load_manifest('pr2_clutter_helper')
#depnds on sensor_msgs, opencv2, cv_bridge
import rospy
from sensor_msgs.msg import Image as msgImage
import cv #version 2.1 expected
from cv_bridge import CvBridge
#may need image_transport?
import time #sleep
from random import * #randint
global_ros_image = None
def imageCallback(data):
print 'callback called'
#Note: data should be of type sensor_msgs.msg.Image
#rospy.loginfo(rospy.get_name()+"I heard some data from camera")
global global_ros_image
global_ros_image = data
def listener():
rospy.init_node('my_image_listener', anonymous=True)
rospy.Subscriber("wide_stereo/right/image_rect_color", msgImage, imageCallback)
rospy.spin()
if __name__ == '__main__':
cv.NamedWindow('view')
cv.StartWindowThread()
rospy.init_node('my_image_listener', anonymous=True)
a = rospy.Subscriber("wide_stereo/right/image_rect_color", msgImage, imageCallback)
print 'sleeping now' #spin cycle. Similar to "spin_once" ?
while (not global_ros_image):
rospy.sleep(.1)
if rospy.is_shutdown():
print '\nforcing an exit'
break;
print 'waking and exiting now'
if not rospy.is_shutdown():
a.unregister()
br = CvBridge()
im = br.imgmsg_to_cv(global_ros_image)
cv.Erode(im, im, None, 5)
cv.Dilate(im, im, None, 5)
cv.ShowImage('view', im)
cv.WaitKey()
cv.SaveImage('~/Desktop/this_is_a_temporary_image.png', im)
#IDEA: -- 'sleep spin until callback received. then kill subscriber.
| [
[
1,
0,
0.3409,
0.0114,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.3409,
0.0114,
0,
0.66,
0.0909,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.3636,
0.0114,
0,
0.... | [
"import roslib; roslib.load_manifest('pr2_clutter_helper')",
"import roslib; roslib.load_manifest('pr2_clutter_helper')",
"import rospy",
"from sensor_msgs.msg import Image as msgImage",
"import cv #version 2.1 expected",
"from cv_bridge import CvBridge",
"import time #sleep",
"from random import * #r... |
import roslib; roslib.load_manifest('face_reinterpret')
from sensor_msgs.msg import PointCloud
from visualization_msgs.msg import Marker
import rospy
class FaceBox:
def __init__(self):
rospy.Subscriber('/face_detector/faces_cloud', PointCloud, self.callback)
self.box_pub = rospy.Publisher('/face_detector/faces_boxes', Marker)
def callback(self, msg):
if len(msg.points) <= 0:
return
m = Marker()
m.header = msg.header
m.id = 0
m.type = Marker.CUBE
m.action = Marker.ADD
m.pose.position.x = msg.points[0].x
m.pose.position.y = msg.points[0].y
m.pose.position.z = msg.points[0].z
m.scale.x = 0.2
m.scale.y = 0.2
m.scale.z = 0.2
m.color.r = 1.0
m.color.g = 0.0
m.color.b = 0.0
m.color.a = 0.5
m.lifetime = rospy.Duration(10.0)
print m
self.box_pub.publish(m)
if __name__ == '__main__':
rospy.init_node('face_box')
f = FaceBox()
while not rospy.is_shutdown():
rospy.sleep(1.0)
| [
[
1,
0,
0.0263,
0.0263,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.0263,
0.0263,
0,
0.66,
0.1667,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.0526,
0.0263,
0,
0.... | [
"import roslib; roslib.load_manifest('face_reinterpret')",
"import roslib; roslib.load_manifest('face_reinterpret')",
"from sensor_msgs.msg import PointCloud",
"from visualization_msgs.msg import Marker",
"import rospy",
"class FaceBox:\n def __init__(self):\n rospy.Subscriber('/face_detector/fa... |
#!/usr/bin/python
import roslib
roslib.load_manifest( 'robotis' )
import rospy
import robotis.lib_robotis as rs
import time
import math
if __name__ == '__main__':
rospy.logout( 'pr2_ears_stow_startup: Stowing RFID Ears Servos' )
rospy.logout( 'pr2_ears_stow_startup: Connecting to servos' )
dyn_left = rs.USB2Dynamixel_Device( '/dev/robot/servo1' )
pan_left = rs.Robotis_Servo( dyn_left, 29 )
tilt_left = rs.Robotis_Servo( dyn_left, 30 )
dyn_right = rs.USB2Dynamixel_Device( '/dev/robot/servo0' )
pan_right = rs.Robotis_Servo( dyn_right, 27 )
tilt_right = rs.Robotis_Servo( dyn_right, 28 )
# Hack to prevent the right servo from shaking.
pan_right.write_address( 27, [3] ) # change the right pan compliance region
pan_right.write_address( 26, [3] ) # change the right pan compliance region
rospy.logout( 'pr2_ears_stow_startup: Commanding stow positions' )
pan_left.move_angle( 1.370, math.radians( 10 ), False )
tilt_left.move_angle( 0.0, math.radians( 10 ), False )
pan_right.move_angle( -1.370, math.radians( 10 ), False )
tilt_right.move_angle( 0.0, math.radians( 10 ), False )
rospy.logout( 'pr2_ears_stow_startup: Done' )
time.sleep(1.0)
| [
[
1,
0,
0.0811,
0.027,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.1081,
0.027,
0,
0.66,
0.1667,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.1351,
0.027,
0,
0.66,... | [
"import roslib",
"roslib.load_manifest( 'robotis' )",
"import rospy",
"import robotis.lib_robotis as rs",
"import time",
"import math",
"if __name__ == '__main__':\n rospy.logout( 'pr2_ears_stow_startup: Stowing RFID Ears Servos' )\n \n rospy.logout( 'pr2_ears_stow_startup: Connecting to servos... |
##
# Representation of a dataset, operations that can be performed on it, and quantities that can be calculated from it
import numpy as np
import copy
class Dataset:
##
# inputs coded as numpy array, column vectors
# outputs also as numpy array, column vectors
def __init__(self, inputs, outputs):
self.inputs = inputs
self.outputs = outputs
self.metadata = []
assert(inputs.shape[1] == outputs.shape[1])
def num_examples(self):
return self.inputs.shape[1]
def num_attributes(self):
return self.inputs.shape[0]
def add_attribute_descriptor(self, descriptor):
self.metadata.append(descriptor)
#self.metadata[descriptor.name] = descriptor
def append(self, another_dataset):
if self.inputs != None:
self.inputs = np.concatenate((self.inputs, another_dataset.inputs), axis=1)
else:
self.inputs = another_dataset.inputs
if self.outputs != None:
self.outputs = np.concatenate((self.outputs, another_dataset.outputs), axis=1)
else:
self.outputs = another_dataset.outputs
class AttributeDescriptor:
def __init__(self, name, extent):
self.name = name
self.extent = extent
###############################################################################
# Operations on datasets
###############################################################################
##
# Good for leave one out cross validation loops.
# @param dataset
# @param index
def leave_one_out(dataset, index):
inputs = np.column_stack((dataset.inputs[:, :index], dataset.inputs[:, index+1:]))
outputs = np.column_stack((dataset.outputs[:, :index], dataset.outputs[:, index+1:]))
d = Dataset(inputs, outputs)
d.metadata = copy.copy(dataset.metadata)
return d, dataset.inputs[:, index], dataset.outputs[:,index]
##
# Splits up a dataset based on value in a particular attribute
# @param attribute attribute to split on
# @param split_point value in that attribute to split on
def split_continuous(dataset, attribute, split_point):
selected_attribute = dataset.inputs[attribute, :]
leq_bool = selected_attribute <= split_point
_, leq_col = np.where(leq_bool)
#print 'leq_col', leq_col
if leq_col.shape[1] > 0:
leq_dataset = Dataset(dataset.inputs[:, leq_col.A[0]], dataset.outputs[:, leq_col.A[0]])
else:
leq_dataset = Dataset(np.matrix([]), np.matrix([]))
_, gt_col = np.where(~leq_bool)
if gt_col.shape[1] > 0:
gt_dataset = Dataset(dataset.inputs[:, gt_col.A[0]], dataset.outputs[:, gt_col.A[0]])
else:
gt_dataset = Dataset(np.matrix([]), np.matrix([]))
ret_sets = []
if leq_dataset.num_examples() > 0:
ret_sets.append(leq_dataset)
if gt_dataset.num_examples() > 0:
ret_sets.append(gt_dataset)
return ret_sets
##
# Makes bootstrap samples
#
# @param dataset Dataset object
# @param number_samples number of bootstrap set to generate
# @param points_per_sample number of points in each sample
# @return an iterator over bootstrap samples
def bootstrap_samples(dataset, number_samples, points_per_sample):
in_bags, out_bags = [], []
for i in xrange(number_samples):
selected_pts = np.random.randint(0, dataset.inputs.shape[1], points_per_sample)
n_selected_pts = np.setdiff1d(range(dataset.inputs.shape[1]), selected_pts)
selected_inputs = dataset.inputs[:, selected_pts]
selected_outputs = dataset.outputs[:, selected_pts]
n_selected_inputs = dataset.inputs[:, n_selected_pts]
n_selected_outputs = dataset.outputs[:, n_selected_pts]
#print 'Dataset.bootstrap count', i
in_bags.append(Dataset(selected_inputs, selected_outputs))
out_bags.append(Dataset(n_selected_inputs, n_selected_outputs))
return in_bags, out_bags
###############################################################################
# Common quantities calculated from datasets
###############################################################################
##
# Returns unique values represented by an attribute
#
# ex. unique_values(np.matrix([1, 2, 3, 4, 4, 4, 5]), 0)
# returns [1,2,3,4,5]
#
# @param data nxm matrix where each column is a data vector
# @param attribute_number row to find unique values in
def unique_values(data, attribute_number=0):
values = dict()
for instance_idx in xrange(data.shape[1]):
values[data[attribute_number, instance_idx]] = True
k = values.keys()
k.sort()
return k
##
# Caculates the discrete entropy of a data vector
#
# @param data 1xn matrix of discrete values
def entropy_discrete(data):
values = unique_values(data)
#for each output class calculate
def calc_class_entropy(value):
number_in_class = np.sum(data == value)
num_examples = data.shape[1]
percentage_in_class = (number_in_class / float(num_examples))
return -percentage_in_class * np.log2(percentage_in_class)
return np.sum(map(calc_class_entropy, values))
##
# Calculates entropy in a dataset's output labels
#
# @param dataset
def dataset_entropy_discrete(dataset):
return entropy_discrete(dataset.outputs[0,:])
| [
[
1,
0,
0.0196,
0.0065,
0,
0.66,
0,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0261,
0.0065,
0,
0.66,
0.1111,
739,
0,
1,
0,
0,
739,
0,
0
],
[
3,
0,
0.1373,
0.2026,
0,
... | [
"import numpy as np",
"import copy",
"class Dataset:\n\n ## \n # inputs coded as numpy array, column vectors\n # outputs also as numpy array, column vectors\n def __init__(self, inputs, outputs):\n self.inputs = inputs\n self.outputs = outputs",
" def __init__(self, inputs, ou... |
## @author Hai Nguyen/hai@gatech.edu
import roslib; roslib.load_manifest('ml_lib')
import numpy as np
import itertools as it
import functools as ft
import time
import dataset as ds
##
# Base class for random forest classifier
#
class RFBase:
##
# @param dataset Dataset object
# @param number_of_dimensions unclear which direction, but should be around 10-20% of original
# data dimension
# @param number_of_learners limited by processor performance, higher is better
def __init__(self, dataset=None, number_of_dimensions=None, number_of_learners=100):
self.number_of_learners = number_of_learners
self.number_of_dimensions = number_of_dimensions
if dataset != None:
self.train(dataset)
##
# @param data
# @param vote_combine_function function to combine votes, by default
# returns the label with the most votes
def predict(self, data, vote_combine_function=None):
def predict_(learner):
return learner.predict(learner.transform_input(data, learner))
predictions = map(predict_,self.learners)
if vote_combine_function is not None:
return vote_combine_function(predictions)
else:
return mode_exhaustive(predictions)
def train(self, dataset):
pass
def avg_tree_depth(self):
return np.average(map(DecisionTree.get_tree_depth, self.learners))
##
# Train a random forest using DecisionTrees on bootstrap samples using splits
# on random attributes and random values on those attributes.
#
class RFBreiman(RFBase):
def train(self, dataset):
def train_trees(examples_subset):
tree = DecisionTree()
#tree.train(examples_subset, splitting_func=ft.partial(random_subset_split, self.number_of_dimensions))
tree.train(examples_subset, splitting_func=totally_random_split)
#use identity function
tree.transform_input = identity
return tree
if self.number_of_dimensions == None:
self.number_of_dimensions = min(np.log2(dataset.num_attributes()) + 1, 1)
points_per_sample = dataset.num_examples() * 1.0 / 3.0
self.learners = map(train_trees, ds.bootstrap_samples(dataset, self.number_of_learners, points_per_sample))
##
# Train a random forest using DecisionTrees on bootstrap samples where each
# sample has a random subset of dimensions but the split point is performed
# using a minimum entropy criteria.
#
class RFRandomInputSubset(RFBase):
def train(self, dataset):
def train_trees(examples_subset):
#select a subset of dimensions
dims = random_subset(self.number_of_dimensions, examples_subset.num_attributes())
subset_input = examples_subset.inputs[dims, :]
reduced_sample = Dataset(subset_input, examples_subset.outputs)
tree = DecisionTree(reduced_sample)
tree.dimensions_subset = dims
return tree
if self.number_of_dimensions == None:
self.number_of_dimensions = min(np.log2(dataset.num_attributes()) + 1, 1)
points_per_sample = dataset.num_examples() * 1.0 / 3.0
in_bags, out_bags = ds.bootstrap_samples(dataset,
self.number_of_learners,
points_per_sample)
self.learners = map(train_trees, in_bags)
def transform_input(self, input, tree=None):
return input[tree.dimensions_subset, :]
def binary_less_than(attribute, threshold, input_vec):
return input_vec[attribute,0] <= threshold
def binary_greater_than(attribute, threshold, input_vec):
return input_vec[attribute,0] > threshold
def create_binary_tests(attribute, threshold):
return [('binary_less_than', attribute, threshold),
('binary_greater_than', attribute, threshold)]
###############################################################################
# Helper functions
###############################################################################
##
# Finds the mode of a given set
#
def mode_exhaustive(set):
#Count, store in dictionary
mdict = dict()
for s in set:
has_stored = False
keys = mdict.keys()
keys.sort() # sorting these keys gives determinism to the classifier
for k in keys:
if k == s:
mdict[k] = 1+mdict[k]
has_stored = True
if not has_stored:
mdict[s] = 1
#Find the key with maximum votes
max_key = None
max_count = -1
keys = mdict.keys()
keys.sort() # sorting these keys gives determinism to the classifier
for k in keys:
if mdict[k] > max_count:
max_key = k
max_count = mdict[k]
#print 'mode_exhaustive: ', mdict
return max_key, mdict
##
# Find the split that produces subsets with the minimum combined entropy
# return splitting attribute & splitting point for that attribute
#
# @param dataset
def min_entropy_split(dataset):
#print 'in min_entropy_split'
# Assume inputs are continuous, and are column vectors.
hypotheses = []
entropies = []
# For each attribute find the best split point.
for attribute in xrange(dataset.num_attributes()):
values = ds.unique_values(dataset.inputs, attribute)
#Iterate over the possible values of split & calculate entropy for each split.
for split_point in values:
def calc_entropy(data_set):
num_points = data_set.num_examples()
#return (num_points / float(dataset.num_examples())) * data_set.entropy_discrete()
return (num_points / float(dataset.num_examples())) * ds.dataset_entropy_discrete(dataset)
split_entropy = map(calc_entropy, ds.split_continuous(dataset, attribute, split_point))
hypotheses.append((attribute, split_point))
entropies.append(sum(split_entropy))
# Select the attribute split pair that has the lowest entropy.
entropies = np.matrix(entropies)
min_idx = np.argmin(entropies)
return hypotheses[min_idx]
def random_subset(subset_size, total_size):
#print 'in random_subset'
assert(subset_size <= total_size)
occupancy = np.matrix(np.zeros((1, total_size)))
while occupancy.sum() < subset_size:
occupancy[0, np.random.randint(0, total_size)] = 1
rows, columns = np.where(occupancy > 0)
return columns.A[0]
def split_random_subset(subset_size, total_size):
assert(subset_size <= total_size)
occupancy = np.matrix(np.zeros((1, total_size)))
while occupancy.sum() < subset_size:
occupancy[0, np.random.randint(0, total_size)] = 1
bool_sel = occupancy > 0
rows, columns_subset = np.where(bool_sel)
rows, columns_remaining = np.where(np.invert(bool_sel))
return columns_subset.A[0], columns_remaining.A[0]
##
# splitter in decision tree
def random_subset_split(num_subset, dataset):
#print 'in random_subset_split'
#print 'num_subset', num_subset, dataset, 'dataset.input.shape', dataset.inputs.shape
subset_indexes = random_subset(num_subset, dataset.num_attributes())
sub_dataset = Dataset(dataset.inputs[subset_indexes,:], dataset.outputs)
attribute, point = min_entropy_split(sub_dataset)
return subset_indexes[attribute], point
def totally_random_split(dataset):
#print 'totally random'
attr = np.random.randint(0, dataset.num_attributes())
split_pt = dataset.inputs[attr, np.random.randint(0, dataset.num_examples())]
return attr, split_pt
###############################################################################
# Basic DecisionTree that the random forest is based on
class DecisionTree:
def __init__(self, dataset=None, splitting_func=min_entropy_split):
self.children = None
self.prediction = None
if dataset is not None:
self.train(dataset, splitting_func=splitting_func)
def train(self, dataset, splitting_func=min_entropy_split):
if not self.make_leaf(dataset):
#print 'in train.splitting', dataset.num_examples()
self.split_attribute, self.split_point = splitting_func(dataset)
#print 'self.split_attribute, self.split_point', self.split_attribute, self.split_point
data_sets = ds.split_continuous(dataset, self.split_attribute, self.split_point)
if len(data_sets) < 2:
self.prediction = dataset.outputs
return
def tree_split(set):
#print 'tree', set.num_examples()
return DecisionTree(set, splitting_func=splitting_func)
# Create & train child decision nodes
tests = create_binary_tests(self.split_attribute, self.split_point)
self.children = zip(tests, map(tree_split, data_sets))
def make_leaf(self, dataset):
if np.all(dataset.outputs[:,0] == dataset.outputs):
self.prediction = dataset.outputs[:,0]
#print 'leaf'
return True
elif np.all(dataset.inputs[:,0] == dataset.inputs):
self.prediction = dataset.outputs
#print 'leaf'
return True
else:
return False
def predict(self, input):
if self.prediction is not None:
return self.prediction[:, np.random.randint(0, self.prediction.shape[1])]
else:
for test, child in self.children:
test_func_name, attribute, threshold = test
if test_func_name == 'binary_less_than':
test_func = binary_less_than
elif test_func_name == 'binary_greater_than':
test_func = binary_greater_than
else:
rospy.logerr("DecisionTree bad function name : %s" %
test_func_name)
if test_func(attribute, threshold, input):
return child.predict(input)
raise RuntimeError("DecisionTree: splits not exhaustive, unable to split for input" + str(input.T))
##
# Identity function
def transform_input(self, input, tree=None):
return input
def get_tree_depth(self):
if self.prediction is not None:
return 1
depths = []
for test, child in self.children:
depths.append(child.get_tree_depth() + 1)
return max(depths)
##
# Evaluate classifier by dividing dataset into training and test set.
# @param building_func Function that will build classifier given data and args in extra_args.
# @param data Dataset to use for evaluation/training.
# @param times The number of bootstrap samples to take.
# @param percentage The percentage of data to use for training.
# @param extra_args Extra arguments to pass to building_func.
def evaluate_classifier(building_func, data, times=10.0, percentage=None, extra_args={}, test_pca=False):
print 'evaluate_classifier: extra_args', extra_args
total_pts = data.num_examples()
testing_errors = []
training_errors = []
build_times = []
classification_times = []
for i in range(times):
if percentage == None:
percentage = (i+1)/times
num_examples = int(round(total_pts*percentage))
print 'Evaluate classifier built with', percentage*100, '% data, num examples', num_examples
subset, unselected = split_random_subset(num_examples, total_pts)
i = data.inputs[:, subset]
o = data.outputs[:, subset]
print "Building classifier..."
if test_pca:
print ' TESTING PCA'
import dimreduce as dr
subseted_dataset = dr.LinearDimReduceDataset(i,o)
subseted_dataset.set_projection_vectors(dr.pca_vectors(subseted_dataset.inputs, percent_variance=.95))
subseted_dataset.reduce_input()
print 'subseted_dataset.num_attributes(), subseted_dataset.num_examples()', subseted_dataset.num_attributes(), subseted_dataset.num_examples()
else:
subseted_dataset = Dataset(i,o)
start_time = time.time()
classifier = building_func(subseted_dataset, **extra_args)
build_times.append(time.time() - start_time)
print "done building..."
##########################################
#Classify training set
##########################################
count_selected = []
for i, idx in enumerate(subset):
start_time = time.time()
if test_pca:
prediction, _ = classifier.predict(data.reduce(data.inputs[:,idx]))
else:
prediction, _ = classifier.predict(data.inputs[:,idx])
classification_times.append(time.time() - start_time)
true_val = data.outputs[:,idx]
if prediction == true_val:
count_selected.append(1)
else:
count_selected.append(0)
if i%100 == 0:
print i
count_selected = np.matrix(count_selected)
##########################################
#Classify testing set
##########################################
confusion_matrix = dict()
count_unselected = []
print 'Total points', total_pts
for idx in unselected:
start_time = time.time()
if test_pca:
prediction, _ = classifier.predict(data.reduce(data.inputs[:,idx]))
else:
prediction, _ = classifier.predict(data.inputs[:,idx])
classification_times.append(time.time() - start_time)
true_val = data.outputs[:,idx]
if prediction == true_val:
count_unselected.append(1)
else:
count_unselected.append(0)
if confusion_matrix.has_key(true_val[0,0]):
if confusion_matrix[true_val[0,0]].has_key(prediction[0,0]):
confusion_matrix[true_val[0,0]][prediction[0,0]] = confusion_matrix[true_val[0,0]][prediction[0,0]] + 1
else:
confusion_matrix[true_val[0,0]][prediction[0,0]] = 1
else:
confusion_matrix[true_val[0,0]] = dict()
confusion_matrix[true_val[0,0]][prediction[0,0]] = 1
training_error = 100.0 * np.sum(count_selected) / float(len(subset))
testing_error = 100.0 * np.sum(count_unselected) / float(len(unselected))
testing_errors.append(testing_error)
training_errors.append(training_error)
print 'Correct on training set', training_error, '%'
print ' on testing set', testing_error, '%'
print 'Confusion'
for k in confusion_matrix.keys():
sum = 0.0
for k2 in confusion_matrix[k]:
sum = sum + confusion_matrix[k][k2]
for k2 in confusion_matrix[k]:
print 'true class', k, 'classified as', k2, 100.0 * (confusion_matrix[k][k2] / sum), '% of the time'
def print_stats(name, list_data):
m = np.matrix(list_data)
print '%s: average %f std %f' % (name, m.mean(), np.std(m))
print_stats('training error', training_errors)
print_stats('testing error', testing_errors)
print_stats('build time', build_times)
print_stats('classification time', classification_times)
if __name__ == '__main__':
test_iris = False
test_pickle = False
test_number_trees = False
test_pca = False
test_packing = False
test_new_design = True
import pickle as pk
def save_pickle(pickle, filename):
p = open(filename, 'w')
picklelicious = pk.dump(pickle, p)
p.close()
def load_pickle(filename):
p = open(filename, 'r')
picklelicious = pk.load(p)
p.close()
return picklelicious
if test_iris:
#Setup for repeated testing
iris_array = np.matrix(np.loadtxt('iris.data', dtype='|S30', delimiter=','))
inputs = np.float32(iris_array[:, 0:4]).T
outputs = iris_array[:, 4].T
dataset = Dataset(inputs, outputs)
print '================================'
print "Test DecisionTree"
evaluate_classifier(DecisionTree, dataset, 5, .9)
print '================================'
#print "Test random forest"
#for i in range(4):
# #print "Test RFRandomInputSubset"
# #evaluate_classifier(RFRandomInputSubset, dataset, 1, .7)
# print "Test RFBreiman"
# evaluate_classifier(RFEntropySplitRandomInputSubset, dataset, 1, .7)
if test_pickle:
def print_separator(times=2):
for i in xrange(times):
print '==============================================================='
dataset = load_pickle('PatchClassifier.dataset.pickle')
#if test_pca:
# print_separator(1)
# print_separator(1)
# dataset.reduce_input()
if test_number_trees:
tree_types = [RFBreiman, RFRandomInputSubset]
#tree_types = [RFBreiman]
for tree_type in tree_types:
print_separator()
print 'Testing', tree_type
for i in range(10):
print tree_type, 'using', (i+1)*10, 'trees'
evaluate_classifier(tree_type, dataset, 3, .95,
extra_args={'number_of_learners': (i+1)*10}, test_pca=test_pca)
else:
tree_types = [RFBreiman, RFRandomInputSubset]
#tree_types = [RFRandomInputSubset]
for tree_type in tree_types:
print_separator()
print tree_type
evaluate_classifier(tree_type, dataset, 10, .95,
extra_args={'number_of_learners': 70}, test_pca=test_pca)
if test_packing:
train = np.mat(np.random.rand(4, 20))
resp = np.mat(np.round(np.random.rand(1, 20)))
data = ds.Dataset(train, resp)
dt = DecisionTree(data)
packed = dt.pack_tree()
print packed
new_dt = DecisionTree()
new_dt.unpack_tree(packed)
bad = False
for i in range(500):
np.random.seed(i)
test = np.mat(np.random.rand(4, 1))
np.random.seed(1)
pred_old = dt.predict(test)
np.random.seed(1)
pred_new = new_dt.predict(test)
if pred_old != pred_new:
print "Not same prediction:"
print pred_old, pred_new
bad = True
if not bad:
print "Prediction tests successful!"
dt = RFBreiman(data)
packed = dt.pack_rf()
new_dt = RFBreiman()
new_dt.unpack_rf(packed)
bad = False
for i in range(500):
np.random.seed(i)
test = np.mat(np.random.rand(4, 1))
np.random.seed(1)
pred_old, _ = dt.predict(test)
np.random.seed(1)
pred_new, _ = new_dt.predict(test)
if pred_old != pred_new:
print "RF Not same prediction:"
print pred_old, pred_new
bad = True
if not bad:
print "RF Prediction tests successful!"
if test_new_design:
np.random.seed(2)
train = np.mat(np.random.rand(4, 20))
resp = np.mat(np.round(np.random.rand(1, 20)))
data = ds.Dataset(train, resp)
dt = RFBreiman(data)
save_pickle(dt, "rfbreiman.pickle")
dt = load_pickle("rfbreiman.pickle")
preds = []
for i in range(500):
np.random.seed(i)
test = np.mat(np.random.rand(4, 1))
np.random.seed(1)
pred, pred_dict = dt.predict(test)
preds.append(pred[0,0])
print preds
| [
[
1,
0,
0.0039,
0.002,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.0039,
0.002,
0,
0.66,
0.0476,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.0079,
0.002,
0,
0.66,... | [
"import roslib; roslib.load_manifest('ml_lib')",
"import roslib; roslib.load_manifest('ml_lib')",
"import numpy as np",
"import itertools as it",
"import functools as ft",
"import time",
"import dataset as ds",
"class RFBase:\n\n ##\n # @param dataset Dataset object\n # @param number_of_dimen... |
## @author Hai Nguyen/hai@gatech.edu
import roslib
roslib.load_manifest('ml_lib')
import numpy as np
import dataset as ds
import hrl_lib.util as ut
def pca_gain_threshold(s, percentage_change_threshold=.15):
if s.__class__ != np.ndarray:
raise ValueError('Need ndarray as input.')
shifted = np.concatenate((s[1:].copy(), np.array([s[-1]])), axis=1)
diff = s - shifted
percent_diff = diff / s
positions = np.where(percent_diff < percentage_change_threshold)
return positions[0][0]
def pca_variance_threshold(eigen_values, percent_variance=.9):
eigen_sum = np.sum(eigen_values)
#print 'pca_variance_threshold: eigen_sum', eigen_sum
eigen_normed = np.cumsum(eigen_values) / eigen_sum
positions = np.where(eigen_normed >= percent_variance)
print 'pca_variance_threshold: percent_variance', percent_variance
#print 'eigen_normed', eigen_normed
#import pdb
#pdb.set_trace()
if positions[0].shape[0] == 0:
return eigen_normed.shape[0]-1
else:
return positions[0][0]
def pca(data):
cov_data = np.cov(data)
u, s, vh = np.linalg.svd(cov_data)
return u,s,vh
def pca_eigenface_trick(data):
u, s, vh = np.linalg.svd(data.T * data)
orig_u = data * u
orig_u = orig_u / ut.norm(orig_u)
return orig_u, s, None
def pca_vectors(data, percent_variance):
#import pdb
#pdb.set_trace()
if data.shape[1] < data.shape[0]:
print 'pca_vectors: using pca_eigenface_trick since number of data points is less than dim'
u, s, _ = pca_eigenface_trick(data)
#u1, s1, _ = pca(data)
#print 'S', s
#print 'S1', s1
else:
print 'pca_vectors: using normal PCA...'
u, s, _ = pca(data)
#u, s, _ = pca(data)
#import pdb
#pdb.set_trace()
number_of_vectors = pca_variance_threshold(s, percent_variance=percent_variance)
return np.matrix(u[:,0:number_of_vectors+1])
def randomized_vectors(dataset, number_of_vectors):
rvectors = np.matrix(np.random.random_sample((dataset.num_attributes(), number_of_vectors))) * 2 - 1.0
lengths = np.diag(1.0 / np.power(np.sum(np.power(rvectors, 2), axis=0), 0.5))
return rvectors * lengths
##
# Dataset which performs linear dimensionality reduction
class LinearDimReduceDataset(ds.Dataset):
def __init__(self, inputs, outputs):
ds.Dataset.__init__(self, inputs, outputs)
self.original_inputs = inputs
##
# Project this dataset's input instances (stores original instances)
def reduce_input(self):
self.original_inputs = self.inputs
self.inputs = self.projection_basis.T * self.inputs
##
# Projection vectors are assumed to be column vectors
def set_projection_vectors(self, vec):
self.projection_basis = vec
##
# Project data points onto the linear embedding
# @param data_points to project
def reduce(self, data_points):
return self.projection_basis.T * data_points
##
# Performs PCA dim reduction
# @param percent_variance
def pca_reduce(self, percent_variance):
self.set_projection_vectors(pca_vectors(self.inputs, percent_variance))
##
# Performs randomized vector dim reduction
# @param number_of_vectors number of vectors to generate/use
def randomized_vectors_reduce(self, number_of_vectors):
self.set_projection_vectors(randomized_vectors(self.inputs, number_of_vectors))
##
# returns full dimensioned inputs
def get_original_inputs(self):
return self.original_inputs
| [
[
1,
0,
0.0183,
0.0092,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.0275,
0.0092,
0,
0.66,
0.0909,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.0459,
0.0092,
0,
0.... | [
"import roslib",
"roslib.load_manifest('ml_lib')",
"import numpy as np",
"import dataset as ds",
"import hrl_lib.util as ut",
"def pca_gain_threshold(s, percentage_change_threshold=.15):\n if s.__class__ != np.ndarray:\n raise ValueError('Need ndarray as input.') \n shifted = np.concaten... |
##
# Taken from http://opencv.willowgarage.com/wiki/PythonInterface
#
import roslib
roslib.load_manifest('hrl_opencv')
import cv
import Image #PIL
import numpy as np
def pil2cv(pi):
cv_im = cv.CreateImageHeader(pi.size, cv.IPL_DEPTH_8U, 1)
cv.SetData(cv_im, pi.tostring())
return cv_im
def cv2pil(cv_im):
return Image.fromstring(cv.GetSize(cv_im), "L", cv_im.tostring())
def cv2array(im):
depth2dtype = {
cv.IPL_DEPTH_8U: 'uint8',
cv.IPL_DEPTH_8S: 'int8',
cv.IPL_DEPTH_16U: 'uint16',
cv.IPL_DEPTH_16S: 'int16',
cv.IPL_DEPTH_32S: 'int32',
cv.IPL_DEPTH_32F: 'float32',
cv.IPL_DEPTH_64F: 'float64',
}
arrdtype=im.depth
a = np.fromstring(
im.tostring(),
dtype=depth2dtype[im.depth],
count=im.width*im.height*im.nChannels)
a.shape = (im.height,im.width,im.nChannels)
return a
def array2cv(a):
dtype2depth = {
'uint8': cv.IPL_DEPTH_8U,
'int8': cv.IPL_DEPTH_8S,
'uint16': cv.IPL_DEPTH_16U,
'int16': cv.IPL_DEPTH_16S,
'int32': cv.IPL_DEPTH_32S,
'float32': cv.IPL_DEPTH_32F,
'float64': cv.IPL_DEPTH_64F,
}
try:
nChannels = a.shape[2]
except:
nChannels = 1
cv_im = cv.CreateImageHeader((a.shape[1],a.shape[0]),
dtype2depth[str(a.dtype)],
nChannels)
cv.SetData(cv_im, a.tostring(),
a.dtype.itemsize*nChannels*a.shape[1])
return cv_im
def array2cvmat(a):
dtype2type = {
'uint8': cv.CV_8UC1,
'int8': cv.CV_8SC1,
'uint16': cv.CV_16UC1,
'int16': cv.CV_16SC1,
'int32': cv.CV_32SC1,
'float32': cv.CV_32FC1,
'float64': cv.CV_64FC1
}
#create matrix headers
rows = a.shape[0]
cols = a.shape[1]
type = dtype2type[str(a.dtype)]
cvmat = cv.CreateMatHeader(rows, cols, type)
#set data
cv.SetData(cvmat, a.tostring(), a.dtype.itemsize * a.shape[1])
return cvmat
| [
[
1,
0,
0.0519,
0.013,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.0649,
0.013,
0,
0.66,
0.1111,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.0779,
0.013,
0,
0.66,... | [
"import roslib",
"roslib.load_manifest('hrl_opencv')",
"import cv",
"import Image #PIL",
"import numpy as np",
"def pil2cv(pi):\n cv_im = cv.CreateImageHeader(pi.size, cv.IPL_DEPTH_8U, 1)\n cv.SetData(cv_im, pi.tostring())\n return cv_im",
" cv_im = cv.CreateImageHeader(pi.size, cv.IPL_DEPTH... |
import roslib
roslib.load_manifest('hrl_opencv')
import cv
def print_mat(m):
for j in range(m.height):
for i in range(m.width):
print m[j,i], ' ',
print ''
##Display a list of OpenCV images tiled across the screen
#with maximum width of max_x and maximum height of max_y
# @param save_images - will save the images(with timestamp) (NOT IMPLEMENTED)
def display_images(image_list, max_x = 1200, max_y = 1000, save_images_flag=False):
if image_list == []:
return
loc_x, loc_y = 0, 0
wins = []
# if save_images_flag:
# save_images(image_list)
for i, im in enumerate(image_list):
window_name = 'image %d' % i
wins.append((window_name, im))
cv.NamedWindow(window_name, cv.CV_WINDOW_AUTOSIZE)
cv.MoveWindow(window_name, loc_x, loc_y)
loc_x = loc_x + im.width
if loc_x > max_x:
loc_x = 0
loc_y = loc_y + im.height
if loc_y > max_y:
loc_y = 0
while True:
for name, im in wins:
cv.ShowImage(name, im)
keypress = cv.WaitKey(10)
if keypress & 255 == 27:
break
| [
[
1,
0,
0.0227,
0.0227,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.0455,
0.0227,
0,
0.66,
0.25,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.0682,
0.0227,
0,
0.66... | [
"import roslib",
"roslib.load_manifest('hrl_opencv')",
"import cv",
"def print_mat(m):\n for j in range(m.height):\n for i in range(m.width):\n print(m[j,i], ' ',)\n print('')",
" for j in range(m.height):\n for i in range(m.width):\n print(m[j,i], ' ',)\n ... |
import roslib
roslib.load_manifest('hrl_opencv')
#from sensor_msgs.msg import Image as RosImage
from std_msgs.msg import UInt8MultiArray
from std_msgs.msg import MultiArrayLayout
from std_msgs.msg import MultiArrayDimension
import opencv as cv
import opencv.highgui as hg
import opencv.adaptors as ad
import Image as pil
import numpy as np
#################################################################################################################
# ROS Utility Functions
#################################################################################################################
##
# Convert from ROS to OpenCV image datatype
# @param image to convert
def ros2cv(image):
#ros to pil then pil to opencv
#if image.encoding != 'bgr' and image.encoding != 'rgb' and image.encoding != 'bgr8':
channels = 1
if image.encoding != 'bgr8':
raise RuntimeError('Unsupported format "%s"' % image.encoding)
else:
channels = 3
if image.is_bigendian != 0:
raise RuntimeError('Unsupported endianess')
#print image.encoding
#print image.step
#print image.is_bigendian
#if image.depth != 'uint8':
# raise RuntimeError('Unsupported depth "%s"' % image.depth)
#height = image.data.layout.dim[0].size
#width = image.data.layout.dim[1].size
#channels = image.data.layout.dim[2].size
#print 'expected', image.width * channels
#print 'step', image.step
#print 'image.width', image.width, image.height
assert(image.width * channels == image.step)
height = image.height
width = image.width
np_image = np.reshape(np.fromstring(image.data, dtype='uint8', count=height*width*channels), [height, width, 3])
#np
#np_image[:,:,2].A1
#np_image[:,:,1].A1
#np_image[:,:,0].A1
np_image2 = np.empty(np_image.shape, dtype='uint8')
np_image2[:, :, 0] = np_image[:, :, 2]
np_image2[:, :, 1] = np_image[:, :, 1]
np_image2[:, :, 2] = np_image[:, :, 0]
#concatenated = np.concatenate([np_image[:,:,2].flatten(), np_image[:,:,1].flatten(), np_image[:,:,0].flatten()], axis=0)
#print 2050*2448*3
#print concatenated.shape
#np_image2 = np.reshape(np.concatenate([np_image[:,:,0].flatten(), np_image[:,:,1].flatten(), np_image[:,:,2].flatten()], axis=0), [3, width, height])
#np_image2 = np.swapaxes(np_image2, 0, 2)
#print np_image[:,:,2].shape
#print 'datatype:', np_image2.dtype
#print np_image2.shape
return ad.NumPy2Ipl(np_image2)
#return None
#################################################################################################################
# Highgui
#################################################################################################################
##
# Simple drawing of text on an image with a drop shadow
def text(image, x, y, a_string):
font = cv.cvInitFont(CV_FONT_HERSHEY_SIMPLEX, .3, .3)
cv.cvPutText(image, a_string, cv.cvPoint(x, y), font, cv.cvScalar(0,0,0))
cv.cvPutText(image, a_string, cv.cvPoint(x+1, y+1), font, cv.cvScalar(255,255,255))
def clone_image(image):
return cv.cvCloneImage(image)
def save_image(name, image):
hg.cvSaveImage(name, image)
def show_image(name, image):
hg.cvShowImage(name, image)
def named_window(name):
hg.cvNamedWindow(name, hg.CV_WINDOW_AUTOSIZE)
def wait_key(msecs=33):
return hg.cvWaitKey(msecs)
#################################################################################################################
# CXCore
#################################################################################################################
#################################################################################################################
# CVAux
#################################################################################################################
#################################################################################################################
# Machine Learning
#################################################################################################################
#################################################################################################################
# CVReference
#################################################################################################################
##
# Morphological closing
def morpho_close(cv_image, n_times=1):
dst = cv.cvCloneImage(cv_image)
dst2 = cv.cvCloneImage(cv_image)
cv.cvDilate(cv_image, dst, None, n_times)
cv.cvErode(dst, dst2, None, n_times)
return dst2
##
# Morphological opening
def morpho_open(cv_image, n_times=1):
dst = cv.cvCloneImage(cv_image)
dst2 = cv.cvCloneImage(cv_image)
cv.cvErode(cv_image, dst, None, n_times)
cv.cvDilate(dst, dst2, None, n_times)
return dst2
##
# Morphological opening
def dilate(cv_image, n_times=1):
dst = cv.cvCloneImage(cv_image)
cv.cvDilate(cv_img, dst, None, n_times)
return dst
##
# Morphological opening
def erode(cv_image, n_times=1):
dst = cv.cvCloneImage(cv_image)
cv.cvErode(cv_img, dst, None, n_times)
return dst
##
# Mask a color image with a given black and white mask
# @param img
# @param img_mask one channeled image
# @return color image with masked part filled with black
def mask(img, img_mask):
dim = img.width, img.height
depth = img.depth
channels = img.nChannels
r_chan = cv.cvCreateImage(cv.cvSize(*dim), depth, 1)
g_chan = cv.cvCreateImage(cv.cvSize(*dim), depth, 1)
b_chan = cv.cvCreateImage(cv.cvSize(*dim), depth, 1)
combined = cv.cvCreateImage(cv.cvSize(*dim), depth, 3)
cv.cvSplit(img, r_chan, g_chan, b_chan, None)
cv.cvAnd(r_chan, img_mask, r_chan)
cv.cvAnd(g_chan, img_mask, g_chan)
cv.cvAnd(b_chan, img_mask, b_chan)
cv.cvMerge(r_chan, g_chan, b_chan, None, combined)
return combined
##
# Split a color image into its component parts
def split(image):
img1 = cv.cvCreateImage(cv.cvSize(image.width, image.height), 8, 1)
img2 = cv.cvCreateImage(cv.cvSize(image.width, image.height), 8, 1)
img3 = cv.cvCreateImage(cv.cvSize(image.width, image.height), 8, 1)
cv.cvSplit(image, img1, img2, img3, None)
return (img1, img2, img3)
##
# Easy scaling of an image by factor s
# @param image
# @param s
def scale(image, s):
scaled = cv.cvCreateImage(cv.cvSize(int(image.width * s), int(image.height * s)), image.depth, image.nChannels)
cv.cvResize(image, scaled, cv.CV_INTER_AREA)
return scaled
if __name__ == '__main__':
import opencv.highgui as hg
import rospy
from photo.srv import *
#a = create_ros_image()
#print a
rospy.wait_for_service('/photo/capture')
say_cheese = rospy.ServiceProxy('/photo/capture', Capture)
ros_img = say_cheese().image
print dir(ros_img)
cv_img = ros2cv(ros_img)
hg.cvSaveImage('test.png', cv_img)
#def create_ros_image(width=1, height=1, channels=2, data='12'):
# d1 = MultiArrayDimension(label='height', size=height, stride=width*height*channels)
# d2 = MultiArrayDimension(label='width', size=width, stride=width*channels)
# d3 = MultiArrayDimension(label='channels', size=channels, stride=channels)
#
# layout = MultiArrayLayout(dim = [d1,d2,d3])
# multiarray = UInt8MultiArray(layout=layout, data=data)
# return RosImage(label='image', encoding='bgr', depth='uint8', uint8_data=multiarray)
###
## Fill holes in a binary image using scipy
##
#def fill_holes(cv_img):
# img_np = ut.cv2np(cv_img)
# img_binary = img_np[:,:,0]
# results = ni.binary_fill_holes(img_binary)
# img_cv = ut.np2cv(np_mask2np_image(results))
# return img_cv
| [
[
1,
0,
0.0047,
0.0047,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.0094,
0.0047,
0,
0.66,
0.0417,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.0188,
0.0047,
0,
0.... | [
"import roslib",
"roslib.load_manifest('hrl_opencv')",
"from std_msgs.msg import UInt8MultiArray",
"from std_msgs.msg import MultiArrayLayout",
"from std_msgs.msg import MultiArrayDimension",
"import opencv as cv",
"import opencv.highgui as hg",
"import opencv.adaptors as ad",
"import Image as pil",... |
#!/usr/bin/env python
import roslib
roslib.load_manifest( 'rospy' )
roslib.load_manifest( 'std_msgs' )
import rospy
from std_msgs.msg import Float64, Int8
import numpy as np
rospy.init_node( 'move_joint_node' )
topic = 'r_shoulder_pan_controller/command'
topic = 'r_forearm_roll_controller/command'
pub = rospy.Publisher( topic, Float64 )
update_pub = rospy.Publisher( '/joint_state_viz/update', Int8 )
soft_lower_limit = -np.pi
soft_upper_limit = np.pi
# soft_lower_limit = -2.1353981634
# soft_upper_limit = 0.564601836603
counter = 0
while not rospy.is_shutdown():
counter = counter + 1
print( '----- %d -----'%counter )
pos = np.random.rand() * ( soft_upper_limit - soft_lower_limit ) + soft_lower_limit
rospy.loginfo( 'move to pos %6.4f'%pos )
update_pub.publish( 0 )
rospy.sleep( 0.5 )
pub.publish( pos )
rospy.sleep( 1 )
update_pub.publish( 1 )
if counter == 500:
break
| [
[
1,
0,
0.0667,
0.0222,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.0889,
0.0222,
0,
0.66,
0.0714,
630,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.1111,
0.0222,
0,
0.... | [
"import roslib",
"roslib.load_manifest( 'rospy' )",
"roslib.load_manifest( 'std_msgs' )",
"import rospy",
"from std_msgs.msg import Float64, Int8",
"import numpy as np",
"rospy.init_node( 'move_joint_node' )",
"topic = 'r_shoulder_pan_controller/command'",
"topic = 'r_forearm_roll_controller/command... |
#!/usr/bin/env python
import roslib
roslib.load_manifest( 'rospy' )
roslib.load_manifest( 'rospy' )
roslib.load_manifest( 'kinematics_msgs' )
roslib.load_manifest( 'geometry_msgs' )
import rospy
from kinematics_msgs.srv import \
GetPositionIK, GetPositionIKRequest
from geometry_msgs.msg import \
Pose, Point, Quaternion
import numpy as np
import dynamics_utils as dynutils
if __name__== '__main__':
node_name = "circle_node"
rospy.loginfo( 'register node %s ...'%node_name )
rospy.init_node( node_name )
rospy.loginfo( 'node %s up and running!'%node_name )
joint_names = dynutils.get_joint_names( 'l_arm_controller' )
ik_service_name = 'pr2_left_arm_kinematics/get_ik'
rospy.loginfo( 'wait for service %s ...'%ik_service_name )
rospy.wait_for_service( ik_service_name )
ik_service = rospy.ServiceProxy( ik_service_name, GetPositionIK )
rospy.loginfo( 'ik service %s is up and running!'%ik_service_name )
# trajectory in cartesian space
time = 5.0; # trajectory time in sec
n = int(time * 200)
dt = time / n;
alphas = np.linspace( 0, 2 * np.pi, n + 1 )
alphas = alphas[0:-1]
ys = np.cos( alphas ) * 0.2
zs = -np.sin( alphas ) * 0.2
# creating trajectory in joint space
rospy.loginfo( 'creating trajectory ...' )
trajectory = []
req = GetPositionIKRequest()
req.timeout = rospy.Duration(5.0)
req.ik_request.ik_link_name = "l_wrist_roll_link"
req.ik_request.pose_stamped.header.frame_id = "torso_lift_link"
req.ik_request.ik_seed_state.joint_state.name = joint_names
req.ik_request.ik_seed_state.joint_state.position = [0.61309537, 0.45494851, 0.03, -1.03480809, 2.23232079, -0.79696399, -2.44271129]
joint_positions = []
for (y, z) in zip( ys, zs ):
pose = Pose( position = Point( 0.6 + z/2.0, 0.20 + y, 0.0 + z ),
orientation = Quaternion( 0.0, 0.0, 0.0, 1.0 ) )
req.ik_request.pose_stamped.pose = pose
# make the call
try:
# print "send request :" #, req
res = ik_service( req )
if res.error_code.val == res.error_code.SUCCESS:
joint_positions = np.asarray( res.solution.joint_state.position )
else:
print "IK failed, error code : ", res.error_code.val
break
except rospy.ServiceException, e:
print "service call failed: %s"%e
break
trajectory.append( joint_positions )
req.ik_request.ik_seed_state.joint_state.position = joint_positions
rospy.loginfo( 'done!' )
t = np.cumsum( [dt] * n ) - dt
pos = np.asarray( trajectory )
dynutils.wrap_trajectory( pos )
vel = dynutils.compute_derivative( pos, dt )
acc = dynutils.compute_derivative( vel, dt )
dynutils.save_motion( 'circle.pkl', 'circle', t, pos, vel, acc )
| [
[
1,
0,
0.1,
0.1,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
1,
0,
0.2,
0.1,
0,
0.66,
0.2,
164,
0,
1,
0,
0,
164,
0,
0
],
[
1,
0,
0.35,
0.2,
0,
0.66,
0.4,
2... | [
"import roslib",
"import rospy",
"from kinematics_msgs.srv import \\\n GetPositionIK, GetPositionIKRequest",
"from geometry_msgs.msg import \\\n Pose, Point, Quaternion",
"import numpy as np",
"import dynamics_utils as dynutils"
] |
#!/usr/bin/python
from scipy import pi, sin, cos, array, asarray, linspace, zeros, ones, sqrt
import matplotlib.pyplot as plt
import roslib
roslib.load_manifest( 'pr2_controllers_msgs' )
roslib.load_manifest( 'trajectory_msgs' )
roslib.load_manifest( 'actionlib' )
import rospy
from pr2_controllers_msgs.msg import JointTrajectoryAction, JointTrajectoryGoal
from trajectory_msgs.msg import JointTrajectory, JointTrajectoryPoint
import actionlib
def main():
joint_names = ['l_shoulder_pan_joint',
'l_shoulder_lift_joint',
'l_upper_arm_roll_joint',
'l_elbow_flex_joint',
'l_forearm_roll_joint',
'l_wrist_flex_joint',
'l_wrist_roll_joint']
N = len( joint_names )
# lower_limit = asarray( [-2.13, -0.35, -3.75, -2.32, -2.0 * pi, -2.09, -2.0 * pi ] )
# upper_limit = asarray( [ 0.56,
# 0.8, #1.29,
# 0.65, 0.0, 2.0 * pi, 0.0, 2.0 * pi ] )
lower_limit = asarray( [2.13,
-0.35,
-0.5, #3.75,
-2.0, #-2.32,
-2.0 * pi,
-2.09,
-2.0 * pi ] )
upper_limit = asarray( [-0.56,
0.6, #1.29,
2, #0.65,
0.0,
2.0 * pi,
0.0,
2.0 * pi ] )
A = (lower_limit - upper_limit) * 1/4
f = 0.1
f1 = asarray([f * sqrt(2),
f * sqrt(2),
f * sqrt(2),
f * sqrt(9),
f * sqrt(7),
f * sqrt(1),
f * sqrt(7)])
f2 = asarray([0.4,
0.4,
0.6,
0.9,
1.1,
0.3,
0.9])
start_time = 0.0
dt = 0.001
max_time = 60.0
t = linspace( 0.0, max_time - dt, int( max_time / dt ) )
q = zeros( (N, len( t )))
dq = zeros( (N, len( t )))
ddq = zeros( (N, len( t )))
# start_pos = [ 0, 0, 0, 0, 0, 0, 0 ]
# joint = 2;
for i in range(N):
#if i == joint:
q[i,:] = A[i] * sin( 2.0 * pi * f1[i] * t ) \
+ A[i]/3.0 * sin( 2.0 * pi * f2[i] * t ) + ( upper_limit[i] + lower_limit[i]) / 2.0
dq[i,:] = 2.0 * pi * f1[i] * A[i] * cos( 2.0 * pi * f1[i] * t ) \
+ 2.0/3.0 * pi * f2[i] * A[i] * cos( 2.0 * pi * f2[i] * t )
ddq[i,:] = - 4.0 * pi ** 2 * f1[i] ** 2 * A[i] * sin( 2.0 * pi * f1[i] * t ) \
- 4.0/3.0 * pi ** 2 * f2[i] ** 2 * A[i] * sin( 2.0 * pi * f2[i] * t )
#else:
# q[i,:] = ones( (1, len( t )) ) * start_pos[i]
# plt.subplot( 3, 1, 1);
# plt.plot( q[joint,:] )
# plt.subplot( 3, 1, 2);
# plt.plot( dq[joint,:] )
# plt.subplot( 3, 1, 3);
# plt.plot( ddq[joint,:] )
# plt.show()
rospy.init_node( 'gpr_controller_trajectory_generator' )
client = actionlib.SimpleActionClient( 'l_arm_controller/joint_trajectory_action',
JointTrajectoryAction )
client.wait_for_server()
jt = JointTrajectory()
jt.joint_names = joint_names
jt.points = []
# start at neutral position
jp = JointTrajectoryPoint()
jp.time_from_start = rospy.Time.from_seconds( start_time )
jp.positions = q[:,0]
jp.velocities = [0] * len( joint_names )
jp.accelerations = [0] * len( joint_names )
jt.points.append( jp )
# add precomputed trajectory
for i in range( len( t ) ):
jp = JointTrajectoryPoint()
jp.time_from_start = rospy.Time.from_seconds( t[i] + start_time )
jp.positions = q[:,i]
jp.velocities = dq[:,i]
jp.accelerations = ddq[:,i]
jt.points.append( jp )
# push trajectory goal to ActionServer
goal = JointTrajectoryGoal()
goal.trajectory = jt
goal.trajectory.header.stamp = rospy.Time.now() + rospy.Duration(4.0)
client.send_goal(goal)
client.wait_for_result()
if __name__ == "__main__":
main()
| [
[
1,
0,
0.0221,
0.0074,
0,
0.66,
0,
265,
0,
9,
0,
0,
265,
0,
0
],
[
1,
0,
0.0294,
0.0074,
0,
0.66,
0.0909,
596,
0,
1,
0,
0,
596,
0,
0
],
[
1,
0,
0.0441,
0.0074,
0,
... | [
"from scipy import pi, sin, cos, array, asarray, linspace, zeros, ones, sqrt",
"import matplotlib.pyplot as plt",
"import roslib",
"roslib.load_manifest( 'pr2_controllers_msgs' )",
"roslib.load_manifest( 'trajectory_msgs' )",
"roslib.load_manifest( 'actionlib' )",
"import rospy",
"from pr2_controllers... |
#!/usr/bin/env python
import matplotlib
matplotlib.interactive( True )
matplotlib.use( 'WXAgg' )
import numpy as np
import wx
import sys
import roslib
roslib.load_manifest( 'rospy' )
roslib.load_manifest( 'sensor_msgs' )
roslib.load_manifest( 'std_msgs' )
import rospy
from sensor_msgs.msg import JointState
from std_msgs.msg import Int8
from threading import Thread, Lock
class WXMatPlotLibPanel( wx.Panel ):
def __init__( self, parent, color=None, dpi=None, **kwargs ):
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
from matplotlib.figure import Figure
# initialize Panel
if 'id' not in kwargs.keys():
kwargs['id'] = wx.ID_ANY
if 'style' not in kwargs.keys():
kwargs['style'] = wx.NO_FULL_REPAINT_ON_RESIZE
wx.Panel.__init__( self, parent, **kwargs )
# initialize matplotlib stuff
self.figure = Figure( None, dpi )
self.canvas = FigureCanvasWxAgg( self, -1, self.figure )
#self.SetColor( color )
self._SetSize()
self.draw()
self._resizeflag = False
self.Bind(wx.EVT_IDLE, self._onIdle)
self.Bind(wx.EVT_SIZE, self._onSize)
def SetColor( self, rgbtuple=None ):
"""Set figure and canvas colours to be the same."""
if rgbtuple is None:
rgbtuple = wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNFACE ).Get()
clr = [c/255. for c in rgbtuple]
self.figure.set_facecolor( clr )
self.figure.set_edgecolor( clr )
self.canvas.SetBackgroundColour( wx.Colour( *rgbtuple ) )
def _onSize( self, event ):
self._resizeflag = True
def _onIdle( self, evt ):
if self._resizeflag:
self._resizeflag = False
self._SetSize()
def _SetSize( self ):
pixels = tuple( self.parent.GetClientSize() )
self.SetSize( pixels )
self.canvas.SetSize( pixels )
self.figure.set_size_inches( float( pixels[0] )/self.figure.get_dpi(),
float( pixels[1] )/self.figure.get_dpi() )
def draw(self): pass # abstract, to be overridden by child classes
class JointStateVizPanel( WXMatPlotLibPanel ):
def __init__( self, parent, **kwargs ):
self.lock = Lock()
self.parent = parent
self.positions = None
self.velocities = None
self.efforts = None
WXMatPlotLibPanel.__init__( self, parent, **kwargs )
#self.SetColor( (255,255,255) )
def init_plots( self, names, limits ):
N = len( names )
self.axes = []
self.lines = []
self.scatter = []
for j in range( N ):
axes = self.figure.add_subplot( 3, N, j + 1 )
axes.set_title( names[j] )
upper = -np.pi
lower = np.pi
if limits[j].has_key( 'upper' ):
upper = limits[j].get( 'upper' )
if limits[j].has_key( 'lower' ):
lower = limits[j].get( 'lower' )
axes.set_ylim( lower, upper )
axes.set_xticks( [] )
self.lines.append( axes.plot( [0], 'r' )[0] )
axes.autoscale_view( scalex = False, scaley = False )
self.axes.append( axes )
for j in range( N ):
axes = self.figure.add_subplot( 3, N, j + N + 1 )
effort = 30
if limits[j].has_key( 'effort' ):
effort = limits[j].get( 'effort' )
axes.set_ylim( -effort, effort )
axes.set_xticks( [] )
self.lines.append( axes.plot( [0], 'b' )[0] )
self.axes.append( axes )
for j in range( N ):
axes = self.figure.add_subplot( 3, N, j + 2 * N + 1 )
upper = -2 * np.pi
lower = 2 * np.pi
velocity = 2 * np.pi
if limits[j].has_key( 'upper' ):
upper = limits[j].get( 'upper' )
if limits[j].has_key( 'lower' ):
lower = limits[j].get( 'lower' )
if limits[j].has_key( 'velocity' ):
velocity = limits[j].get( 'velocity' )
axes.set_ylim( -velocity, velocity )
axes.set_xlim( lower, upper )
self.scatter.append( axes.scatter( [0], [0],
c = 'b',
s = 2.0,
marker = 'x') )
self.axes.append( axes )
#self.figure.subplots_adjust( wspace = 0.3, hspace = 0.1 )
def update_plots( self ):
# self.lock.acquire()
if not hasattr( self, 'axes' ):
return
if self.positions is None or len( self.positions ) == 0:
return
( l, N ) = self.positions.shape
for j in range( N ):
axes = self.axes[j]
axes.lines[0].remove()
axes.plot( self.positions[:,j], 'r')
for j in range( N ):
axes = self.axes[j + N]
axes.lines[0].remove()
axes.plot( self.efforts[:,j], 'b')
for j in range( N ):
axes = self.axes[j + N * 2]
self.scatter[j].remove()
self.scatter[j] = axes.scatter( self.positions[:,j],
self.velocities[:,j],
c = 'b',
s = 2.0,
marker = 'x')
# self.lock.release()
def draw( self ):
self.update_plots()
def setData( self, pos, vel, eff, duration ):
self.positions = pos
self.velocities = vel
self.efforts = eff
self.duration = duration
self.draw()
class JointStateVizFrame( wx.Frame ) :
def __init__( self, title, ns, js_topic ):
wx.Frame.__init__( self, None, wx.ID_ANY, title, size = (2000, 800) )
self.CreateStatusBar()
self.SetStatusText( 'waiting for data on %s ...'%js_topic )
self.panel = JointStateVizPanel( self )
self.Show()
self.js_sub = rospy.Subscriber( js_topic, JointState, self.js_callback )
self.update_sub = rospy.Subscriber( ''.join( (ns, '/update' ) ), Int8, self.update_callback )
# load parameters
(self.joint_names, self.limits) = self.load_params( ns )
self.idx = None
self.joint_states = []
self.panel.init_plots( self.joint_names, self.limits )
def load_params( self, ns ):
params = rospy.get_param( ns )
joint_names = params.keys()
limits = []
for joint_name in joint_names:
limits.append( params.get( joint_name ) )
return ( joint_names, limits )
def js_callback( self, msg ):
self.joint_states.append( msg )
def update_callback( self, msg ):
if msg.data == 0:
self.joint_states = []
elif msg.data == 1:
self.update()
def update( self ):
if self.joint_names is None or len( self.joint_names ) == 0 or len( self.joint_states ) == 0:
return
if self.idx is None:
self.idx = map( self.joint_states[0].name.index, self.joint_names )
positions = []
velocities = []
efforts = []
for js in self.joint_states:
pos = map( lambda x: js.position[x], self.idx )
vel = map( lambda x: js.velocity[x], self.idx )
effort = map( lambda x: js.effort[x], self.idx )
positions.append( pos )
velocities.append( vel )
efforts.append( effort )
start_time = self.joint_states[0].header.stamp
stop_time = self.joint_states[-1].header.stamp
duration = stop_time - start_time
self.panel.setData( np.asarray( positions ),
np.asarray( velocities ),
np.asarray( efforts ),
duration.to_sec())
# status = ''.join( ( str( self.joint_states[0].header.stamp ),
# ' ',
# str( duration.to_sec() ) ) )
status = 'ros-time: %s, duration: %5.3f sec'%( self.joint_states[0].header.stamp, duration.to_sec() )
self.SetStatusText( status )
self.joint_states = []
arm_joint_names = ['lr_shoulder_pan_joint',
'lr_shoulder_lift_joint',
'lr_upper_arm_roll_joint',
'lr_elbow_flex_joint',
'lr_forearm_roll_joint',
'lr_wrist_flex_joint',
'lr_wrist_roll_joint']
l_arm_joint_names = map(lambda s: s.replace('lr_', 'l_'), arm_joint_names )
r_arm_joint_names = map(lambda s: s.replace('lr_', 'r_'), arm_joint_names )
if __name__ == '__main__':
rospy.init_node( 'joint_state_viz_node' )
app = wx.PySimpleApp( 0 )
frame = JointStateVizFrame( 'Joint-State-Viz', '/joint_state_viz', '/joint_states' )
app.MainLoop()
| [
[
1,
0,
0.0102,
0.0034,
0,
0.66,
0,
75,
0,
1,
0,
0,
75,
0,
0
],
[
8,
0,
0.0137,
0.0034,
0,
0.66,
0.05,
348,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.0171,
0.0034,
0,
0.66,
... | [
"import matplotlib",
"matplotlib.interactive( True )",
"matplotlib.use( 'WXAgg' )",
"import numpy as np",
"import wx",
"import sys",
"import roslib",
"roslib.load_manifest( 'rospy' )",
"roslib.load_manifest( 'sensor_msgs' )",
"roslib.load_manifest( 'std_msgs' )",
"import rospy",
"from sensor_m... |
import roslib
roslib.load_manifest( 'rospy' )
roslib.load_manifest( 'rosparam' )
roslib.load_manifest( 'actionlib' )
roslib.load_manifest( 'trajectory_msgs' )
roslib.load_manifest( 'pr2_controllers_msgs' )
import rospy
import rosparam
import csv
from actionlib import \
SimpleActionClient
from trajectory_msgs.msg import \
JointTrajectory, JointTrajectoryPoint
from pr2_controllers_msgs.msg import \
JointTrajectoryAction, JointTrajectoryGoal
import numpy as np
from math import fmod, pi
import pickle
#-------------------------------------------------------------------------------
# Trajectory utils
#-------------------------------------------------------------------------------
def wrap_angle( a ):
if a < 0:
return fmod( a - pi, 2 * pi ) + pi
if a > 0:
return fmod( a + pi, 2 * pi ) - pi
def wrap_trajectory( t ):
rospy.loginfo( 'warapping trajectory [#points: %d] ...', len( t ) )
b = 0.1
if len( t ) < 0:
return
last = map( wrap_angle, t[0])
offsets = np.zeros( len( last ) )
for i in range( len( t ) ):
for j in range( len( t[i] ) ):
a = wrap_angle( t[i,j] )
if a > pi - b and last[j] < -pi + b:
offsets[j] -= 2 * pi
if a < -pi + b and last[j] > pi - b:
offsets[j] += 2 * pi
last[j] = a
t[i] += offsets
rospy.loginfo( 'done!' )
def compute_derivative( f, dt ):
rospy.loginfo( 'computing derivative [#points: %d] ...', len( f ) )
f_dot = np.zeros( f.shape )
for i in range( 1, len( f ) - 1 ):
for j in range( len( f[i] ) ):
f_dot[i,j] = (f[i+1,j] - f[i-1,j]) / (2.0 * dt)
f_dot[0,:] = (f[1,:] - f[-1,:]) / (2.0 * dt)
f_dot[-1,:] = (f[0,:] - f[-2,:]) / (2.0 * dt)
rospy.loginfo( 'done!' )
return f_dot
def save_motion( fname, name, time, pos, vel, acc ):
rospy.loginfo( 'save motion \'%s\' to file: %s'%( name, fname ) )
pkl_file = open( fname, 'wb' )
data = ( name, time, pos, vel, acc )
pickle.dump( data, pkl_file )
pkl_file.close()
rospy.loginfo( 'done!' )
def load_motion( fname ):
rospy.loginfo( 'loading motion from file: %s'%fname )
pkl_file = open( fname, 'rb' )
data = pickle.load( pkl_file )
rospy.loginfo( 'done!' )
return data
def load_motion_ascii( fname ):
reader = csv.reader( open( fname, 'rb' ), delimiter="\t" )
t = []
pos = []
vel = []
acc = []
for row in reader:
t.append( float(row[0]) )
pos.append( map( lambda x: float(x), row[1:8] ) )
vel.append( map( lambda x: float(x), row[8:15] ) )
acc.append( map( lambda x: float(x), row[15:22] ) )
return (fname, np.asarray(t), np.asarray(pos), np.asarray(vel), np.asarray(acc))
#-------------------------------------------------------------------------------
# JointTrajectoryAction client interfacing
#-------------------------------------------------------------------------------
def init_jt_client(arm = 'r'):
name = "".join( [ arm, "_arm_controller/joint_trajectory_action" ] )
client = SimpleActionClient(name, JointTrajectoryAction)
rospy.loginfo( 'waiting for action client : %s ...'%name )
client.wait_for_server()
rospy.loginfo( '%s is up and running!'%name )
return client
def get_joint_names( node_name ):
return rosparam.get_param( ''.join( (node_name, '/joints') ) )
def move_arm( positions, time_from_start = 3.0, arm = 'r', client = None ):
if (client == None):
client = init_jt_client(arm)
else:
arm = client.action_client.ns[0:1]; # ignore arm argument
rospy.loginfo( 'move arm \'%s\' to position %s'%( arm, positions ) )
joint_names = get_joint_names( ''.join( ( arm, '_arm_controller' ) ) )
jt = JointTrajectory()
jt.joint_names = joint_names
jt.points = []
jp = JointTrajectoryPoint()
jp.time_from_start = rospy.Time.from_seconds( time_from_start )
jp.positions = positions
jt.points.append( jp )
# push trajectory goal to ActionServer
jt_goal = JointTrajectoryGoal()
jt_goal.trajectory = jt
jt_goal.trajectory.header.stamp = rospy.Time.now() # + rospy.Duration.from_sec( time_from_start )
client.send_goal( jt_goal )
client.wait_for_result()
return client.get_state()
def track_trajectory( pos, vel, acc, time,
arm = 'r', client = None,
stamp = None):
if (acc == None):
acc = np.zeros( pos.shape )
if ( len( pos ) != len( vel ) or len( pos ) != len( time ) ):
rospy.logerr( '[track_trajectory] dimensions do not agree' )
rospy.loginfo( 'arm \'%s\' tracking trajectory with %d points'
%( arm, len( pos ) ) )
if (client == None):
client = init_jt_client(arm)
else:
arm = client.action_client.ns[0:1]; # ignore arm argument
joint_names = get_joint_names( ''.join( ( arm, '_arm_controller' ) ) )
# create trajectory message
jt = JointTrajectory()
jt.joint_names = joint_names
jt.points = []
t = 0
for i in range( len( pos ) ):
jp = JointTrajectoryPoint()
jp.time_from_start = rospy.Time.from_sec( time[i] )
jp.positions = pos[i,:]
jp.velocities = vel[i,:]
jp.accelerations = acc[i,:]
jt.points.append( jp )
t += 1
if ( stamp == None ):
stamp = rospy.Time.now()
# push trajectory goal to ActionServer
jt_goal = JointTrajectoryGoal()
jt_goal.trajectory = jt
jt_goal.trajectory.header.stamp = stamp;
client.send_goal(jt_goal)
| [
[
1,
0,
0.0056,
0.0056,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.0111,
0.0056,
0,
0.66,
0.0417,
630,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.0167,
0.0056,
0,
0.... | [
"import roslib",
"roslib.load_manifest( 'rospy' )",
"roslib.load_manifest( 'rosparam' )",
"roslib.load_manifest( 'actionlib' )",
"roslib.load_manifest( 'trajectory_msgs' )",
"roslib.load_manifest( 'pr2_controllers_msgs' )",
"import rospy",
"import rosparam",
"import csv",
"from actionlib import \\... |
#!/usr/bin/env python
import roslib
roslib.load_manifest( 'rospy' )
import rospy
import sys
import numpy as np
import dynamics_utils as dynutils
if __name__== '__main__':
if ( len( sys.argv ) != 2 ):
rospy.logerr( 'no filename passed to play_motion.py' )
exit(-1)
fname = sys.argv[1];
node_name = "play_motion"
rospy.loginfo( 'register node %s ...'%node_name )
rospy.init_node( node_name )
rospy.loginfo( 'node %s up and running!'%node_name )
print dynutils.get_joint_names( 'l_arm_controller' )
# move right arm out of the way
dynutils.move_arm( [ -np.pi / 3,
np.pi / 3,
0,
-3 * np.pi/4,
0,
0,
0], arm = 'r' )
# load motion
( name, time, pos, vel, acc ) = dynutils.load_motion( fname );
dt = time[1] - time[0]
total_time = dt * len( time )
# start client for left arm
l_jt_client = dynutils.init_jt_client(arm = 'l')
# move left arm to starting posiiton
dynutils.move_arm( pos[0,:],
time_from_start = 3.0,
client = l_jt_client ) # left arm goes to first pos of trajectory
rospy.loginfo( 'playing \'%s\' motion ...'%name )
# initial call
last_call = rospy.Time().now() + rospy.Duration().from_sec( .5 );
dynutils.track_trajectory(pos, vel, acc, time, arm = 'l', client = l_jt_client, stamp = last_call )
# loop
while ( not rospy.is_shutdown() ):
dur = rospy.Time().now() - last_call;
if ( dur.to_sec() > total_time - (total_time / 2.0) ):
last_call += rospy.Duration().from_sec( total_time );
dynutils.track_trajectory(pos, vel, acc, time, arm = 'l', client = l_jt_client, stamp = last_call )
| [
[
1,
0,
0.0492,
0.0164,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.0656,
0.0164,
0,
0.66,
0.1667,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.0984,
0.0164,
0,
0.... | [
"import roslib",
"roslib.load_manifest( 'rospy' )",
"import rospy",
"import sys",
"import numpy as np",
"import dynamics_utils as dynutils",
"if __name__== '__main__':\n\n if ( len( sys.argv ) != 2 ):\n rospy.logerr( 'no filename passed to play_motion.py' )\n exit(-1)\n \n fname =... |
#!/usr/bin/env python
""" Provides tools to compute root mean squared error for each joint in JointTrajectoryControllerState messages, either on-line by listening to a speciefied topic - or offline by reading a bag file."""
import numpy as np
import sys
import roslib
roslib.load_manifest( 'gpr_controller' )
import rospy
import rosbag
from pr2_controllers_msgs.msg import JointTrajectoryControllerState
__author__ = "Daniel Hennes"
class RMSEListener():
error_sum = None
num_msg = 0
def __init__( self, topic ):
np.set_printoptions( precision=3 ) # , suppress=True )
rospy.init_node( 'rsme_joint_states' )
rospy.Subscriber( topic, JointTrajectoryControllerState,
self.cb_controller_state )
rospy.spin()
def cb_controller_state( self, msg ):
if self.error_sum is None:
self.error_sum = np.asarray( msg.error.positions ) ** 2
else:
self.error_sum += np.asarray ( msg.error.positions ) ** 2
self.num_msg += 1
RMSE = np.sqrt( self.error_sum / self.num_msg )
print RMSE
class RMSEBagReader():
def __init__( self, fname = 'test.bag', topic = 'r_arm_controller/state' ):
msgs = self.read_file( fname, topic )
print self.rmse ( msgs )
def read_file( self, fname, topic ):
bag = rosbag.Bag( fname )
msgs = []
for topic, msg, t in bag.read_messages( topics = [topic] ):
msgs.append( msg )
bag.close()
return msgs
def rmse( self, msgs ):
error_sum = None
num_msg = 0
for msg in msgs:
if error_sum is None:
error_sum = np.asarray( msg.error.positions ) ** 2
else:
error_sum += np.asarray ( msg.error.positions ) ** 2
num_msg += 1
if error_sum is None:
return None
else:
return np.sqrt( error_sum / num_msg )
if __name__ == '__main__':
args = sys.argv
args.pop(0)
if len( args ) == 2 and args[0] == 'listen':
RMSEListener( args[1] )
elif len( args ) == 3 and args[0] == 'read':
RMSEBagReader( args[1], args[2] )
else:
print "Usage: rmse <subcommand> [args]\n"
print "Available subcommands:"
print "\tlisten [topic]"
print "\tread [filename] [topic]"
| [
[
8,
0,
0.0395,
0.0132,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0658,
0.0132,
0,
0.66,
0.0909,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0789,
0.0132,
0,
0.66... | [
"\"\"\" Provides tools to compute root mean squared error for each joint in JointTrajectoryControllerState messages, either on-line by listening to a speciefied topic - or offline by reading a bag file.\"\"\"",
"import numpy as np",
"import sys",
"import roslib",
"roslib.load_manifest( 'gpr_controller' )",
... |
#!/usr/bin/env python
import roslib
roslib.load_manifest( 'rospy' )
import rospy
roslib.load_manifest( 'rosbag' )
import rosbag
import numpy as np
import csv
import sys
def read_file( fname, topic ):
bag = rosbag.Bag( fname )
time = rospy.Time.from_sec(0.0)
msgs = []
for topic, msg, t in bag.read_messages( topics = [topic] ):
if time > t:
print( 'ERROR messages out of order' )
return None
time = t
msgs.append( msg )
bag.close()
return np.asarray( msgs )
arm_joint_names = ['lr_shoulder_pan_joint',
'lr_shoulder_lift_joint',
'lr_upper_arm_roll_joint',
'lr_elbow_flex_joint',
'lr_forearm_roll_joint',
'lr_wrist_flex_joint',
'lr_wrist_roll_joint']
l_arm_joint_names = map(lambda s: s.replace('lr_', 'l_'), arm_joint_names )
r_arm_joint_names = map(lambda s: s.replace('lr_', 'r_'), arm_joint_names )
joint_names = [];
if len( sys.argv ) < 4:
print( 'usage:\n\t rosbagtocsv in.bag out.csv [-r] [-l] [-j joint_name]' );
sys.exit()
in_fname = sys.argv[1];
out_fname = sys.argv[2];
if sys.argv[3] == '-r':
joint_names = r_arm_joint_names
elif sys.argv[3] == '-l':
joint_names = l_arm_joint_names
elif sys.argv[3] == '-j':
joint_names.append( sys.argv[4] )
print( 'searching for %s in %s ...'%(joint_names, in_fname) )
joint_states = read_file( in_fname, '/joint_states' )
if joint_states is None or not len( joint_states ) > 0:
exit
print len( joint_states )
print joint_states[0].name
idx = map( joint_states[0].name.index, joint_names )
writer = csv.writer( open( out_fname, 'wb' ), delimiter = ',', quotechar = '|' )
print( 'writing %d rows to %s ...'%( len( joint_states ), out_fname) )
if len( joint_states ) < 1:
print('bag file doesn not contain joint_states messages.')
sys.exit(-1)
last_time = joint_states[0].header.stamp
for js in joint_states:
pos = map( lambda x: js.position[x], idx )
vel = map( lambda x: js.velocity[x], idx )
effort = map( lambda x: js.effort[x], idx )
time = (js.header.stamp - last_time).to_sec()
row = sum( [[time], pos, vel, effort], [] )
writer.writerow( row )
print( 'done!' )
| [
[
1,
0,
0.0357,
0.0119,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.0476,
0.0119,
0,
0.66,
0.0357,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.0595,
0.0119,
0,
0.... | [
"import roslib",
"roslib.load_manifest( 'rospy' )",
"import rospy",
"roslib.load_manifest( 'rosbag' )",
"import rosbag",
"import numpy as np",
"import csv",
"import sys",
"def read_file( fname, topic ):\n bag = rosbag.Bag( fname )\n time = rospy.Time.from_sec(0.0)\n msgs = []\n for topic... |
#!/usr/bin/env python
from xml.dom import minidom
arm_joint_names = ['lr_shoulder_pan_joint',
'lr_shoulder_lift_joint',
'lr_upper_arm_roll_joint',
'lr_elbow_flex_joint',
'lr_forearm_roll_joint',
'lr_wrist_flex_joint',
'lr_wrist_roll_joint']
l_arm_joint_names = map(lambda s: s.replace('lr_', 'l_'), arm_joint_names )
r_arm_joint_names = map(lambda s: s.replace('lr_', 'r_'), arm_joint_names )
urdf_fname = '../config/pr2.urdf'
yaml_fname = '../config/r_arm_joint_limits.yaml'
joint_names = r_arm_joint_names
print( 'parsing %s ...'%urdf_fname )
xmldoc = minidom.parse( urdf_fname )
joint_nodes = xmldoc.getElementsByTagName('joint')
print( 'found %d joints'%len( joint_nodes ) )
print( 'writin to %s '%yaml_fname )
yaml_file = open( yaml_fname, 'w')
for node in joint_nodes:
if not node.hasAttribute( 'name' ):
continue
joint_name = node.getAttribute( 'name' )
if joint_name not in joint_names:
continue
print( 'found joint %s'%joint_name )
limit_nodes = node.getElementsByTagName( 'limit' )
if len( limit_nodes ) == 0:
print( '\t no limit tag -> ignored' )
continue
if len( limit_nodes ) > 1:
print( '\t more than one limit tag -> ignored' )
continue
effort = None
velocity = None
upper = None
lower = None
limit_node = limit_nodes[0]
if limit_node.hasAttribute( 'effort' ):
effort = limit_node.getAttribute( 'effort' )
if limit_node.hasAttribute( 'velocity' ):
velocity = limit_node.getAttribute( 'velocity' )
if limit_node.hasAttribute( 'upper' ):
upper = limit_node.getAttribute( 'upper' )
if limit_node.hasAttribute( 'lower' ):
lower = limit_node.getAttribute( 'lower' )
safety_nodes = node.getElementsByTagName( 'safety_controller' )
if len( safety_nodes ) == 0:
print( '\t no safety_controller tag -> ignored' )
continue
if len( safety_nodes ) > 1:
print( '\t more than one safety_controller tag -> ignored' )
continue
soft_lower_limit = None
soft_upper_limit = None
safety_node = safety_nodes[0]
if safety_node.hasAttribute( 'soft_upper_limit' ):
soft_upper_limit = safety_node.getAttribute( 'soft_upper_limit' )
if safety_node.hasAttribute( 'soft_lower_limit' ):
soft_lower_limit = safety_node.getAttribute( 'soft_lower_limit' )
print( '%s:\n\teffort: %s\n\tvelocity: %s\n\tupper: %s\n\tlower: %s\n\tsoft_upper: %s\n\tsoft_lower: %s'%( joint_name, effort, velocity, upper, lower, soft_upper_limit, soft_lower_limit ) )
yaml_file.write( '%s:\n'%joint_name )
if not effort is None:
yaml_file.write( ' effort: %s\n'%effort )
if not velocity is None:
yaml_file.write( ' velocity: %s\n'%velocity )
if not upper is None:
yaml_file.write( ' upper: %s\n'%upper )
if not lower is None:
yaml_file.write( ' lower: %s\n'%lower )
if not soft_upper_limit is None:
yaml_file.write( ' soft_upper_limit: %s\n'%soft_upper_limit )
if not soft_lower_limit is None:
yaml_file.write( ' soft_lower_limit: %s\n'%soft_lower_limit )
yaml_file.close()
| [
[
1,
0,
0.03,
0.01,
0,
0.66,
0,
290,
0,
1,
0,
0,
290,
0,
0
],
[
14,
0,
0.08,
0.07,
0,
0.66,
0.0714,
661,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.13,
0.01,
0,
0.66,
0.... | [
"from xml.dom import minidom",
"arm_joint_names = ['lr_shoulder_pan_joint',\n 'lr_shoulder_lift_joint',\n 'lr_upper_arm_roll_joint',\n 'lr_elbow_flex_joint',\n 'lr_forearm_roll_joint',\n 'lr_wrist_flex_joint',\n ... |
#!/usr/bin/env python
import dynamics_utils as dynutils
(name, time, pos, vel, acc) = dynutils.load_motion_ascii("/u/dhennes/Desktop/reaching.txt")
dynutils.save_motion("../motions/reaching.pkl", name, time, pos, vel, acc)
| [
[
1,
0,
0.4286,
0.1429,
0,
0.66,
0,
318,
0,
1,
0,
0,
318,
0,
0
],
[
14,
0,
0.8571,
0.1429,
0,
0.66,
0.5,
700,
3,
1,
0,
0,
301,
10,
1
],
[
8,
0,
1,
0.1429,
0,
0.66,
... | [
"import dynamics_utils as dynutils",
"(name, time, pos, vel, acc) = dynutils.load_motion_ascii(\"/u/dhennes/Desktop/reaching.txt\")",
"dynutils.save_motion(\"../motions/reaching.pkl\", name, time, pos, vel, acc)"
] |
#!/usr/bin/python
from scipy import pi, sin, cos, array, asarray, linspace, zeros, ones, sqrt
import matplotlib.pyplot as plt
import roslib
roslib.load_manifest( 'pr2_controllers_msgs' )
roslib.load_manifest( 'trajectory_msgs' )
roslib.load_manifest( 'actionlib' )
import rospy
from pr2_controllers_msgs.msg import JointTrajectoryAction, JointTrajectoryGoal
from trajectory_msgs.msg import JointTrajectory, JointTrajectoryPoint
import actionlib
def main():
joint_names = ['l_shoulder_pan_joint',
'l_shoulder_lift_joint',
'l_upper_arm_roll_joint',
'l_elbow_flex_joint',
'l_forearm_roll_joint',
'l_wrist_flex_joint',
'l_wrist_roll_joint']
N = len( joint_names )
# lower_limit = asarray( [-2.13, -0.35, -3.75, -2.32, -2.0 * pi, -2.09, -2.0 * pi ] )
# upper_limit = asarray( [ 0.56,
# 0.8, #1.29,
# 0.65, 0.0, 2.0 * pi, 0.0, 2.0 * pi ] )
lower_limit = asarray( [2.13,
-0.35,
-0.5, #3.75,
-2.0, #-2.32,
-2.0 * pi,
-2.09,
-2.0 * pi ] )
upper_limit = asarray( [-0.56,
0.6, #1.29,
2, #0.65,
0.0,
2.0 * pi,
0.0,
2.0 * pi ] )
A = (lower_limit - upper_limit) * 1/4
f = 0.1
f1 = asarray([f * sqrt(2),
f * sqrt(2),
f * sqrt(2),
f * sqrt(9),
f * sqrt(7),
f * sqrt(1),
f * sqrt(7)])
f2 = asarray([0.4,
0.4,
0.6,
0.9,
1.1,
0.3,
0.9])
start_time = 0.0
dt = 0.001
max_time = 60.0
t = linspace( 0.0, max_time - dt, int( max_time / dt ) )
q = zeros( (N, len( t )))
dq = zeros( (N, len( t )))
ddq = zeros( (N, len( t )))
# start_pos = [ 0, 0, 0, 0, 0, 0, 0 ]
# joint = 2;
for i in range(N):
#if i == joint:
q[i,:] = A[i] * sin( 2.0 * pi * f1[i] * t ) \
+ A[i]/3.0 * sin( 2.0 * pi * f2[i] * t ) + ( upper_limit[i] + lower_limit[i]) / 2.0
dq[i,:] = 2.0 * pi * f1[i] * A[i] * cos( 2.0 * pi * f1[i] * t ) \
+ 2.0/3.0 * pi * f2[i] * A[i] * cos( 2.0 * pi * f2[i] * t )
ddq[i,:] = - 4.0 * pi ** 2 * f1[i] ** 2 * A[i] * sin( 2.0 * pi * f1[i] * t ) \
- 4.0/3.0 * pi ** 2 * f2[i] ** 2 * A[i] * sin( 2.0 * pi * f2[i] * t )
#else:
# q[i,:] = ones( (1, len( t )) ) * start_pos[i]
# plt.subplot( 3, 1, 1);
# plt.plot( q[joint,:] )
# plt.subplot( 3, 1, 2);
# plt.plot( dq[joint,:] )
# plt.subplot( 3, 1, 3);
# plt.plot( ddq[joint,:] )
# plt.show()
rospy.init_node( 'gpr_controller_trajectory_generator' )
client = actionlib.SimpleActionClient( 'l_arm_controller/joint_trajectory_action',
JointTrajectoryAction )
client.wait_for_server()
jt = JointTrajectory()
jt.joint_names = joint_names
jt.points = []
# start at neutral position
jp = JointTrajectoryPoint()
jp.time_from_start = rospy.Time.from_seconds( start_time )
jp.positions = q[:,0]
jp.velocities = [0] * len( joint_names )
jp.accelerations = [0] * len( joint_names )
jt.points.append( jp )
# add precomputed trajectory
for i in range( len( t ) ):
jp = JointTrajectoryPoint()
jp.time_from_start = rospy.Time.from_seconds( t[i] + start_time )
jp.positions = q[:,i]
jp.velocities = dq[:,i]
jp.accelerations = ddq[:,i]
jt.points.append( jp )
# push trajectory goal to ActionServer
goal = JointTrajectoryGoal()
goal.trajectory = jt
goal.trajectory.header.stamp = rospy.Time.now() + rospy.Duration(4.0)
client.send_goal(goal)
client.wait_for_result()
if __name__ == "__main__":
main()
| [
[
1,
0,
0.0221,
0.0074,
0,
0.66,
0,
265,
0,
9,
0,
0,
265,
0,
0
],
[
1,
0,
0.0294,
0.0074,
0,
0.66,
0.0909,
596,
0,
1,
0,
0,
596,
0,
0
],
[
1,
0,
0.0441,
0.0074,
0,
... | [
"from scipy import pi, sin, cos, array, asarray, linspace, zeros, ones, sqrt",
"import matplotlib.pyplot as plt",
"import roslib",
"roslib.load_manifest( 'pr2_controllers_msgs' )",
"roslib.load_manifest( 'trajectory_msgs' )",
"roslib.load_manifest( 'actionlib' )",
"import rospy",
"from pr2_controllers... |
#!/usr/bin/env python
import roslib
roslib.load_manifest( 'rospy' )
roslib.load_manifest( 'kinematics_msgs' )
roslib.load_manifest( 'geometry_msgs' )
import rospy
from kinematics_msgs.srv import \
GetPositionIK, GetPositionIKRequest
from geometry_msgs.msg import \
Pose, Point, Quaternion
import numpy as np
import dynamics_utils as dynutils
#-------------------------------------------------------------------------------
# Main
#-------------------------------------------------------------------------------
if __name__== '__main__':
node_name = "wave_arm"
rospy.loginfo( 'register node %s ...'%node_name )
rospy.init_node( node_name )
rospy.loginfo( 'node %s up and running!'%node_name )
joint_names = dynutils.get_joint_names( 'l_arm_controller' )
ik_service_name = 'pr2_left_arm_kinematics/get_ik'
rospy.loginfo( 'wait for service %s ...'%ik_service_name )
rospy.wait_for_service( ik_service_name )
ik_service = rospy.ServiceProxy( ik_service_name, GetPositionIK )
rospy.loginfo( 'ik service %s is up and running!'%ik_service_name )
# trajectory in cartesian space
time = 10.0; # trajectory time in sec
n = int(time * 200)
dt = time / n;
alphas = np.linspace( 0, 2 * np.pi, n + 1 )
alphas = alphas[0:-1]
ys = np.cos( alphas ) * 0.4
zs = -np.sin( 2 * alphas ) * 0.2
# creating trajectory in joint space
rospy.loginfo( 'creating trajectory ...' )
trajectory = []
req = GetPositionIKRequest()
req.timeout = rospy.Duration(5.0)
req.ik_request.ik_link_name = "l_wrist_roll_link"
req.ik_request.pose_stamped.header.frame_id = "torso_lift_link"
req.ik_request.ik_seed_state.joint_state.name = joint_names
req.ik_request.ik_seed_state.joint_state.position = [0.61309537, 0.45494851, 0.03, -1.03480809, 2.23232079, -0.79696399, -2.44271129]
joint_positions = []
for (y, z) in zip( ys, zs ):
pose = Pose( position = Point( 0.6, 0.20 + y, 0.0 + z ),
orientation = Quaternion( 0.0, 0.0, 0.0, 1.0 ) )
req.ik_request.pose_stamped.pose = pose
# make the call
try:
# print "send request :" #, req
res = ik_service( req )
if res.error_code.val == res.error_code.SUCCESS:
joint_positions = np.asarray( res.solution.joint_state.position )
else:
print "IK failed, error code : ", res.error_code.val
break
except rospy.ServiceException, e:
print "service call failed: %s"%e
break
trajectory.append( joint_positions )
req.ik_request.ik_seed_state.joint_state.position = joint_positions
rospy.loginfo( 'done!' )
pos = np.asarray( trajectory )
dynutils.wrap_trajectory( pos )
vel = dynutils.compute_derivative( pos, dt )
acc = dynutils.compute_derivative( vel, dt )
# plt.plot( acc )
# plt.show()
# move_arms to neutral positions
dynutils.move_arm( [ -np.pi / 3,
np.pi / 3,
0,
-3 * np.pi/4,
0,
0,
0], arm = 'r' )
l_jt_client = dynutils.init_jt_client(arm = 'l')
dynutils.move_arm( pos[0,:],
time_from_start = 5.0,
client = l_jt_client ) # left arm goes to first pos of trajectory
# loop
last_call = rospy.Time().now() + rospy.Duration().from_sec( .5 );
dynutils.track_trajectory(pos, vel, acc, dt, arm = 'l', client = l_jt_client, stamp = last_call )
while ( not rospy.is_shutdown() ):
dur = rospy.Time().now() - last_call;
if ( dur.to_sec() > time - (time / 2.0) ):
last_call += rospy.Duration().from_sec( time );
dynutils.track_trajectory(pos, vel, acc, dt, arm = 'l', client = l_jt_client, stamp = last_call )
| [
[
1,
0,
0.1,
0.1,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
1,
0,
0.2,
0.1,
0,
0.66,
0.2,
164,
0,
1,
0,
0,
164,
0,
0
],
[
1,
0,
0.35,
0.2,
0,
0.66,
0.4,
2... | [
"import roslib",
"import rospy",
"from kinematics_msgs.srv import \\\n GetPositionIK, GetPositionIKRequest",
"from geometry_msgs.msg import \\\n Pose, Point, Quaternion",
"import numpy as np",
"import dynamics_utils as dynutils"
] |
#!/usr/bin/env python
import roslib
roslib.load_manifest( 'rospy' )
roslib.load_manifest( 'rospy' )
roslib.load_manifest( 'kinematics_msgs' )
roslib.load_manifest( 'geometry_msgs' )
import rospy
from kinematics_msgs.srv import \
GetPositionIK, GetPositionIKRequest
from geometry_msgs.msg import \
Pose, Point, Quaternion
import numpy as np
import dynamics_utils as dynutils
if __name__== '__main__':
node_name = "figure_8"
rospy.loginfo( 'register node %s ...'%node_name )
rospy.init_node( node_name )
rospy.loginfo( 'node %s up and running!'%node_name )
joint_names = dynutils.get_joint_names( 'l_arm_controller' )
ik_service_name = 'pr2_left_arm_kinematics/get_ik'
rospy.loginfo( 'wait for service %s ...'%ik_service_name )
rospy.wait_for_service( ik_service_name )
ik_service = rospy.ServiceProxy( ik_service_name, GetPositionIK )
rospy.loginfo( 'ik service %s is up and running!'%ik_service_name )
# trajectory in cartesian space
time = 10.0; # trajectory time in sec
n = int(time * 200)
dt = time / n;
alphas = np.linspace( 0, 2 * np.pi, n + 1 )
alphas = alphas[0:-1]
ys = np.cos( alphas ) * 0.4
zs = -np.sin( 2 * alphas ) * 0.2
# creating trajectory in joint space
rospy.loginfo( 'creating trajectory ...' )
trajectory = []
req = GetPositionIKRequest()
req.timeout = rospy.Duration(5.0)
req.ik_request.ik_link_name = "l_wrist_roll_link"
req.ik_request.pose_stamped.header.frame_id = "torso_lift_link"
req.ik_request.ik_seed_state.joint_state.name = joint_names
req.ik_request.ik_seed_state.joint_state.position = [0.61309537, 0.45494851, 0.03, -1.03480809, 2.23232079, -0.79696399, -2.44271129]
joint_positions = []
for (y, z) in zip( ys, zs ):
pose = Pose( position = Point( 0.6, 0.20 + y, 0.0 + z ),
orientation = Quaternion( 0.0, 0.0, 0.0, 1.0 ) )
req.ik_request.pose_stamped.pose = pose
# make the call
try:
# print "send request :" #, req
res = ik_service( req )
if res.error_code.val == res.error_code.SUCCESS:
joint_positions = np.asarray( res.solution.joint_state.position )
else:
print "IK failed, error code : ", res.error_code.val
break
except rospy.ServiceException, e:
print "service call failed: %s"%e
break
trajectory.append( joint_positions )
req.ik_request.ik_seed_state.joint_state.position = joint_positions
rospy.loginfo( 'done!' )
t = np.cumsum( [dt] * n ) - dt
pos = np.asarray( trajectory )
dynutils.wrap_trajectory( pos )
vel = dynutils.compute_derivative( pos, dt )
acc = dynutils.compute_derivative( vel, dt )
dynutils.save_motion( 'figure8.pkl', 'figure8', t, pos, vel, acc )
| [
[
1,
0,
0.0833,
0.0833,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
1,
0,
0.1667,
0.0833,
0,
0.66,
0.2,
164,
0,
1,
0,
0,
164,
0,
0
],
[
1,
0,
0.2917,
0.1667,
0,
0.6... | [
"import roslib",
"import rospy",
"from kinematics_msgs.srv import \\\n GetPositionIK, GetPositionIKRequest",
"from geometry_msgs.msg import \\\n Pose, Point, Quaternion",
"import numpy as np",
"import dynamics_utils as dynutils"
] |
#! /usr/bin/python
import numpy as np
import sys
from collections import deque
import roslib
roslib.load_manifest('hrl_pr2_arms')
roslib.load_manifest('ar_pose')
roslib.load_manifest('visualization_msgs')
roslib.load_manifest('pykdl_utils')
import rospy
import tf.transformations as tf_trans
from geometry_msgs.msg import Twist
from std_msgs.msg import Float32MultiArray
from visualization_msgs.msg import Marker
from std_msgs.msg import ColorRGBA
from hrl_generic_arms.pose_converter import PoseConverter
from hrl_generic_arms.controllers import PIDController
from pykdl_utils.pr2_kin import kin_from_param
from ar_pose.msg import ARMarker
class ServoKalmanFilter(object):
# TODO tune these parameters properly
def __init__(self, delta_t, sigma_z=0.02*0.001, P_init=[0.0, 0.0], sigma_a=0.02):
self.P_init = P_init
self.delta_t = delta_t
self.F = np.mat([[1, delta_t], [0, 1]])
self.Q = np.mat([[delta_t**4/4, delta_t**3/2], [delta_t**3/2, delta_t**2]]) * sigma_a**2
self.H = np.mat([1, 0])
self.R = np.mat([sigma_z])
self.x_cur = None
self.resid_q_len = int(1./delta_t)
self.resid_sigma_reject = 3.
self.min_reject = 0.1
self.resid_queue = deque()
self.unreli_q_len = 1 * int(1./delta_t)
self.unreli_queue = deque()
self.unreli_weights = np.linspace(2, 0, self.unreli_q_len)
def update(self, z_obs, new_obs=True):
is_unreli = False
if new_obs:
if self.x_cur is None:
self.x_cur = np.mat([z_obs, 0]).T
self.P_cur = np.mat(np.diag(self.P_init))
# predict
x_pred = self.F * self.x_cur # predicted state
P_pred = self.F * self.P_cur * self.F.T + self.Q # predicted covariance
# update
y_resi = z_obs - self.H * x_pred # measurement residual
S_resi = self.H * P_pred * self.H.T + self.R # residual covariance
K_gain = P_pred * self.H.T * S_resi**-1 # Kalman gain
# check residual to be consistent with recent residuals
if (len(self.resid_queue) == self.resid_q_len and
np.fabs(y_resi) > max(self.min_reject,
self.resid_sigma_reject * np.std(self.resid_queue))):
# we have determined this observation to be unreliable
print "INCONSISTENT", self.resid_queue
is_unreli = True
else:
self.x_cur = x_pred + K_gain * y_resi # update state estimate
self.P_cur = (np.mat(np.eye(2)) - K_gain * self.H) * P_pred
# record residual
if len(self.resid_queue) == self.resid_q_len:
self.resid_queue.popleft()
self.resid_queue.append(y_resi)
else:
print "NOT NEW"
is_unreli = True
# record is_unreli
if len(self.unreli_queue) == self.unreli_q_len:
self.unreli_queue.popleft()
self.unreli_queue.append(is_unreli)
# find the unreli level
# this value [0, 1] is a record of the values which have been determined to be unreli
# in the pase few seconds filtered with linear weights
# a value of 0 means there are no unreliable estimates,
# 1 means there is no reliable state estimate
if len(self.unreli_queue) == self.unreli_q_len:
unreli_level = np.sum(self.unreli_weights * self.unreli_queue) / self.unreli_q_len
else:
unreli_level = 0.
return self.x_cur, self.P_cur, unreli_level
def homo_mat_from_2d(x, y, rot):
mat2d = np.mat(tf_trans.euler_matrix(0, 0, rot))
mat2d[0,3] = x
mat2d[1,3] = y
return mat2d
def homo_mat_to_2d(mat):
rot = tf_trans.euler_from_matrix(mat)[2]
return mat[0,3], mat[1,3], rot
def create_base_marker(pose, id, color):
marker = Marker()
marker.header.frame_id = "base_link"
marker.header.stamp = rospy.Time.now()
marker.ns = "ar_servo"
marker.id = id
marker.pose = PoseConverter.to_pose_msg(pose)
marker.color = ColorRGBA(*(color + (1.0,)))
marker.scale.x = 0.7; marker.scale.y = 0.7; marker.scale.z = 0.2
return marker
class PR2VisualServoAR(object):
def __init__(self, ar_topic):
self.ar_sub = rospy.Subscriber(ar_topic, ARMarker, self.ar_sub)
self.mkr_pub = rospy.Publisher("visualization_marker", Marker)
self.cur_ar_pose = None
self.kin_arm = None
self.ar_pose_updated = False
self.base_pub = rospy.Publisher("/base_controller/command", Twist)
self.preempt_requested = False
def ar_sub(self, msg):
if self.kin_arm == None:
self.kin_arm = kin_from_param(base_link="base_link",
end_link=msg.header.frame_id)
base_B_camera = self.kin_arm.forward_filled()
camera_B_tag = PoseConverter.to_homo_mat(msg.pose.pose)
cur_ar_pose = base_B_camera * camera_B_tag
# check to see if the tag is in front of the robot
if cur_ar_pose[0,3] < 0.:
#rospy.logwarn("Strange AR toolkit bug!")
return
self.cur_ar_pose = cur_ar_pose
self.ar_pose_updated = True
def request_preempt(self):
self.preempt_requested = True
def save_ar_goal(self):
r = rospy.Rate(10)
while not rospy.is_shutdown():
if self.cur_ar_pose is not None:
ar_goal = homo_mat_to_2d(self.cur_ar_pose)
print ar_goal
r.sleep()
def test_move(self):
rospy.sleep(0)
base_twist = Twist()
base_twist.linear.x = 0.0 #x_ctrl
base_twist.linear.y = 0.0 #y_ctrl
base_twist.angular.z = 0.4 #r_ctrl
r = rospy.Rate(20.)
while not rospy.is_shutdown():
self.base_pub.publish(base_twist)
r.sleep()
self.base_pub.publish(Twist())
def find_ar_tag(self, timeout=None):
rate = 20.
ar_2d_q_len = 10
sigma_thresh = [0.005, 0.001, 0.01]
no_mean_thresh = 0.5
r = rospy.Rate(rate)
ar_2d_queue = deque()
new_obs_queue = deque()
start_time = rospy.get_time()
while True:
if timeout is not None and rospy.get_time() - start_time > timeout:
rospy.logwarn("[pr2_viz_servo] find_ar_tag timed out, current ar_sigma: " +
str(np.std(ar_2d_queue, 0)) +
" sigma_thresh: " +
str(sigma_thresh))
return None, 'timeout'
if self.preempt_requested:
self.preempt_requested = False
return None, 'preempted'
if rospy.is_shutdown():
return None, 'aborted'
if self.cur_ar_pose is not None:
# make sure we have a new observation
new_obs = self.ar_pose_updated
self.ar_pose_updated = False
if new_obs:
if len(ar_2d_queue) == ar_2d_q_len:
ar_2d_queue.popleft()
ar_2d = homo_mat_to_2d(self.cur_ar_pose)
ar_2d_queue.append(ar_2d)
if len(new_obs_queue) == ar_2d_q_len:
new_obs_queue.popleft()
new_obs_queue.append(new_obs)
# see if we have a low variance tag
if len(ar_2d_queue) == ar_2d_q_len:
ar_sigma = np.std(ar_2d_queue, 0)
no_mean = np.mean(new_obs_queue, 0)
print ar_sigma, no_mean
if np.all(ar_sigma < sigma_thresh) and no_mean >= no_mean_thresh:
return np.mean(ar_2d_queue, 0), 'found_tag'
r.sleep()
def servo_to_tag(self, pose_goal, goal_error=[0.03, 0.03, 0.1], initial_ar_pose=None):
lost_tag_thresh = 0.6 #0.4
# TODO REMOVE
err_pub = rospy.Publisher("servo_err", Float32MultiArray)
if False:
self.test_move()
return "aborted"
#######################
goal_ar_pose = homo_mat_from_2d(*pose_goal)
rate = 20.
kf_x = ServoKalmanFilter(delta_t=1./rate)
kf_y = ServoKalmanFilter(delta_t=1./rate)
kf_r = ServoKalmanFilter(delta_t=1./rate)
if initial_ar_pose is not None:
ar_err = homo_mat_to_2d(homo_mat_from_2d(*initial_ar_pose) * goal_ar_pose**-1)
kf_x.update(ar_err[0])
kf_y.update(ar_err[1])
kf_r.update(ar_err[2])
print "initial_ar_pose", initial_ar_pose
pid_x = PIDController(k_p=0.5, rate=rate, saturation=0.05)
pid_y = PIDController(k_p=0.5, rate=rate, saturation=0.05)
pid_r = PIDController(k_p=0.5, rate=rate, saturation=0.08)
r = rospy.Rate(rate)
while True:
if rospy.is_shutdown():
self.base_pub.publish(Twist())
return 'aborted'
if self.preempt_requested:
self.preempt_requested = False
self.base_pub.publish(Twist())
return 'preempted'
goal_mkr = create_base_marker(goal_ar_pose, 0, (0., 1., 0.))
self.mkr_pub.publish(goal_mkr)
if self.cur_ar_pose is not None:
# make sure we have a new observation
new_obs = self.ar_pose_updated
self.ar_pose_updated = False
# find the error between the AR tag and goal pose
print "self.cur_ar_pose", self.cur_ar_pose
cur_ar_pose_2d = homo_mat_from_2d(*homo_mat_to_2d(self.cur_ar_pose))
print "cur_ar_pose_2d", cur_ar_pose_2d
ar_mkr = create_base_marker(cur_ar_pose_2d, 1, (1., 0., 0.))
self.mkr_pub.publish(ar_mkr)
ar_err = homo_mat_to_2d(cur_ar_pose_2d * goal_ar_pose**-1)
print "ar_err", ar_err
print "goal_ar_pose", goal_ar_pose
# filter this error using a Kalman filter
x_filt_err, x_filt_cov, x_unreli = kf_x.update(ar_err[0], new_obs=new_obs)
y_filt_err, y_filt_cov, y_unreli = kf_y.update(ar_err[1], new_obs=new_obs)
r_filt_err, r_filt_cov, r_unreli = kf_r.update(ar_err[2], new_obs=new_obs)
if np.any(np.array([x_unreli, y_unreli, r_unreli]) > [lost_tag_thresh]*3):
self.base_pub.publish(Twist())
return 'lost_tag'
print "Noise:", x_unreli, y_unreli, r_unreli
# TODO REMOVE
ma = Float32MultiArray()
ma.data = [x_filt_err[0,0], x_filt_err[1,0], ar_err[0],
x_unreli, y_unreli, r_unreli]
err_pub.publish(ma)
print "xerr"
print x_filt_err
print x_filt_cov
print "Cov", x_filt_cov[0,0], y_filt_cov[0,0], r_filt_cov[0,0]
x_ctrl = pid_x.update_state(x_filt_err[0,0])
y_ctrl = pid_y.update_state(y_filt_err[0,0])
r_ctrl = pid_r.update_state(r_filt_err[0,0])
base_twist = Twist()
base_twist.linear.x = x_ctrl
base_twist.linear.y = y_ctrl
base_twist.angular.z = r_ctrl
cur_filt_err = np.array([x_filt_err[0,0], y_filt_err[0,0], r_filt_err[0,0]])
print "err", ar_err
print "Err filt", cur_filt_err
print "Twist:", base_twist
if np.all(np.fabs(cur_filt_err) < goal_error):
self.base_pub.publish(Twist())
return 'succeeded'
self.base_pub.publish(base_twist)
r.sleep()
def main():
rospy.init_node("pr2_viz_servo")
assert(sys.argv[1] in ['r', 'l'])
if sys.argv[1] == 'r':
viz_servo = PR2VisualServoAR("/r_pr2_ar_pose_marker")
else:
viz_servo = PR2VisualServoAR("/l_pr2_ar_pose_marker")
if False:
viz_servo.save_ar_goal()
elif False:
viz_servo.servo_to_tag((0.55761498778404717, -0.28816809195738824, 1.5722787397126308))
else:
print viz_servo.find_ar_tag(5)
if __name__ == "__main__":
main()
| [
[
1,
0,
0.0094,
0.0031,
0,
0.66,
0,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0126,
0.0031,
0,
0.66,
0.0417,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0157,
0.0031,
0,
... | [
"import numpy as np",
"import sys",
"from collections import deque",
"import roslib",
"roslib.load_manifest('hrl_pr2_arms')",
"roslib.load_manifest('ar_pose')",
"roslib.load_manifest('visualization_msgs')",
"roslib.load_manifest('pykdl_utils')",
"import rospy",
"import tf.transformations as tf_tra... |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Sat Feb 11 08:02:58 2012
# by: The Resource Compiler for PyQt (Qt v4.6.2)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x05\x49\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\x86\x00\xaf\x00\xd2\x7d\x1c\x57\xe8\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x01\x1e\
\x04\x26\x1f\x6d\x51\x59\xe5\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x04\xa4\
\x49\x44\x41\x54\x78\xda\xed\x9c\x6d\x4c\x95\x65\x1c\x87\x2f\x0e\
\x07\xe4\x25\x20\x44\xc0\x17\x40\x8c\x06\x44\x93\x35\x60\xb1\x26\
\x99\x58\x89\xbd\x20\x4d\x93\x29\x81\x03\x35\x5d\x22\xd8\x26\xa1\
\x91\xc6\x91\x42\x2b\x4d\x04\x53\x81\x15\x30\x28\x0d\x35\x0c\x6b\
\x24\x86\x4c\xc0\x66\x33\xd8\xa2\x35\x8c\xa6\x19\x2e\x9d\x6b\x34\
\x4b\x09\x90\x97\x73\xfa\x70\x60\xa3\xd6\xda\x79\x1e\xce\x49\x38\
\xe7\x7f\x7d\x3a\x5f\x9e\x7b\x3b\xd7\xfe\xf7\xdb\xef\xb9\xef\x07\
\x04\x41\x10\x04\x41\x10\x04\x41\x98\x74\x38\x02\x9e\x93\xf9\x0f\
\x68\xee\xb2\xbc\x1a\xe0\x3e\xa9\x23\xe5\x68\x81\x93\x80\x01\x88\
\x14\x1d\xca\xab\xbe\x6a\x44\x9e\x08\x54\xc1\xfe\x31\xf2\x44\xa0\
\x42\x74\x80\xc1\x5e\xeb\x20\x02\x55\x90\x01\x18\xec\x34\x1a\x43\
\xf2\xd6\x7d\x86\x99\x41\x61\x56\x21\xf0\xff\x9a\x85\x53\x80\x42\
\x80\x65\xe9\x3b\x08\x8b\x5e\x68\x55\x03\xba\xa5\x59\x02\x94\x01\
\x76\xcf\xac\xce\x26\x62\x61\x82\xd5\xcd\x88\x96\xe4\x31\xa0\x1a\
\xd0\xc6\x2e\x5f\xc7\xbc\xf8\x64\xab\x5c\x52\x58\x8a\x48\xe0\x33\
\xc0\x29\x7a\x71\x22\x4f\x26\x6d\xb4\xda\x35\x99\x25\x08\x05\xbe\
\x00\xdc\xe6\xce\x8b\x23\xfe\xc5\x1c\xab\x5e\xd4\x9a\x9b\x00\xa0\
\x1e\xf0\x0e\x89\x7c\x94\xc4\x97\x77\xa2\xd1\x68\x44\xa0\x89\x78\
\x8f\xc8\x0b\x08\x7c\x20\x82\x95\xaf\xec\xc1\x5e\xeb\x60\xf5\xdb\
\x2a\x73\xe1\x3e\xd2\x6d\x43\x67\x04\x86\x90\xf2\x5a\x11\x8e\x53\
\x9c\x6d\x62\x5f\x6a\x0e\x9c\x81\x5a\x20\xd2\x6b\x46\x00\xa9\xb9\
\xc5\x38\xbb\xba\xdb\xcc\xc6\x7e\xbc\x68\x47\x96\x2a\x0b\xdc\xa7\
\xfa\xb0\x5a\x57\x82\xdb\xbd\x5e\x36\xb3\xbd\x1a\xaf\x40\x3b\xa0\
\x1c\x88\x77\x76\xf3\x20\x4d\x57\x82\xa7\xcf\x2c\x9b\xda\x9f\x6a\
\xc7\xf9\xfc\x3e\x20\xd9\xd1\xc9\x85\xd4\x6d\x07\xf1\xf5\x0f\x52\
\xd3\x46\x0b\xd0\x36\x81\x1d\x7d\x04\x14\x5b\x42\x60\x2e\x90\x69\
\xaf\x75\x20\xe5\xd5\x42\xfc\x83\xe7\x8e\x67\xfc\x8c\x99\xc0\x02\
\xbf\xb2\x44\x05\x6e\x04\x74\x76\x1a\x0d\x2b\xb2\x76\x13\x14\x1e\
\xad\xb8\x81\xa5\xe9\x3a\x06\xfa\x7a\x27\xac\xb5\xa6\x13\x65\x74\
\xb6\x36\x5b\xa4\x0b\xbf\x00\x14\x01\x2c\xdd\xa0\xe3\x41\x95\xc9\
\xca\xcc\x39\xa1\x13\x7a\x6c\xeb\xfa\xe1\x5b\x93\x04\x2a\x9d\x44\
\x9e\x05\x2a\x00\xbb\xa7\x53\xb3\x88\x7c\xfc\x39\x6c\x1d\x25\x02\
\xe7\x03\x47\x01\xed\x82\x65\x6b\x89\x49\x58\x85\x60\xba\xc0\x08\
\x8c\xc9\x8a\xf3\xc3\x71\xcb\x59\x94\x9c\x29\xe6\x14\x08\x0c\x06\
\xea\x00\xf7\xf0\x98\xc5\x2c\xb1\xe2\x64\xc5\x12\x02\xfd\x80\xd3\
\x80\x6f\x70\x44\x0c\xcf\x67\xe6\xa3\xb1\xb7\x17\x6b\x26\x0a\x9c\
\x06\x7c\x09\xcc\x9e\x1d\xfa\x10\x49\xd9\xef\xa2\x75\x70\x10\x63\
\x26\x0a\x74\x63\x24\x59\x99\x1e\x18\xcc\xaa\x6d\xef\xd9\x44\xb2\
\x62\x2e\x81\x4e\x18\x93\x95\xa8\xa9\xd3\xfd\x49\x7b\xdd\x76\x92\
\x15\x73\x08\xb4\xc7\x98\xac\xc4\xba\x79\x7a\xb3\x66\x47\x29\x6e\
\x9e\xd3\xc4\x92\x02\x81\x87\x30\xbe\x86\x24\x2d\xb7\xd8\xe6\x92\
\x15\x73\x08\xfc\x78\xf4\xc7\x37\xa7\x8f\x8b\x1d\x15\x02\x1b\x81\
\x27\x80\x81\xf3\x75\x47\x68\x38\x72\x40\x0c\xa9\x98\x44\xce\x00\
\x89\xc0\x70\xe3\xd1\x12\xce\xd5\x56\x8a\x25\x15\xcb\x98\x5a\x20\
\x0d\x30\xd4\x55\xec\xa1\xed\xcc\xa7\x62\x4a\xc5\x42\xba\x0a\xd8\
\x04\x50\x73\x50\xc7\xf7\xe7\x1b\xc4\x96\x8a\xad\xdc\x7e\x20\xd7\
\xa0\xd7\x53\xbd\x37\x9b\x4b\xed\x5f\x8b\x31\x15\x61\x42\x1e\x50\
\x30\x3c\x34\x44\xd5\xae\x4d\x5c\xed\x6c\x17\x6b\x0a\x05\x02\x6c\
\x06\x2a\x06\xef\xf4\x51\xf1\x46\x3a\x37\xba\x7e\x14\x73\x0a\x05\
\x1a\x80\xb5\x40\x4d\xff\x9f\xb7\x28\xd3\xad\xa7\xfb\x7a\x97\xd8\
\x43\x59\x22\x3d\x0c\xac\x04\x1a\x7a\x7e\xff\x8d\x32\xdd\x7a\xfe\
\xe8\xbe\x61\xf3\x02\xed\x54\x3c\xe3\x8a\x31\xe6\x7a\xc4\xdb\x6f\
\x0e\xeb\xf2\x2b\x70\x75\x57\x76\xd9\xe8\xf6\xcd\x6e\xda\x1a\x6b\
\x27\xb4\x98\xe6\x9a\x32\xfa\x7b\x6f\x03\xbc\x0d\x6c\x35\xa7\x40\
\x30\x5e\xcf\x3a\x0b\x84\xcf\x0a\x0a\x63\x4d\xde\xfb\x38\xb9\xdc\
\x63\xf2\xc3\xd7\x2e\x77\x70\x20\x6b\xc5\x64\x29\xb2\xff\x14\xa8\
\xf6\xbd\xf0\x4d\x20\x0e\x68\xb9\x76\xb9\xe3\xfe\xaa\x9d\x19\xa4\
\x6e\x3f\x84\xc3\x14\x27\x35\x6d\xbd\x35\xc1\x05\x36\x99\xbb\x0b\
\x8f\x25\x10\xe3\xd1\x0c\xbf\x90\xa8\xf9\x24\x6f\x29\x30\xe9\x3c\
\xe0\x98\x0a\x6c\x03\xa2\x6c\x65\x12\xf9\x37\x7e\x06\x16\x01\xdd\
\x9d\xad\xcd\x1c\x2f\xda\x8e\x5e\xaf\x97\x59\x58\x21\x17\x81\xa7\
\x80\x5b\xed\x2d\x75\x9c\x2c\xcd\x17\x81\x2a\x68\x05\x12\x80\xbe\
\x0b\xf5\xc7\xa8\xff\xb0\x50\x04\xaa\xe0\x2c\xc6\x18\x6c\xb0\xe9\
\x93\x0f\x68\x3e\x51\x2e\x02\x55\xf0\x39\x90\x0a\xe8\x4f\x55\x16\
\x70\xc1\x06\x52\x6d\x4b\xdc\x3f\x38\x0c\xa4\x03\xd4\x96\xbc\xc9\
\x77\xe7\x4e\x89\x40\x15\x14\x03\x39\x06\xbd\x9e\x63\x85\x39\x74\
\xb6\xb5\x88\x40\x15\xec\x02\x76\x0f\x0f\x0d\x71\xf8\x9d\xcd\x5c\
\xe9\x68\x13\x81\x2a\xd8\x02\x94\x0e\x0e\xf4\x53\x99\x9f\xc1\xf5\
\x9f\x2e\x8a\x40\x85\x18\x80\x0d\x40\xf5\x9d\xde\x1e\xca\xf3\x5e\
\xe2\xd7\x5f\xae\x20\x28\xc7\x11\xe3\x11\x39\x83\x87\x97\xaf\x21\
\x29\x7b\xef\xe8\x6d\xf5\x56\x51\x63\x3a\x2e\x40\x33\x7f\xff\xe0\
\x84\x08\x54\x88\xc7\x48\x80\x30\x2a\xf0\x92\x28\x51\x8e\xcf\x3f\
\xaa\x50\x50\x41\x00\xc6\x4c\x71\xd2\x77\xe1\xbb\x75\x13\xfa\x2a\
\x10\x0b\xf4\x48\x2d\x8d\x8f\x60\x51\x20\x08\x82\x20\x08\x82\x20\
\x4c\x46\xfe\x02\x33\x9f\x39\x87\x30\x36\x3e\x1c\x00\x00\x00\x00\
\x49\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x0b\xa7\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\x00\x00\x00\x00\x00\xf9\x43\xbb\x7f\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x01\x1e\
\x04\x34\x27\x3d\xa7\x91\xa8\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x0b\x02\
\x49\x44\x41\x54\x78\xda\xed\x9c\x7b\x54\x55\x55\x1e\xc7\x3f\xbc\
\xdf\x20\x04\xa2\x80\x9a\xa9\x08\x9a\x26\xe0\xf8\x48\xb3\xd4\x74\
\x95\x96\x66\x53\x9a\x4d\x96\xcb\x69\x4d\x66\x63\x63\x35\x65\x69\
\x35\x53\x8e\x39\x34\x3e\xa6\xb1\x87\x4d\xa6\x46\x38\x61\xa3\x96\
\x8f\xc4\xa8\x44\x4d\x4a\x11\x41\x44\x45\x01\x79\x28\x28\xc8\xfb\
\xfd\xb8\x8f\x33\x7f\x9c\xb3\xe9\x4e\xc9\xb9\x17\xbc\xc0\xad\xce\
\x77\xad\xbb\xd8\xe7\x9c\xdf\xbe\x67\xdf\xef\xd9\x7b\xff\x9e\x07\
\xd0\xa0\x41\x83\x06\x0d\x1a\x34\x68\xf8\x59\xc2\xce\x86\xc7\xe6\
\x03\xf4\x01\xfc\x95\xb6\xb3\xc9\x35\x03\x50\x09\x54\x00\xc5\x40\
\xc9\xaf\x9d\xc0\x40\x60\x12\x30\x06\x88\x04\x86\x00\x7e\xed\xe8\
\x5f\x0f\x9c\x07\xd2\x81\x64\xe0\x10\x90\xf9\x4b\x27\xb0\x2f\xf0\
\x28\x30\x03\x88\x02\xec\x4d\x2f\x3a\x39\xbb\xe2\xed\x1f\x88\xbb\
\x97\x0f\xee\x9e\x3e\x38\xb9\xb8\x01\x20\x19\x0d\xe8\xf5\x3a\x74\
\x4d\x8d\xd4\x55\x95\x53\x55\x56\x4c\x4b\x53\xc3\xb5\xbe\x3f\x1f\
\xd8\x0f\x7c\x02\x7c\x0b\x48\xbf\x14\x02\x23\x81\xa5\xc0\x03\x82\
\x34\x27\x67\x57\xfa\x85\x8f\xa0\x5f\x78\x24\x7d\x42\x87\xd1\xab\
\x5f\x28\xde\x7e\x01\x16\x7f\x61\x63\x5d\x0d\x25\x97\x2e\x70\x39\
\x37\x93\x82\xcc\x34\x72\x33\x92\xa9\xaf\xa9\x34\x15\xc9\x02\xde\
\x04\x62\x81\xe6\x9f\x2b\x81\xa1\xc0\x3a\x60\x9a\x38\x71\xcb\x84\
\x69\xdc\x3c\x76\x0a\xa1\x11\xe3\x70\x72\x71\xb5\xda\x8d\x24\x49\
\xe2\x72\x6e\x26\xa7\x8e\xec\xe7\xc4\x37\x9f\xd3\x50\x5b\x25\x2e\
\x5d\x01\xfe\x06\xfc\x1b\xd0\xff\x5c\x08\xb4\x07\x9e\x55\x06\xee\
\x02\x30\x7e\xc6\xa3\x8c\x9f\xf9\x58\xbb\x66\x59\x47\x61\x30\xe8\
\x39\x9d\x94\xc0\xe1\xcf\x36\x73\x25\xff\xbc\x38\x9d\x02\xcc\x07\
\xce\xd8\x3a\x81\xbd\x81\x38\x60\x02\xc0\x2d\xb7\x4d\xe3\x9e\xc7\
\x97\xe2\xe1\xed\xdb\xe5\xfb\x86\x24\x49\x9c\x39\xfa\x35\xbb\xde\
\x5f\x49\x7d\x75\x05\xca\x52\x7e\x19\x58\x73\x3d\xfb\x63\x67\x12\
\x38\x14\x48\x00\x82\xdc\x3c\xbd\x99\xbd\x64\x15\x83\xa3\x6e\xeb\
\x76\x75\xdf\xdc\x58\x4f\xfc\x96\x35\x24\x27\x6c\x17\xa7\x3e\x55\
\x94\x59\xb3\x2d\x11\x18\x09\x7c\x05\xf8\x05\x0f\x1c\xca\x63\xcb\
\xdf\xc6\xb3\xc7\x0d\x36\x65\x64\x9e\x39\x76\x80\x6d\x6b\x5e\x40\
\xaf\x6b\x01\x48\x04\x66\x02\xb5\xb6\x40\xe0\x30\xe0\x08\xe0\x1d\
\x36\xf2\x76\xe6\x3e\xbf\x1a\x27\x67\x97\x0e\x7d\x91\x5e\xd7\x42\
\x45\x71\x21\x35\x15\x57\x69\xac\xab\x69\x3d\xef\xe8\xec\x8c\xbb\
\x57\x0f\xfc\x02\x43\xf0\xf2\xf5\xef\xf0\x40\x8b\x0b\xb2\xd9\xfc\
\xda\x13\xd4\x56\x96\x01\x1c\x05\xa6\x00\x75\xdd\x49\xa0\xbf\xb2\
\x41\xf7\x0b\x8d\x1c\xcf\xbc\x97\xde\xc2\xc1\xd1\xc9\xe2\xce\x4d\
\x0d\x75\x64\xa5\x26\x71\x2e\xe5\x10\x17\xcf\x9f\xa4\xb2\xa4\x08\
\x49\x52\xdf\x9e\x9c\x5d\xdd\x08\xea\x1f\xce\x4d\xc3\x47\x11\x16\
\x35\x81\xa0\x01\x43\xb0\xb7\xb7\xb7\xf8\x9e\x95\x57\x8b\x78\x7f\
\xd9\x7c\x6a\xca\x4b\x00\xf6\x02\xf7\x29\x9e\x4e\x97\x13\xe8\x00\
\xec\x03\xa6\x06\x0f\x18\xc2\x13\xab\x3e\xc6\xd1\xc9\x32\xf2\x4a\
\x8b\xf2\x38\xb8\xe3\x43\x32\x8e\xec\x17\x4b\x4a\x40\xa7\x18\xc4\
\x57\x95\x8f\xde\xc4\xcd\xeb\x05\x84\xfc\xd8\x63\xf1\x0d\x0c\x61\
\xcc\xdd\x73\x18\x35\xf5\x41\x5c\xdc\xdc\x2d\xbe\xff\x86\x17\xe7\
\x89\x59\xbe\x1a\x78\xbe\x3b\x08\x7c\x11\x58\xe5\xe6\xe9\xcd\xd3\
\xeb\xb6\xe3\xe3\xdf\xcb\x6c\x87\x86\x9a\x2a\xe2\x63\xd6\x92\x9a\
\xb8\x1b\xc9\x68\x14\xa7\x93\x80\x2f\x80\x78\xe0\xb4\x05\xf6\x5a\
\x00\x30\x1e\xb8\x13\x98\xad\xac\x02\xdc\x3c\xbd\xa5\xc9\x73\x9e\
\xb4\x1b\x73\xf7\x43\xd8\x3b\x38\x98\x1d\x4b\xde\x99\x14\x3e\x78\
\x79\x81\x38\xbc\x0f\xd8\xd5\x95\x04\xf6\x57\x7c\x4f\x97\xf9\xaf\
\xbc\x4b\x68\xe4\x78\x8b\x06\xbc\x6d\xed\x8b\xd4\x54\x5c\x15\xa7\
\x36\x00\x6b\x81\xec\xeb\xb4\x39\xa7\x2b\x9e\xce\x38\x80\x7e\xe1\
\x11\xcc\x5e\xf2\x06\xbe\x3d\x83\xcd\x76\x4e\xda\xf3\x31\x5f\x6c\
\xfa\x07\x40\x29\x10\xa6\x04\x2b\xcc\x2e\x3b\x6b\x20\x16\x08\x8f\
\x98\x38\x83\x09\xf7\xcd\x37\x2b\x9c\x76\x70\x0f\x5b\xdf\x7c\x8e\
\xa6\x86\x5a\x61\xd4\x4e\x04\x62\x2c\x19\xb0\x39\x73\x4f\x71\xdb\
\x36\x29\xb3\xf7\xf6\xea\xb2\x62\xcf\xb4\x83\x7b\xa4\x7e\xe1\x11\
\x76\x3d\x02\x7a\xab\x76\xee\x13\x3a\x9c\xfc\xb3\xa9\x54\x5e\x2d\
\xf2\x50\x6c\xd8\xcf\x2d\x79\x62\xd7\x8b\x3b\x80\xe9\x8e\xce\x2e\
\xdc\x35\x6f\x89\x59\xe1\xf4\xc3\xfb\xd8\xbe\xfe\x15\x8c\x06\x3d\
\xc0\x7a\x60\xac\xf2\xa3\xad\x8d\x1d\x4a\x54\x27\xb1\xb1\xae\xc6\
\x6e\xf3\x5f\x9f\x90\x72\x4f\x1f\x57\x5f\x8e\x76\x76\xcc\x7a\xf2\
\x55\xec\xed\x1d\x00\xe6\x01\xa3\xbb\x62\x06\x7e\x08\xf4\x9f\x34\
\x7b\x21\x61\x23\x27\xa8\x0a\xe6\x67\xa6\xb1\x35\x7a\x09\x46\x83\
\x01\x60\x19\xb0\x1c\x30\x76\xa2\xb9\xd7\xa8\xac\x8e\x10\xa3\x41\
\x1f\x99\xf1\xdd\x57\x84\x45\x4d\x50\x35\x7d\xdc\xbd\x7c\xd0\xb5\
\x34\x51\x90\x99\x66\xa7\x6c\x4d\x31\x9d\x39\x03\x23\x80\x49\x2e\
\x6e\x1e\x8c\x9d\x3e\x57\xdd\x44\xa9\xaf\xe5\xd3\x75\x2f\x61\xd0\
\xeb\xc5\x7e\xb7\xaa\x8b\x6c\x66\x03\xf0\x38\xf0\x99\xae\xb9\x91\
\xad\x6f\x3e\x43\x63\x7d\x8d\x6a\x87\x09\xf7\x2f\xc0\xd5\xdd\x0b\
\x60\xb2\xa2\xa0\x3a\x8d\xc0\xc5\x00\x91\x93\x66\xe2\xe6\xe1\xad\
\x2a\xf8\x65\xec\x5b\x54\x95\x5e\x06\x38\x09\x3c\xdd\xd5\xae\x30\
\xf0\x30\x70\xba\xa2\xb8\x90\xbd\x1b\xa3\x55\x85\xdd\x3c\xbc\x19\
\x33\xed\x21\x71\xf8\xe7\xce\x22\xd0\x1d\x78\x10\xe0\xd6\xe9\x0f\
\xab\x0a\x5e\x2d\xcc\xe3\x78\xc2\x0e\x71\xf8\x3b\xc5\xbe\xeb\x6a\
\x34\x01\xf7\x03\xc6\xb4\x83\x7b\xc8\x3d\x9d\xa2\x2a\x3c\xee\xde\
\x47\x44\xf3\x1e\xc5\xde\xb4\x3a\x81\xf7\x02\x9e\x7d\x06\x0f\xe7\
\x86\xde\x7d\x55\x05\x0f\xed\xd8\x88\xd1\x68\x40\xd1\x8e\x67\xbb\
\xd1\x05\xce\x56\xc2\x6a\xc4\x6f\x59\xad\xea\xe5\x78\x78\xfb\x32\
\x6c\xdc\x54\xa1\x27\xe6\x77\x06\x81\xbf\x05\x18\x3a\x7a\xb2\xaa\
\x50\x5d\x55\x39\xa7\x8e\xc4\x8b\xc3\xd7\x6d\x20\x8e\xf0\x77\xa0\
\xbc\xe8\xc2\x59\xb2\xd3\x92\xd4\x37\xf8\xdb\xef\x15\xcd\xb9\xd6\
\x26\xd0\x5e\x71\xbc\xb9\x79\xec\x14\x55\xc1\x13\x89\xbb\x84\xe2\
\xd8\x03\x14\xd8\x00\x81\x8d\x40\x34\xc0\xa1\x9d\x9b\x54\x05\x07\
\x45\x8e\x13\xca\x64\x08\x72\x44\xdd\x6a\x04\x46\x00\x3d\x7c\x7b\
\x06\xe3\xd7\x2b\x44\x55\x30\xe3\xc8\x97\xa2\xb9\xd9\x86\xa2\x59\
\x1b\x00\x29\xef\x4c\x0a\x15\xc5\x85\x6d\xdb\x78\x0e\x8e\x84\x46\
\x8e\x33\xdd\x0b\xad\x46\xe0\x78\x80\x1b\x87\x46\xa9\x0a\xd5\xd7\
\x54\x72\x25\xef\x9c\x38\x8c\xb7\x21\x02\x6b\x91\x03\xa9\x64\x7c\
\x9f\xa0\x2a\x18\x1a\xd1\x4a\xe0\x24\x6b\x12\x18\x09\xd0\x67\xd0\
\xcd\xaa\x42\x97\xb2\x32\xc4\x46\x7d\x48\xd1\x82\xb6\x84\x9d\x00\
\x39\x69\xdf\xab\x0a\xdd\x34\x6c\x94\x68\x8e\xbd\x56\xec\xa0\xa3\
\x04\x0e\x07\xe8\xdd\x3f\x4c\x55\xa8\x30\xe7\xb4\x68\xa6\x62\x7b\
\xf8\x5a\xf6\x8e\x52\xd1\xb5\xb4\x1d\xcd\xef\x11\xd0\x5b\x78\x2e\
\x7e\xc0\x20\x6b\x11\x18\x0a\x10\xd8\x67\x80\x7a\x9c\xad\x30\xaf\
\x35\x7e\x60\x83\x04\x56\x00\x67\x0d\x7a\x1d\x57\x72\xcf\xa9\x0a\
\xf6\xba\x71\xb0\x68\x8e\xb0\x06\x81\xbd\x00\x77\x37\x2f\x1f\x5c\
\x3d\xbc\x54\x05\xcb\xaf\x5c\x14\xcd\x2c\x6c\x13\xc7\x01\x2e\xe7\
\xa9\x13\x18\xd8\x77\xa0\x68\x86\x59\x83\xc0\x10\x00\x6f\xdf\x9e\
\xe6\x77\xea\xca\x52\xd1\x2c\xb2\x51\x02\xcf\xca\x2b\x25\x57\x55\
\xc8\x3f\xa8\x5f\xeb\x96\x68\x0d\x02\xfd\x64\x4b\xbd\x87\x59\xc1\
\x86\xda\x6a\xd1\x2c\xb3\x51\x02\x2f\x02\x54\x96\x5e\x51\x15\x32\
\x09\xc6\x86\x58\x83\x40\x5f\x00\x37\x4f\x1f\xf3\x61\x10\xbd\xce\
\xd4\x0f\xb5\x45\x14\xc9\xde\x92\xfa\xf3\xf5\xf0\x69\x2d\x04\xf8\
\x49\x1c\xcc\x51\xf9\xeb\x83\x5c\x41\x10\x80\x5c\x29\x95\x4a\xdb\
\xd9\xfa\x28\x00\x47\x27\xe7\xf6\x0c\x34\xc5\xcc\x75\x71\xcf\x7a\
\x25\x6a\x52\xd8\x45\x04\xd6\x03\xe8\x9a\xd5\x73\xea\xae\x6e\x9e\
\xa2\x19\xd0\x16\x81\xd5\xc0\x5f\x91\x73\xa3\xad\x76\x9e\xaa\x3f\
\x64\x26\xa6\x26\x48\x56\xb2\x6c\x51\x16\xda\x96\x33\xbb\x90\x3c\
\x84\x5d\xd7\x46\x79\xdc\x8f\xa4\x80\x6b\x24\xb8\x1c\x4d\xda\xc7\
\x94\xf0\xd4\x7f\x01\x46\x4e\x9e\xc5\xe8\xbb\xe7\xb4\xfd\x54\xdc\
\x3d\xcd\x8e\x6e\x61\x74\xac\x69\xb6\xed\x27\xc8\x39\x75\x94\x2f\
\x63\xfe\x29\x0e\x5f\x05\x76\x77\xf1\x12\x76\x94\xb7\x23\xf5\x58\
\x66\x43\x4d\x95\xa9\xe9\xd3\x26\x81\x00\xdb\x91\xeb\x44\x62\x4e\
\x24\xee\x22\x7c\xd4\x1d\x84\x8f\x9a\xd8\xe1\xd1\x05\xa9\x18\xda\
\xc5\x05\x59\x1c\xdc\xbe\xd1\x34\x42\xb2\xa2\x1b\xf6\xc0\x10\xc0\
\x6c\xd9\x89\x49\xad\xe1\x55\x4b\x94\xc8\xc7\xc0\x32\xc9\x68\x64\
\x6b\xf4\xb3\x5c\x38\x75\xcc\xea\xa3\xae\x2a\x2b\x66\xcb\x8a\xa7\
\x68\x6e\xa8\x03\xd8\x8a\x9c\x1f\xe9\x0e\x84\x01\x04\x04\xf7\x37\
\x3b\x5e\x53\xad\x6d\x89\x16\x5e\x05\xbc\x67\x34\x1a\x88\x8d\x7e\
\x86\xe2\x02\xeb\xd9\xc1\x4d\xf5\xb5\x7c\xb4\x62\x91\x28\xa5\x48\
\x04\x16\xd0\x49\xe5\xb7\x16\x60\x84\xec\x92\x0e\x56\x15\x2a\x2b\
\xca\x17\xcd\xfc\xf6\x98\x31\x8b\x81\x1d\xcd\x0d\x75\x6c\x59\xf1\
\x14\xd5\x3f\x3c\x85\x0e\x43\xaf\xd3\x11\x1b\xfd\x0c\x25\x17\x73\
\x40\x2e\x6e\x9c\x05\xb4\x74\xa3\x19\x33\x11\x20\xe8\xa6\x70\x55\
\xa1\xe2\xfc\xd6\x09\x94\xd9\x1e\x02\x0d\x8a\x49\x71\xa0\xa6\xbc\
\x84\x2d\x2b\x16\x51\x57\xdd\xf1\xbc\xb7\x24\x49\xec\x78\xfb\x15\
\x72\x33\x92\x51\x34\xed\x5d\x8a\xf6\xa7\x1b\x67\xdf\x0d\x1e\x3e\
\x7e\xa6\xae\xda\x35\xc7\x7d\x39\xaf\x95\xb7\xe4\xf6\x1a\xd2\x2d\
\xc8\x89\x98\x8c\x92\x8b\x39\xc4\xac\x5c\x4c\x4b\x73\x63\x87\x46\
\x9b\x10\xfb\x16\xe9\x87\xf7\x01\xd4\x20\xd7\x49\x17\xd2\xbd\x78\
\x04\x60\xe8\x98\xc9\xd8\xd9\xb5\x5d\xe1\x52\x5a\x94\x2f\x8a\x8e\
\x8a\xaf\x35\x66\x4b\x3c\x91\x6a\xf1\x83\x0b\xb3\x33\x88\x5b\xb3\
\x54\x24\xc6\x2d\xc6\xd1\xf8\x6d\x22\x7c\xde\xa2\x2c\xdb\x8c\x6e\
\x26\xcf\x03\xf8\x03\xc0\xc8\x3b\xef\x57\x15\xcc\x49\x6f\x8d\x17\
\x1e\xba\xd6\x75\x4b\x5d\xb9\x42\x65\xbf\x28\x3d\x77\xfc\x20\x7b\
\x36\x5a\x9e\x13\xcf\x4c\x4e\x14\xf2\x92\xa2\x30\x0e\xd8\x80\x0b\
\xb7\x08\xf0\xea\x13\x3a\x9c\x90\x81\x43\x55\x05\xcf\x9f\xf8\x56\
\x34\xf7\x5f\x0f\x81\x00\x39\xc8\xa9\xcc\x86\x63\xfb\x3f\xe5\xeb\
\xb8\x77\xcd\x76\xb8\x94\x75\x8a\xb8\x35\x4b\x85\x31\xbd\x4c\x31\
\x59\xba\x1b\x21\xc8\xef\x8c\x70\xe7\xdc\xa7\xcc\x7a\x5b\x39\x27\
\xbf\x13\xfa\x60\xef\xf5\x12\x28\xbc\x95\xb9\x80\xe1\xc0\xb6\x0d\
\x1c\x8d\xdf\xd6\xa6\x60\xf9\x95\x8b\xc4\xac\x5c\x8c\xae\xa5\x09\
\xe0\x3d\xc5\x58\xee\x6e\xb8\xa0\x54\x5c\x85\xfd\xe6\x0e\x06\x8d\
\x18\xab\x2a\x9c\x91\x94\x60\x9a\x92\x28\xb3\x06\x81\x28\xee\xd6\
\x1f\x01\x69\xcf\xc6\x55\x9c\x3d\xf6\xd3\x15\x59\x57\x5d\xc1\xe6\
\xd7\x17\x0a\x0b\x7e\xb7\x62\x12\x75\x37\x5c\x91\x53\xab\x51\x5e\
\xbe\x01\xcc\x5a\xf4\x17\xb3\x1d\x4e\x7c\xd3\x5a\xdd\x16\xdb\x96\
\x4c\x47\x43\xfa\x1b\x84\xb7\x12\xb7\x76\xa9\x74\xf1\x7c\xfa\x0f\
\x6a\xbb\xb9\x91\x98\x95\x8b\x45\xba\xb0\x75\xc6\x76\x33\x79\x83\
\x91\xa3\xe2\x53\xdc\x3c\xbd\xa5\x47\x97\xaf\xc7\xcb\x8c\xfb\x56\
\x70\xee\x24\x97\xb2\x4e\x09\xff\x37\xce\xda\x04\x0a\xff\x75\x83\
\xbe\xa5\xd9\x6e\xf3\x6b\x0b\x29\x2e\xc8\xc2\x68\x30\x10\xb7\x66\
\x29\x85\xd9\x19\x00\x17\xc4\x9e\x69\x03\xb3\x6f\x10\xf2\xab\xb3\
\x3c\xb6\xfc\x1d\xbb\xe0\x01\x43\xcc\x76\x38\xfc\x59\x6b\x1a\x7b\
\x13\x72\x32\xfe\x9a\xb8\xde\xfa\xc0\xfd\xc0\x08\x83\x5e\x37\x38\
\xf3\xf8\x21\x72\x4f\x27\x73\x3e\xe5\x30\xca\x7e\x31\xd1\x06\x6c\
\x3d\x53\x05\x38\x03\xe8\xed\xea\xe1\xc5\xa0\x88\x5b\xcd\x28\xbf\
\x0c\xe2\x3f\x5a\x03\xf2\xcb\x37\x0f\xa1\xf2\xea\xc3\xf5\x96\xb7\
\x19\x94\x25\x7a\xa4\xa6\xbc\x44\xa8\xfc\x46\xe4\x2c\x7e\x0e\xb6\
\x03\x23\x72\x8d\xa0\x21\x69\x6f\x2c\x97\x73\x33\x55\x3d\x8f\xdd\
\x1f\xbc\x21\x0e\xd7\x21\xbf\xa0\x48\x67\x11\x88\xb2\x44\xef\x41\
\xae\x49\x46\x21\xf4\x18\xb6\x87\x54\x60\xbd\x64\x34\xb2\xf3\xdd\
\xd7\xda\x74\x06\xbe\xdf\xf7\x09\x45\x39\x67\x44\xe8\xca\xac\xc1\
\x6b\xad\x22\xf3\x66\x45\xc3\x9d\x51\xdb\x70\x6d\x00\x49\xc0\x23\
\xb5\x95\xa5\x3e\xae\x1e\x5e\xf4\x1d\x7c\xcb\xff\x07\x0d\x0a\xb2\
\x89\x5b\xfd\x82\xa8\xdf\x5e\x80\x05\x05\x01\xb6\xfc\x3f\x13\x3a\
\x0b\xd3\x81\xbd\x4e\xce\xae\xfc\xe9\x5f\x3b\xf1\x0b\x94\x13\x6d\
\xb5\x55\xe5\xbc\xf3\xdc\x1c\xf1\xda\xc5\x26\xe0\xf7\x68\x68\x13\
\xff\x01\xa4\x01\xc3\x46\x4b\x2b\x77\xa6\x4b\xcb\x36\x27\x4a\x81\
\x7d\x07\x4a\x8a\xbb\x99\x8e\x5c\x7d\xab\x41\x05\xfe\xc8\x2f\xd3\
\x48\xa3\xa6\x3e\x20\x79\xf9\xfa\x0b\xf2\x32\x81\x60\x8d\x1e\xcb\
\xf0\x80\x42\x9a\xf8\xa4\x02\x3d\x35\x5a\xda\x87\x4d\x0a\x79\xef\
\x2b\x21\x2e\x0d\xed\x84\x03\x10\xa4\xd1\xa0\x41\x83\x06\x0d\x1a\
\x34\x68\xd0\xa0\x41\x83\x06\x0d\x1a\x34\x68\xd0\xa0\xe1\x57\x82\
\xff\x01\x97\x42\xc3\x35\xf6\x81\x05\xaf\x00\x00\x00\x00\x49\x45\
\x4e\x44\xae\x42\x60\x82\
\x00\x00\x06\x5f\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\x00\x00\x00\x00\x00\xf9\x43\xbb\x7f\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x01\x1e\
\x06\x1f\x26\x3f\x54\x88\x39\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x05\xba\
\x49\x44\x41\x54\x78\xda\xed\xdc\x7d\x88\x5c\xd5\x19\xc7\xf1\xcf\
\x6c\xe2\xfa\x42\x93\xf5\x6d\x29\xd1\x28\x4d\x0d\xb4\x55\x23\x55\
\x4c\xc5\x1a\x41\x63\x25\x4d\x1b\x63\xd7\x12\xdf\xdf\x5a\xa4\xa8\
\xad\x14\x5f\xd0\xd6\x5a\xc4\x37\x6a\x53\x85\x16\x15\x54\xac\xf8\
\x56\xaa\x46\x04\x43\xa4\x1a\x89\x46\x45\xd4\x88\x28\xd1\x8a\x4a\
\x9a\x18\x93\x26\xb5\x6b\x8c\xab\x26\xd5\x68\xf6\xf4\x8f\x7b\x76\
\x76\x76\xb2\x3b\x73\xef\xec\x6e\x98\xc9\x9e\x1f\x1c\x98\xb9\xf7\
\xdc\x3b\x73\xbf\xf3\x9c\x73\x9e\xe7\xb9\xcf\x1d\x92\x92\x92\x5a\
\x58\xa5\x16\xfb\xbe\xdf\xc5\x4c\x4c\xc5\x38\x7c\x81\x0d\xe8\xc6\
\x1a\xac\x88\xed\xcb\xf4\xd3\x0e\xfc\x91\x4f\xc5\x72\x84\x1c\xed\
\x7f\x78\x0e\x57\x61\xca\x58\xb7\xc0\x29\xb8\x0f\x33\xc0\xce\x38\
\x19\xfb\x63\x4f\x7c\x85\x8f\xb1\x1e\xef\x63\x25\xde\x1b\x70\xfc\
\x56\x3c\x88\xcb\xf0\x9f\xb1\x66\x79\x3f\xc4\x46\x04\x1d\x82\xf9\
\x82\x8d\x82\x4d\x75\xda\xbf\x05\x7f\x17\xfc\x78\x80\x55\xae\xc7\
\x21\x63\x09\xde\x3c\x6c\x41\x30\x4b\xb0\x5a\xf0\x91\xe0\x35\xc1\
\xab\x82\xf7\x73\x80\xdc\x14\xfb\x1f\x5c\x86\xb8\x12\x5f\xdb\xd1\
\x40\x4d\x1b\x64\xdb\x71\x65\xcb\xb9\x50\xf0\xba\xa0\x4b\x30\x5e\
\xef\x80\xb9\xee\x7b\x82\xa7\x72\x40\xfc\xaf\x60\x8f\xf2\x71\xbf\
\xde\xd1\xe0\xbd\x30\xc8\xf6\x3b\xca\x90\x1e\x13\x4c\xb0\xb5\x02\
\xdc\xa7\x71\x96\xcb\xde\x97\xf4\x5a\x90\x03\xe2\x6d\x03\x86\xf3\
\xbc\xd8\x4e\xad\x78\x3d\xab\xd5\xac\x73\x3f\xac\x8b\x2b\x6b\xb5\
\x26\xe0\xdd\xaa\x95\xf5\x65\xec\x53\xd1\x67\x57\x2c\x42\x30\x51\
\xaf\xd5\x75\x00\xbe\x92\x6b\xf5\x9e\xd6\x2a\xf0\x3a\xab\xbe\xf8\
\x60\x3a\xa4\x62\xff\x12\xb4\x0d\xe1\x41\xac\x42\x70\x7d\x1d\x80\
\x6f\x57\x7c\x5e\x57\x45\x9b\xd3\x7a\x00\x3b\xf0\x5a\xc5\x97\x5e\
\x5d\xa3\xef\x6f\xa3\x53\x3c\xa1\x46\x9f\xd3\x10\xcc\xa8\x03\x70\
\x8d\xe0\x3b\x82\x0d\x83\xec\x3b\xa8\x75\x00\xee\x86\xe7\xab\xac\
\x6f\x79\x1d\x1f\xf5\x80\x3a\xe7\x9c\x8c\x60\xaf\x3a\x00\xdf\x11\
\x2c\x19\x62\xdf\x30\x01\xb6\x6d\x27\x78\xed\x58\x80\x19\x26\xe1\
\xd1\x5c\xc7\x04\xfc\xab\x4e\x9f\xcf\xc8\x11\xb8\x7d\x1c\x63\x93\
\x51\xd0\xf8\xed\x00\x6f\x5c\x8c\x26\x7e\x64\x6f\x3c\x81\xcf\x47\
\xec\xdc\xdf\x04\x13\x73\xf4\xbc\x01\x47\xe2\xe0\xaa\xed\x1b\x9b\
\x3f\x8e\xcd\xdc\x92\x09\x7a\xbd\x10\x87\xcd\xcb\xb9\x86\xf0\xed\
\xf8\x10\xa7\xd7\xe8\xf3\x30\x82\x79\x75\x86\xf0\x5b\xad\xbb\x0a\
\xff\x11\xc1\x2e\x7a\x2d\xae\xb8\xa0\xfa\x00\x67\x55\x5d\xdc\x32\
\x9c\x89\x3d\xe2\xfe\x7d\x63\x8c\x1b\x94\x04\x4b\xeb\x00\x5c\x32\
\xe0\x5c\x1f\x55\xb4\x8d\x15\xaf\x0f\x6c\x36\x78\xbf\x21\x46\x10\
\x8f\x56\x5d\x50\x6d\x80\x13\xcb\xce\xf2\x24\xc1\xee\x55\x11\x48\
\x75\xfb\x53\x0e\x47\xfa\xa4\x72\xff\x7b\x5b\xc5\xd7\xbb\xa0\x1c\
\x29\xdc\x3b\xc8\x05\xd5\x06\x78\x71\x19\xce\xad\x82\x75\x82\x1b\
\x63\xe8\xd6\x1e\xb7\xef\x2a\x98\x2d\x78\x32\x07\xbc\x3f\x97\x3f\
\xab\x17\xdf\x6f\x05\x78\x67\xc4\x44\x53\x70\xcb\x10\x17\x55\x1b\
\xe0\xce\xb8\xbf\x0c\xf1\x38\xc1\xf2\x78\xdc\x67\x82\xf5\x39\x13\
\x09\xff\x8c\x90\xfb\xad\xf5\xaa\x56\x80\x77\x42\xcc\x12\x07\xd7\
\xd5\xb8\xb8\x7c\x8b\xc8\xcf\xd1\x53\x06\x30\x4f\xb0\x58\xf0\xe9\
\x10\xe7\xec\x11\xbc\x28\xb8\x59\x70\xd4\x00\x70\x9f\xb7\x4a\x12\
\xe1\x58\x6c\x42\x70\x69\x1d\xeb\xc8\x07\x10\x26\xe1\xee\x98\x18\
\xed\x87\x72\x68\x8c\x3e\x8e\x15\x4c\x17\x4c\xa9\x18\xde\xfd\x6d\
\x4b\x9c\xf3\xa6\xb6\x02\xbc\xe9\xd1\x5d\x0d\xce\xcb\x31\xbc\xf2\
\x03\xec\xd3\xb7\x30\x3f\x86\x76\x43\x2d\x28\xbd\x71\xff\x83\xf8\
\x19\xf6\xde\x5e\x7e\xda\x70\x75\x20\x96\xa2\xd3\x29\xb8\x2b\x47\
\x7c\xf3\x26\x8e\x00\x6f\x34\x90\x29\x9e\x1c\x43\xbc\xdd\xa3\xc5\
\x93\xdd\x54\x5a\x85\x4f\xb6\xb7\xe5\x0c\x37\x12\xf9\x06\x9e\x44\
\xa7\xd9\xd1\xf5\x1d\xfd\xe0\x70\x6d\x6c\x4d\xa1\xe1\x00\xfc\x3a\
\x9e\xc2\x64\x47\xc7\x60\xad\xbd\xa1\xa4\xea\x8d\x4d\x3e\x3d\x2d\
\x8d\x01\xe8\x88\x02\xec\x88\xf0\xa6\x3a\x0c\x0f\xc5\x5c\x4b\x63\
\xba\xa2\xc9\x01\x86\x91\x06\xb8\x5b\x1c\xb6\xd3\x7c\x3b\x66\x56\
\x3a\x1a\xb0\xdd\x6b\x9b\x1c\xdb\xcd\xd1\x89\x1a\xe1\x21\xdc\x8e\
\xc7\x70\x84\xfd\xb1\x50\x96\x5f\x2e\xaa\x4e\x5c\xda\x02\x76\x77\
\xf5\xc8\xe6\x03\xc7\x45\x17\xe1\x07\x3a\x05\x8b\x62\x48\x3f\xc6\
\x95\x17\x60\x09\x7f\x45\x97\x89\x82\x45\x4a\x75\x73\xc5\x09\xe0\
\x36\x33\xc2\x39\x76\x11\x2c\x54\xda\x26\x29\x99\x00\xd6\xd4\xef\
\x71\xb1\xf1\x82\x05\x4a\xa6\x27\x68\x45\x00\x5e\x84\x6b\xb5\xe1\
\x3e\x25\x33\x13\xb0\x22\x00\xcf\xc2\x5f\xc0\x6d\x38\x31\xc1\x2a\
\x02\x70\x2e\xee\x41\xc9\x7c\x9c\x9d\x40\x15\x01\x38\x13\x8f\xa0\
\xcd\x95\xf8\x65\x82\x54\xc4\x91\x3e\x46\x56\x4a\xc1\xf9\xf8\x5d\
\x02\x54\xd4\x02\xfb\x6f\x21\x9e\x9b\xe0\x34\x02\xf0\x82\x18\xa0\
\xd1\x25\x58\x95\x00\x15\x05\xb8\x55\x56\x85\xfc\xb4\xf5\x4a\xe6\
\xe2\x83\x04\xa9\xe8\x22\xf2\x05\x4e\xc2\x32\x2b\x31\x27\x5f\x56\
\x22\x01\x1c\xa8\x9e\x88\xee\x6d\x6f\x45\x9c\x9b\x13\xac\xa2\x8e\
\x74\x37\x8e\xc7\x1a\x2f\xc9\xee\xf6\x6e\x49\xc0\x8a\x86\x72\x6b\
\xa3\x5f\xd8\x6d\x31\x7e\x11\x67\xc9\xa4\x42\xc9\x84\x15\xb2\x62\
\x9f\x1e\x0b\x70\x49\x82\x56\x14\x20\x59\x59\xee\x89\xd8\xec\x2e\
\xb9\x32\xb5\x09\xe0\xb6\x7a\x56\x56\x93\xfc\xa5\x9b\xca\x69\x86\
\x04\xb0\x60\xff\x85\xb2\xbb\xfe\xc1\x95\xb2\x12\xa0\x14\x0b\x17\
\xd6\xdf\x64\x85\x8e\xb7\xb8\x30\xbe\x9a\xd3\xc0\x59\x96\xe9\xab\
\x70\x6e\x4e\x3d\x33\xfa\x1f\x71\xb5\xbe\x02\xca\xc7\x73\x96\x9c\
\x0d\x5e\x1d\xdf\xec\xed\x0f\x23\x6d\x81\x7d\xba\x06\x7b\xf9\xca\
\x45\x4e\x16\x3c\xde\x70\xba\xff\x03\x59\x8d\x4c\xb3\x6a\xc5\x68\
\x9e\xbc\x84\x07\x64\xcf\x6a\xf4\x5a\xd6\x90\x05\x4e\x6b\xe5\x39\
\x70\xb8\xa5\x40\x01\xe7\x60\xa1\x0d\x4a\x7e\xa2\xf6\xb3\x47\x69\
\x15\x1e\x54\x5b\xa3\x7b\xf3\x8c\x75\x71\x41\xe9\x4e\x00\x8b\x6a\
\x33\xba\xf0\xea\x58\xcb\xe0\x8c\x64\x35\x5f\x0f\x66\xe3\x5d\x6f\
\xe2\xa7\x63\x23\x83\x33\xd2\xe5\x90\xdd\xb2\x27\xce\xd7\x7a\x51\
\x76\x37\x6f\x4b\x02\x58\x54\x6b\x23\xc4\x6e\xff\x90\xdd\x9c\x4a\
\x19\x9c\x86\x74\xb8\xbe\xc7\x14\xce\xdb\x71\xdd\x98\xd1\xd6\x4c\
\x7d\x8f\x3e\x5c\x9e\x00\x36\xaa\xb9\xfa\x9e\x5c\x9a\x9f\x00\x36\
\xaa\x33\x88\x0f\x0d\xde\x99\x00\x36\xaa\x5f\x21\x68\x13\x3c\x9c\
\x00\x0e\x27\x01\x51\xfd\x27\x3a\x09\x60\x41\xdd\xaa\x45\xff\xaf\
\xa5\x59\xd4\x9f\xc1\x49\x00\x1b\xd6\x4e\xb2\xdb\x03\x09\xe0\x30\
\xd4\x2e\xfb\xfb\xa6\x04\x70\x98\x10\x3b\x12\x86\xa4\xa4\xa4\xa4\
\xa4\xa4\xa4\xa4\xa4\xa4\x31\xa6\xff\x03\xde\xf7\xb4\x7b\xfa\x64\
\x3d\x22\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x07\xcd\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\x00\x00\x00\x00\x00\xf9\x43\xbb\x7f\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x01\x1e\
\x06\x1a\x11\xfa\x9e\xd9\x73\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x07\x28\
\x49\x44\x41\x54\x78\xda\xed\xdc\x7d\x6c\x57\xd5\x1d\xc7\xf1\xd7\
\x2d\x95\x02\xb5\x14\xa8\x84\x90\xb1\x0c\xa6\x04\x5d\x2c\x99\x44\
\x9d\x99\x98\x89\x28\x28\xce\xa7\x65\x22\x93\x32\x56\x34\x6a\x75\
\x4e\xc9\xd4\xb2\x45\xc1\xf9\x88\x73\x3e\x45\xc6\x7c\x44\x57\xc0\
\x81\xb0\x6c\xa2\x24\x9b\x84\x82\xca\xe2\xc6\xd0\x65\xba\x6c\x95\
\xa8\x1b\xa5\xdb\xc0\xce\xb8\x96\x0a\x43\x5a\xee\xfe\xb8\xb7\xb5\
\x05\xfa\x70\xdb\x5f\x6b\xa1\xf7\x93\xdc\xfc\xee\xc3\x39\xe7\xde\
\xfb\xfe\x7d\xcf\x39\xdf\xf3\xbd\xe7\x5e\x52\xa5\x4a\x75\x18\x2b\
\x38\xcc\xae\xf7\xcb\x38\x0b\xc7\xa1\x1f\xf6\xe2\x43\x54\x63\x3b\
\xde\x8d\x97\x7d\xe9\x5f\xdb\xf2\x4f\x9e\x81\xb7\x10\x76\x60\xd9\
\x83\x57\x71\x2b\xc6\xf4\x75\x0b\x1c\x83\x32\x4c\x84\x9c\x1c\x2e\
\xbc\x90\x51\xa3\x18\x32\x84\x86\x7a\x6a\x6a\xd8\xb9\x93\xaa\x7f\
\x52\xb9\x8d\xca\xed\x2d\xf2\x37\x60\x05\x6e\xc2\x8e\xbe\x06\xf0\
\x5c\xfc\x02\x43\x06\x0f\x66\xee\x8d\x14\x15\xd1\xbf\x7f\xdb\x99\
\x6a\x6a\x78\xfd\x75\x56\xff\x92\x75\xeb\x9a\x76\xef\xc0\xd4\xd8\
\x8a\xfb\x04\xc0\x4b\xb1\x1c\x47\x4d\x9a\xc4\x83\x0f\x90\x9b\x4b\
\x55\x15\xfb\xf7\x73\xcc\x31\x0c\x1d\xda\x7e\x21\xef\xbd\xc7\xb5\
\xd7\x51\x51\x01\xfe\x8e\xf1\xa8\x3b\x92\xda\xb7\xc2\x43\xec\x9b\
\xdc\xd8\x9e\x15\x17\x0b\x37\x94\x0b\xcf\x9f\x26\xcc\xce\xb6\xbf\
\x79\x5b\x37\x61\x82\x70\xf5\x2a\xe1\xb6\x7f\xb4\xbd\xfc\xed\xaf\
\xc2\xfc\xfc\xa6\x7c\x37\x1c\x49\x16\x58\x88\xc7\x70\xfa\x01\xfb\
\x1f\xc7\x55\xb0\xb4\x8c\x92\x6b\xed\xaf\xab\x93\x15\x1f\xab\x8b\
\x7b\xdd\x2f\x40\x10\x08\x9f\x7a\x52\x70\xf6\xd9\x6d\x9f\x68\xc5\
\x4a\x4a\x4b\x9b\x36\xa7\xc7\xbf\xfd\xe2\x36\x12\x6a\xf1\xbb\xce\
\x58\xe7\x67\x05\xf0\xf3\xf8\x03\xfe\x13\x57\xab\xe6\xca\xc3\x1b\
\x18\xdb\x6c\xdf\x66\x5c\x82\x7f\xc5\xdb\x03\xb1\x0a\xe7\xe7\xe5\
\x09\x5f\x7d\x45\x30\x6c\x58\xeb\x27\xdb\xba\x95\x73\xa6\xb4\x7b\
\x4d\xe3\xf1\x76\xd2\x1b\xc9\xfe\x0c\xe0\x0d\x47\x65\xbc\x3e\xf2\
\x10\xc7\x77\xe1\x9b\xf8\x73\xbc\x5d\x8e\x73\xb0\xbf\x59\x9a\x3d\
\xb8\x00\xef\xef\xda\x65\xf4\xf3\xab\xb8\xe6\xea\xd6\x4f\x98\x9b\
\xfb\xe9\xfa\xf9\xd3\x3e\x5d\xdf\x57\xcf\xcb\x2f\x77\xed\x66\x7a\
\x1a\x60\x3e\x9a\x5f\x72\x65\x2b\xe9\xde\xc2\x0f\x71\x05\x2e\x3e\
\x00\x5e\xa3\xc2\x38\xcd\x73\xe5\xe5\xed\x03\x1c\x3b\x96\x97\x5e\
\x64\xc0\x80\x96\xc7\xa6\x4c\xe5\x9d\x77\x3a\x7f\x43\x59\x3d\x08\
\x6f\x10\x5e\x8a\x47\x13\x4d\x5e\x47\x1b\xe9\x17\xc6\xae\xc7\xae\
\x36\xd2\xbc\xd6\x58\x45\xdb\xd2\xee\xdd\x2c\x5c\x78\x30\xbc\x4c\
\xa8\xa7\x00\xf6\x8f\xdb\xac\x89\x23\x46\xf0\xec\x33\x1d\xca\x13\
\xe2\xbd\x76\xd2\xd4\x41\x7d\x7d\xdb\x89\x6a\x6b\xf9\xfd\xeb\xdd\
\x73\x63\x3d\x51\x85\xfb\xc5\xa3\x89\x69\xc3\x86\xb1\x72\x05\x7b\
\xf7\x66\xac\xec\x2f\x42\x5e\x5e\xfb\x09\x1f\x7a\x98\x93\x4f\xe6\
\x84\x13\x0e\x76\xbc\x7b\x33\xc0\x00\x8b\x71\xd9\xd1\x47\x0b\x97\
\x96\x09\xc6\x8c\x69\x72\x6c\xdb\xd3\x63\x71\x67\xf2\x3d\x3c\xd7\
\x4a\x9a\x79\x44\x60\xda\x52\x6e\x6e\x64\xa5\x97\xcd\x38\xfc\xaa\
\xf0\x42\x5c\x95\x93\x23\x7c\x66\x89\xe0\xc4\x13\x3b\x9c\x6f\x2a\
\xae\x46\x41\x3c\x22\xd9\x8c\x22\x34\x8e\x3f\x3e\x17\x8f\x71\x2f\
\x0d\x02\xe6\x14\xb7\x5d\xd8\xce\x0f\x5a\x6c\x7e\xd4\x6c\xf9\x6f\
\xb3\xf5\x86\xde\x66\x81\xf3\x70\x4b\x76\xb6\xf0\xf1\xc7\x04\xa7\
\x9e\xda\xe1\x7c\x83\x63\x67\xda\x88\x11\xfc\x6f\x8f\xb0\xa6\xd6\
\x29\x58\x7a\xa8\xc4\xf3\xe7\x73\xd2\x49\x6d\x17\xb8\x64\x49\xd3\
\x6a\x19\x66\x1f\x0e\x16\x58\x82\x7b\x83\x40\xf8\xf0\x43\x82\x49\
\x93\x12\xe5\xbd\xa2\x71\xa4\x31\x77\x2e\x9b\x36\x09\x6e\xbb\x95\
\x09\x13\x3e\x0d\x24\x0c\x18\xc0\xe4\xc9\x3c\xbf\xb2\x7d\xeb\x5b\
\xba\x94\xb5\x6b\x9b\x3a\xa5\xc7\x0f\x87\xa1\xdc\x4c\xfc\x1c\xfd\
\xee\xbd\x87\xcb\x2f\x3f\x38\x41\x45\x05\x53\xcf\x25\xf6\xfc\x0f\
\x1c\x89\xe4\xe0\xa9\xb8\xca\x3a\xe3\x0c\xee\xba\x93\xd1\xa3\x09\
\x43\xea\xea\x3a\xd6\x69\x54\x6e\xe7\xf6\x05\xac\x2f\x6f\xda\x75\
\x1b\xee\xea\xed\xbd\xf0\x05\x58\x82\x7e\xf3\xe6\x1d\x1a\x5e\x07\
\xb4\x17\xb3\xb0\x01\x0f\xbd\xf6\x9a\xc1\x5f\x3b\x33\x8a\x03\xce\
\x2a\x6a\xbd\xc3\xa8\xaf\x8f\xfc\xc1\xcd\x7f\x8c\x2c\x6e\xf3\xe6\
\x16\xe5\x95\xe2\x91\xee\xea\x25\x33\xa5\x49\xb1\xa3\x3c\xa8\xa4\
\x84\x79\xa5\xad\x27\x6c\xc7\x02\x9b\x6b\x24\xee\x8e\xdb\xad\xa6\
\xe6\xa6\xf0\x44\x06\xe5\x72\x54\x36\x1f\xef\xe6\xc3\x0f\xd9\xb1\
\x83\x4f\x3e\x69\x91\x77\x9f\x28\x9e\x78\xa7\x28\xcc\xdf\xab\xfd\
\xc0\x53\xf0\x2b\x0c\x2a\x2a\x6a\x1b\x5e\x42\xfd\x1b\x73\x70\x5f\
\xdc\x36\x7e\x03\xc7\xbe\xfd\x97\x56\x1d\xef\xf7\xb1\x05\xbf\xc5\
\x8b\x71\xb0\xa2\x5b\x95\x09\x80\x5f\xc2\x5a\xe4\x5f\x7c\x11\x77\
\xde\xd1\x2d\xd7\xf9\x0e\x6e\x89\x97\x51\x38\x16\x43\xf0\x71\x7c\
\xbc\x5a\x14\x30\xad\xed\xe9\xc8\x48\x57\x01\x8e\x8e\xff\xed\xe1\
\x93\x27\x73\xff\xfd\x64\x75\xff\xe0\xb0\x2a\x5e\x7a\x85\xba\x02\
\x70\x04\xd6\x61\xd4\x69\xa7\xf1\xd3\x45\xed\x3f\xaf\x38\x84\x0a\
\x63\x67\xbb\x37\x6b\x23\x7e\x93\x69\x80\xf9\x31\xbc\xe3\xc6\x8f\
\xe7\xc9\x27\x18\x38\xb0\xd3\x17\x58\xda\xcb\x01\x86\x99\x06\x38\
\x28\xae\xb6\x85\x63\x8f\x8b\x22\x2b\x83\x07\x27\x2b\x60\xf8\xf0\
\x8c\x76\x34\xdd\xa2\xc5\x3f\x8b\xa2\x38\x99\xae\xc2\xfd\xf1\x02\
\xbe\x32\x6a\x54\xe4\xe5\x17\x14\x24\xbf\xb8\x82\x02\x4a\x4a\x7a\
\xb9\xd9\x85\xdc\xf7\xe3\xcc\x0e\xe5\xfa\xc5\x03\xf8\xb3\x0b\x0a\
\x84\xcb\x97\x31\x72\xa4\x3e\xaf\x8e\x02\x0c\xf0\x34\x2e\xc9\xcb\
\x13\x3e\xb7\x5c\x30\x7a\x74\x0a\x2f\x09\xc0\x07\x30\x3b\x27\x27\
\x8a\xe9\x1d\x7f\x7c\x0a\x2e\x09\xc0\xdb\x30\x37\x3b\x5b\xb8\xe4\
\x69\x41\x7b\xa1\xa3\x14\x60\x4b\x5d\x8f\x3b\xb2\xb2\x58\xf4\xa8\
\x60\xe2\xc4\x14\x58\x12\x80\xb3\x1a\x23\x18\xf7\x2d\xe4\xbc\xf3\
\x52\x58\x49\x00\x5e\x88\x67\x11\x2c\x98\xcf\xf4\xe9\x29\xa8\x24\
\x00\xcf\xc2\x6a\x64\xdd\x78\x03\x73\xe6\xa4\x90\x92\x38\xd2\x67\
\x62\x3d\x7c\x67\x76\x14\x52\x4f\x95\xcc\x02\x9b\x62\xc8\x33\x66\
\xa4\x70\x3a\x03\xb0\x04\x6b\x60\xf6\x6c\x61\x65\x65\x0a\x28\x29\
\xc0\x06\xd1\xfc\xb9\xf2\x9d\x1f\x08\x8a\x66\x51\x5d\x9d\x42\x4a\
\xda\x89\xec\x15\x85\xce\x37\x6f\xdb\xc6\xe5\x33\x3b\x16\x95\x48\
\x01\xb6\x54\x0d\xbe\x8e\x8a\xad\x5b\x29\x2e\x66\xcf\x9e\x14\x56\
\x52\x47\xba\x5a\x34\xb1\x71\xfb\x96\x37\xb8\xa6\xe4\xa0\xa7\x5e\
\xa9\x3a\x30\x94\xab\x8a\xfd\xc2\xea\x8d\x1b\xf9\xfe\x4d\x34\x34\
\xa4\xd0\x92\x06\x13\xde\x15\x4d\xf6\xa9\x59\xb3\x86\xf9\x0b\x52\
\x68\x49\x01\xc2\x9f\x70\x11\x76\x2f\x5b\xd6\xb1\x48\x6d\x0a\xf0\
\x60\xbd\x82\x6f\x61\xdf\xe2\xc5\x3c\xf1\x44\x0a\x2f\x29\x40\xb1\
\x93\x5d\x8c\xf0\xee\x7b\x58\xb5\x2a\x05\xd8\x99\xa7\x72\xcb\x45\
\x13\x1d\x1f\xbd\xa5\x94\xfc\x7c\xa6\x4c\x49\x5e\xc8\x9b\x6f\x46\
\x93\xbf\x7b\xab\x36\x6d\xea\x58\xba\xae\x4c\x2e\x5a\x80\xdb\xb3\
\xb3\x85\x65\x65\x82\xd3\xbf\x9a\x2c\x73\x57\x5f\x2f\xe8\x41\x2d\
\xc4\x0f\x32\x69\x81\x8d\xfa\x11\x0a\xea\xeb\x5d\x7f\xe5\x95\xd1\
\x83\xa6\x4e\x86\xfb\x77\xea\xc4\x1b\x42\x3d\xa8\x77\xbb\xcb\x02\
\x1b\xf3\x2f\xc5\xcc\xa1\x43\x85\x2b\x57\x08\xc6\x8d\x4b\x6c\x81\
\xe3\x7b\x39\xc0\x8c\x76\x22\x07\x2a\x14\xcd\xdd\x5b\xf3\xd1\x47\
\x82\x6f\xcf\x66\xfb\xf6\xb4\x17\x4e\xaa\x86\xd8\xbd\xd9\xb0\x63\
\x07\x33\x8b\xa2\x09\x8f\x29\xc0\x64\xda\x2d\x7a\x9b\xf2\x8d\xbe\
\x16\xc1\xc9\xe4\x6c\xbe\x1a\x9c\x87\xad\x15\x15\x14\xcf\xe9\x1b\
\x11\x9c\x4c\x4f\x87\xac\x16\xbd\x71\x5e\xb5\x65\x0b\xd7\x5d\x77\
\xe4\x47\x70\xba\x63\x3e\x69\x55\x0c\xb1\x7a\x7d\x39\x37\xdf\x7c\
\x64\x47\x70\xba\x6b\x42\xee\x56\x4c\x43\xed\xaf\x5f\x38\xb2\x23\
\x38\xdd\x39\xa3\x79\x4b\xdc\xb1\xec\x5e\xb6\x8c\xfb\x7f\x92\x02\
\xec\x8c\xca\x63\x17\xa7\x61\xd1\xa2\x16\xef\xac\xa5\x4a\xa8\x99\
\xa2\xd7\xf6\xc3\x07\x1f\x88\x3e\x47\x32\x6e\x5c\xd3\xa7\x48\x0a\
\x53\x3c\x1d\xd3\x77\x11\x66\x65\x09\x9f\x7a\x32\x05\xd8\x95\x00\
\xc4\x81\x1f\xd1\x49\x01\x26\xd4\x22\x2d\xbf\xb6\x96\x02\x4c\xa8\
\x00\xcb\x52\x80\x5d\xd3\x51\xa2\xc7\x03\x29\xc0\x2e\xa8\xbf\xe8\
\xf5\xd8\x14\x60\x17\x21\xe6\xa7\x18\x52\xa5\x4a\x95\x2a\x55\xaa\
\x54\xa9\x52\xa5\xea\x63\xfa\x3f\x96\x06\x21\x66\xa1\x06\xc5\xf7\
\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x0c\xe2\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\x00\x00\x00\x00\x00\xf9\x43\xbb\x7f\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x01\x1e\
\x04\x09\x06\x1b\x26\xc9\x48\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x0c\x3d\
\x49\x44\x41\x54\x78\xda\xed\x9c\x79\x70\xd4\xd5\x1d\xc0\x3f\xbf\
\xdf\x9e\xd9\xdd\x64\x93\x6c\x4e\xc8\x05\x01\x0c\xc8\x19\xb9\x45\
\x6a\x44\x41\xf0\x40\x2b\x5e\xc5\xea\xb4\x53\xa1\x3a\x56\x7a\xd1\
\xce\xd4\xd2\x69\x6d\xab\xce\xb4\x38\x38\x6a\x3b\x6d\x3d\xe8\x88\
\x88\xc5\x83\x7a\x80\x80\x07\x8a\x86\x00\x4a\x48\x08\x77\x0e\xc2\
\x91\x90\x04\x72\x67\xb3\x9b\xdd\xfd\xbd\xfe\xf1\xfb\xfd\x82\x20\
\x45\x42\x7e\xbb\x39\xc8\x77\x26\xb3\x99\x37\x9b\xef\x7b\xef\x93\
\xf7\xde\xf7\x78\x07\x0c\xc8\x80\x0c\x48\x1f\x16\xa9\x97\xb7\xcf\
\x01\x8c\x04\x86\x02\xc9\x40\x22\x10\x07\x98\x01\x01\x34\x03\x3e\
\xe0\x34\x70\x14\xa8\x04\xca\x80\xd6\xcb\x15\x60\x14\x30\x47\xfb\
\x99\x04\x8c\xd3\x60\x75\x45\x84\x06\xb1\x00\xc8\x07\x36\x03\xa5\
\xfd\x1d\xe0\x18\x60\x31\xb0\x10\x88\xd5\x0b\x65\xd9\x44\x7c\x4a\
\x3a\x9e\x41\x19\xc4\x26\xa4\xe2\x74\xc7\x61\x8b\x72\x22\xcb\x32\
\xb2\xc9\x8c\xbf\xdd\x4b\x30\xe0\xa7\xf9\x74\x2d\x2d\x0d\x75\x9c\
\xaa\x3e\xca\xe9\xaa\xca\xf3\xe9\x2f\x06\xd6\x00\x2f\x02\xb5\xfd\
\x09\x60\x06\xf0\x0c\x70\x9b\x5e\x90\x9c\x31\x9c\x51\x53\xf2\x18\
\x36\x6e\x2a\x83\x87\x5d\x89\xd5\x16\xd5\x25\x85\xa1\x60\x80\xda\
\x63\xe5\x54\x1e\x28\x64\xd7\x27\xef\x70\xfc\x70\xc9\xb9\x5f\x79\
\x0d\xf8\x12\x78\x1b\xa8\xe8\xcb\x00\x6f\x05\x5e\x05\x5c\xb2\xc9\
\xcc\x84\x6b\x6f\xe6\xea\x5b\xee\x23\x25\x73\x44\xb7\x15\x9f\x28\
\xdb\xc7\xe6\xd5\xcf\x71\xb8\xf0\x0b\x84\x10\x17\xfa\xea\x17\xc0\
\x32\xe0\x93\xbe\x06\xf0\x21\xe0\x59\xc0\x34\x22\x77\x06\xb7\x3d\
\xf4\x3b\x62\x13\x52\xba\xad\x34\x18\x08\xb0\x79\xf5\xb3\x6c\x5d\
\xb7\xb2\xb3\x2c\x66\xf4\x6c\x4c\x51\x31\x98\x9c\x71\x48\x92\x84\
\x64\xb2\xe0\xaf\x2d\xa7\xa9\x78\xc3\xd7\xd7\xcc\xe7\x80\xa5\x80\
\xbf\x2f\x00\xfc\x29\xf0\x34\x20\xdd\xb0\xf0\x27\xe4\x2d\x78\xd0\
\x10\xa5\x3e\x6f\x2b\xab\x9e\x5c\x22\xca\x4b\x76\x4a\x9d\xe0\xec\
\xd1\xb4\x96\x6d\x27\xd0\x70\xfc\x6c\xd3\x9e\x75\x15\xee\xb1\x37\
\xe2\x3f\x55\x49\x7d\xc1\x6b\xa0\x84\x00\xb6\x6b\xc6\xab\xa9\x37\
\x03\x7c\x08\x78\x1e\x90\xe6\xff\x78\x19\x53\xe6\xdc\x69\x88\xd2\
\x0e\x9f\x97\x97\x7e\xbf\x98\xa3\x07\x8b\x90\x6d\x2e\xe2\x26\x2f\
\xa0\x61\xc7\x1b\x28\xfe\x33\xde\x8c\xd9\x9d\x0c\xa1\x20\xc1\xd6\
\xd3\x9d\x65\xb6\xe4\xe1\x78\x66\xdc\x4f\xcd\x86\xe5\x84\xbc\x8d\
\x00\x5f\x01\xd7\x76\xc5\x0d\x92\x22\xbc\xe6\xbd\x05\x98\xe6\x2f\
\xfe\x2d\x53\x6e\xbc\xcb\x10\xa5\x42\x08\xd6\x2c\x5f\xca\x9e\x2f\
\x36\x61\x8a\x8a\x11\xee\x71\xf3\xa4\xfa\x82\x35\x9d\x80\x52\x6e\
\xfa\x15\xce\x21\x93\x90\x64\x59\x35\x32\x7e\x2f\x8d\x85\xff\xa5\
\x76\xe3\x0a\x94\x8e\x76\x64\xab\x83\xa4\x39\x4b\xa8\xfb\xf8\x1f\
\x84\xda\xea\x01\xd6\x01\xdf\xd5\xa6\xf6\xb7\x8a\x29\x42\xf0\x46\
\x00\x1b\x80\xa8\xbc\x3b\x17\x31\xf3\xf6\x1f\x18\xa6\x78\xfb\x07\
\xff\x61\xeb\xba\x95\x48\x66\xab\x12\x37\xf1\x0e\xb9\x7e\xdb\x6a\
\x00\x92\x66\x2f\x21\xed\xae\x27\xb1\xc5\xa7\x21\x49\x67\xc6\x89\
\x6c\xb6\xe0\x48\x1b\x83\x67\xfa\x7d\x04\x1a\xaa\xf0\x55\xed\xa3\
\xad\xac\x80\xe4\x39\x3f\xa3\xad\x34\x1f\x84\x92\x03\xd4\x68\x96\
\xba\x57\x00\x8c\x02\x3e\x02\xd2\x47\x4f\x9f\xcd\xfc\xc5\x8f\x9d\
\xd5\xa1\xee\x48\xe3\xa9\x93\xac\x7a\x6a\x89\x08\x05\x83\x92\x67\
\xda\x42\xa9\x7e\xfb\x1a\x10\x0a\xa9\xb7\xfc\x86\x84\x19\xf7\x5f\
\xb0\x1e\xc9\x64\x21\x66\xf4\xf5\x04\x9b\x6b\x69\x3f\xb1\x97\xf6\
\x63\xc5\x24\xce\x7a\x58\x85\x28\x9b\x66\x21\xc4\x4b\x17\x33\x95\
\xe5\x08\x00\x7c\x0a\xb8\x32\x3e\x25\x8d\x3b\x1e\x79\xdc\x30\x78\
\x00\x1b\x5f\x59\x41\x87\xaf\x5d\x72\x5d\x31\x53\xb4\x96\x6e\x43\
\x84\x02\xc4\x4d\x5a\x40\xfc\xd4\x7b\x2e\x5a\x47\xea\xfc\x65\xb8\
\x46\xcc\x20\xe4\x6d\xa4\x65\xdf\xc7\xb8\x86\x5f\x0d\x4a\xc8\x6e\
\x76\x79\x9e\xb9\x98\xbf\x0f\x37\xc0\x09\xc0\x23\x00\xdf\x5b\xba\
\x1c\x5b\x94\xc3\x30\xc5\xb5\xc7\x2b\x28\xde\xba\x01\x40\xd8\x93\
\x87\x49\xfe\x9a\xc3\x58\xdc\x29\xa4\xcc\x5b\xda\x35\x37\x44\x96\
\x19\x7c\xc7\x1f\x91\x6d\x4e\xbc\x95\xbb\x88\xca\x18\xaf\xba\x44\
\x6d\xf5\x77\x00\x99\x3d\x0d\xf0\x69\x40\x9e\x71\xeb\xfd\x0c\x1a\
\x3a\xd2\x50\xc5\x9f\xaf\x5b\x89\x10\x02\xf7\x84\x5b\x85\xee\xd3\
\x25\xcd\x59\x82\x6c\x8d\xea\xb2\x2e\xb3\xcb\x43\xd2\x0d\x8f\x02\
\xd0\x54\xbc\x9e\x98\xd1\xb3\x41\x08\xd9\xec\xf2\x2c\xed\x49\x80\
\xf3\x80\x6b\x6d\x0e\x17\x79\x77\x2d\x32\x54\xb1\xaf\xad\x85\xdd\
\x5b\xd7\x03\x60\x8d\x4f\x97\x03\x8d\xd5\x58\x13\xb2\x70\x8f\x9d\
\x77\xc9\x3a\xe3\x27\x2f\xc0\x1c\x9d\x48\x47\x5d\x05\x56\x4f\xba\
\x6a\xb1\x3b\xbc\x0f\x7c\x9b\x9d\x08\x27\xc0\xc7\x00\xae\x5d\xf0\
\x23\xa2\x9c\x31\x86\x2a\x2e\xfe\x62\x23\xc1\x0e\x3f\x51\xe9\x63\
\x7d\xde\xca\x5d\x2a\x80\x29\x77\x77\x6b\x7d\x95\x4c\x16\xe2\xa7\
\xde\x0b\x80\xbf\xb6\x1c\x4b\xec\x20\x44\x47\xbb\x0b\xb8\xa6\x27\
\x00\x4e\x07\xa6\x5b\xed\x51\x4c\x9b\x7b\x8f\xe1\xca\x4b\xb6\x6d\
\x06\x20\x7a\x64\x9e\xbd\xad\x6c\x3b\x92\xc9\x82\x7b\xfc\xcd\xdd\
\xd6\x1b\x37\xf1\x76\x00\x5a\x0f\x6d\xc5\x35\x7c\xba\x5e\x7c\x4b\
\x4f\x00\x7c\x10\x60\xea\x8d\xf7\x60\xb5\x3b\x0c\x55\xec\x6f\xf7\
\x52\x51\xb2\x13\x24\x49\x48\x26\x33\x08\x05\x47\xe6\x04\xcc\x0e\
\x77\xb7\x75\x9b\x5d\x1e\x1c\x99\xb9\x88\x50\x10\x21\x14\xdd\xca\
\x5c\x1f\x69\x80\x0e\xe0\x4e\x80\x49\xb3\x17\x18\xae\xbc\xa2\x64\
\x27\xa1\x60\x10\xfb\xa0\x91\xf8\xaa\x0e\xa8\x23\x71\xd4\x75\x86\
\xe9\xef\x1c\x79\xa1\x20\xc8\x66\x10\xca\x28\xc0\x19\x49\x80\x73\
\x01\xe7\xe0\xec\x51\x78\x52\xd3\x0d\x57\x5e\x79\x70\xb7\xda\xd1\
\x61\xd3\xa4\xb6\x23\x6a\xb0\xe0\x1c\x3a\xc9\xb8\xff\x7e\x56\xae\
\x6a\xa8\x4e\x1e\xc2\x96\x38\x04\xd4\x8c\xf8\xb8\x48\x03\xe4\xca\
\x69\x37\x84\x65\x6d\x38\x7e\xa8\x44\xb7\xbe\x04\x9b\x6a\x90\x2c\
\x76\x6c\x89\xd9\xc6\x85\x4d\x83\x47\xa9\x00\x6b\x4a\xb1\x7a\x32\
\xf4\xe2\x9c\x48\x02\x9c\x0d\x30\x22\xf7\xea\xb0\x00\xac\xaa\xd8\
\xaf\xaf\x4d\x00\xd8\x53\x73\x3a\x13\x05\x46\x88\x6c\x75\x60\x8e\
\x4e\x00\x25\x88\x6c\xb1\xeb\xc5\x43\x23\x05\x30\x1d\x48\xb7\xda\
\x1d\xa4\x66\x5d\x61\x38\xbc\xd6\xa6\x7a\xda\x5b\x9b\x91\x2c\xf6\
\x90\x9e\xaa\xd2\xa6\x99\xa1\x62\x89\x1d\x74\xbe\x7e\x45\x04\xe0\
\x44\x80\xcc\x91\x13\x0c\x8d\x79\x75\xa9\x3f\x79\x4c\x85\x96\x90\
\x29\x75\xd4\x1f\xd7\x52\x56\xd9\x86\xd7\x63\x8e\x4e\x54\x53\x65\
\x4a\xb0\xd3\xcf\x8e\x14\xc0\xb1\x00\xc9\x19\xc3\xc2\x32\x7d\x1b\
\x6a\x4e\xe8\x23\x44\x0e\x34\x56\xab\xbf\xc7\xa4\x18\x0f\xd0\x19\
\xa7\xbb\xd7\xfa\xa7\x3b\x52\x00\x87\x03\x24\xa5\x0d\x0d\x0b\xc0\
\xd6\x26\x35\x9b\x6c\x71\x27\x77\x66\x96\x2d\xee\x64\xc3\xeb\x91\
\x2d\x5a\x3c\xad\xfb\x82\x17\x70\x63\xcc\x06\xd7\x9d\x01\x10\x9f\
\x92\x16\x16\x80\xde\x16\x75\xbb\xc2\xe4\x8c\x27\xd4\xd6\x00\xc0\
\x91\x17\x7e\x20\xcc\xee\x54\x2f\x42\x51\x10\x4a\x08\x24\x09\x59\
\x36\x49\x92\x6c\x42\x92\x65\x49\x92\x4d\xc8\xb2\x09\x21\x04\x42\
\x28\x42\x28\x0a\x42\x28\x48\x92\x2c\xc9\x26\x13\x92\xfc\x8d\x58\
\xd7\x5f\x73\x18\x80\xe6\x92\x4d\x5a\x89\x88\x8e\x14\xc0\x64\x00\
\x57\x6c\x42\x78\x01\x3a\xdc\x84\x7c\x2d\x02\x90\x44\x28\x28\x05\
\xea\x8f\x39\x2f\x26\xdc\xed\xc6\x8c\x5b\x18\x29\x80\x89\x00\xd1\
\xb1\x9e\xb0\x00\xec\xf0\xb7\x77\x4e\x31\xc5\xdf\xa6\x2f\x50\x93\
\x51\xcf\xc7\x84\x53\xf6\x45\x0a\x60\x2c\x80\x2d\xca\x19\x96\x5e\
\x04\xfc\xbe\x4e\x5f\x4d\x84\x02\x7a\xf1\x4e\x7a\x50\x8c\x36\x22\
\x12\x80\x6c\x32\x71\xb9\x88\xdc\x17\x1b\x2d\x94\xc0\x00\xc0\x4b\
\x1a\xde\x9a\x73\x2e\x49\x72\xbf\x05\xd8\x04\xd0\xde\xda\x1c\x96\
\xc6\xda\x9d\xaa\x37\x11\xf2\xb5\x81\x6c\x0a\xe9\xc5\xfd\x09\x60\
\x33\xa8\xe7\x54\xc2\x21\x16\xab\xca\x4a\x09\x78\x91\xcd\x36\xdd\
\xcb\x8d\xea\x77\x23\xd0\xd7\xd6\x12\x96\xc6\xea\xdb\xa2\x4a\x7b\
\x0b\xb2\xcd\x29\x7f\xdd\xf2\xf7\x17\x80\x55\x00\x8d\x75\x55\x61\
\x69\xac\x23\x5a\x0d\x49\x43\xde\x26\x4c\x51\x6e\xdd\xd4\x47\xf7\
\x27\x80\x95\x00\x4d\xa7\x6b\xc2\xd2\x58\xa7\x5b\x4d\x8a\x04\xbd\
\x0d\x98\xce\xec\x81\x78\xfa\x13\xc0\x0a\x80\xfa\x93\xc7\xc3\xd2\
\xd8\x98\x78\x35\x71\x10\x6c\xae\xc3\xec\xea\xe4\x96\xd2\x9f\x00\
\x96\x02\x9c\xaa\x3e\x1a\x96\xc6\xba\xb4\x11\x18\x68\xae\xc1\xec\
\x8a\x3f\x2b\xfe\xee\x2f\x00\xf7\x01\x9c\x3c\x72\x30\x2c\x8d\x8d\
\x4b\x52\x33\xc5\x81\xc6\x6a\xcc\xae\xce\x84\x45\x46\x7f\x02\x78\
\x10\xf0\x35\xd6\x55\x87\xc5\x12\x5b\x6c\x76\x5c\xb1\x1e\x35\x4f\
\x77\x26\x0b\x35\xa8\x3f\x01\x0c\x02\x45\x00\xc7\xcb\xf6\x86\xa5\
\xc1\x89\x83\xb3\xd4\x70\xee\x4c\x32\x21\xab\xbf\x85\x72\x5f\xc2\
\x99\xed\x47\xa3\xc5\x93\x92\xa1\x01\xec\xdc\xaf\x18\xd2\xdf\x00\
\x16\x00\x1c\x3d\x54\x1c\x96\x06\x27\x68\x23\x50\xf1\xb5\x20\x99\
\xad\x00\x49\x3d\xe9\x0b\x7e\x3d\x1f\x68\x3d\x27\x2c\x92\xb8\xc8\
\x83\xd6\xe7\x48\x11\x40\x59\x51\x01\x4a\x28\x64\x78\x6a\x4b\xdf\
\xb0\x52\x37\xbe\x33\xf5\xf4\x7b\x0e\x3d\x94\x17\x3c\x17\xe0\x73\
\xc0\x7d\x46\x28\x0e\x74\xf8\x38\x51\xb6\x97\xf4\x11\x63\x0d\x6d\
\x70\x4a\x96\x7a\x93\xc9\x5b\x71\x16\xaf\x1d\xc0\xfb\xe7\xe6\x1e\
\x00\xdb\x39\x7d\x0d\x6a\x9f\x4e\x20\x15\x48\x00\xf6\x00\xbb\x80\
\x45\x40\x47\x77\x00\xb6\x02\xdf\x07\x3e\x03\xfe\x79\x56\x0c\xea\
\x70\x75\x49\xa9\xdf\xdb\x8a\x23\x3a\x96\x13\x65\xfb\x0c\x07\xe8\
\xf6\xfc\x5f\xb7\xef\xa6\x4b\x54\x29\x80\x9f\x5f\x0a\x3c\x7d\x9a\
\x9e\x4f\xa6\x02\xef\x02\x09\x09\x83\xb2\x78\xe0\xb7\xcf\xe1\x49\
\xed\x51\x77\xeb\xec\x8c\xc5\xe9\x1a\x9a\xea\x4e\x12\x52\x82\xf8\
\xbd\x6d\xe7\x1f\x19\x16\x2b\x66\x8b\xf5\x1b\xe5\xed\x6d\xcd\xbc\
\xf2\xc4\xa3\x5f\x1f\x34\x59\xa8\xf7\x8d\x31\x12\x20\x40\x1a\xb0\
\x1e\x18\xe3\x8c\x89\xe3\x9e\x5f\xfe\x85\xec\x31\x93\xe9\xcb\xe2\
\x6d\x69\xe2\xc5\xdf\xfd\x88\x6a\xd5\xd1\xdf\x87\x7a\x2b\xa9\xae\
\x3b\x3a\x2f\xb4\xc2\x37\x03\xaf\x00\xa3\x03\x7e\xdf\x15\xc5\x5b\
\xd7\x13\x1d\x97\xc0\xe0\xec\x51\x7d\x12\x9e\xaf\xad\x85\x17\x7f\
\xbf\x88\xea\x8a\x03\x00\x07\x80\x3c\x0c\xb8\x3b\xfc\x6d\x26\xb2\
\x03\x58\x0b\xd8\x84\xa2\xcc\x38\xb0\xf3\x53\xfc\x3e\x2f\xd9\x63\
\xa6\x18\x7a\x22\x2a\xec\xf0\xbc\xad\xbc\xfc\xf8\x43\x9c\x28\x2d\
\xd1\xe3\xf5\x3c\xe0\xa4\x11\xba\x2f\xc6\xc7\x10\xc0\x87\xc0\x31\
\x60\xde\xd1\x83\x45\xa6\xaa\xf2\x03\xe4\x4c\xfa\xce\x79\xd7\x98\
\xde\x26\x1d\x3e\x2f\x2b\xff\xf8\x30\x47\x0f\x16\xe9\xd9\xa2\x3c\
\xe0\x84\x51\xfa\xbb\xe2\xa4\x15\x02\x9f\x03\xf3\x4e\x55\x55\x3a\
\x0f\xec\xfc\x8c\x9c\x89\x33\x3b\xf7\x29\x7a\x25\x3c\x7f\x3b\xff\
\xfe\xd3\x23\x1c\xd9\xb7\x0b\xd4\x47\x29\xf2\xb4\x4f\x7a\x02\x20\
\xc0\x11\xd4\xab\xf2\xb3\xda\x9a\xea\x93\x76\x7f\xfa\x3e\x59\xa3\
\x72\x71\x27\xa4\xf4\x3a\x78\x81\x0e\x3f\xab\x9e\x7c\x94\xf2\x3d\
\x3b\xd0\x46\x5c\x1e\x06\x5c\xf1\xef\x2e\x40\x80\x7a\xd4\xab\xfa\
\x57\x05\xfc\xbe\xec\xc2\x2d\xef\x12\x9f\x9c\xd6\xe9\xe0\xf6\x06\
\x09\x06\x02\xac\x7a\x6a\x09\xa5\xbb\xb7\xa1\xad\x75\xd7\x01\x87\
\xc3\x51\xd7\xa5\xc6\x59\x7e\x60\x35\x90\x20\x14\x65\xd2\xde\x82\
\x8f\x08\x06\xfc\x64\x8f\x9d\x12\x96\x83\x95\x5d\x85\xb7\xfa\x2f\
\xbf\xe0\xd0\x57\x5b\xd1\xac\x6c\x9e\x66\x75\xe9\x4d\x00\x75\xe3\
\xb2\x5e\x6b\xe4\x8d\x95\xfb\x0b\xe5\x9a\xca\x52\x72\x26\xcd\xc4\
\x64\xb6\xf4\x08\xbc\x50\x28\xc8\xeb\xcb\x7f\xcd\xfe\x1d\x1f\xa3\
\x39\xc7\xd7\x03\x7b\xc3\x59\xa7\x11\x91\xfe\x97\x9a\x71\xb9\xad\
\xee\x78\xb9\xfd\x50\x61\x3e\x57\xe4\xce\xc0\xde\xc5\xf0\xaf\xbb\
\xa2\x84\x42\xac\x5d\xf1\x1b\x4a\xf2\x37\x01\x34\x68\xf0\x8a\xc2\
\x5d\xaf\x51\xa9\x92\x0a\xd4\xeb\xfc\x73\x5b\x1a\xea\xe2\xf7\xe4\
\x6f\x22\x6b\x64\x2e\x31\x9e\xa4\x88\xc1\x7b\xe3\xd9\x65\x14\xa9\
\x17\x10\x9b\x50\x6f\x0a\x7c\x15\x89\xba\x8d\xcc\x35\x9d\x46\x7d\
\xd4\x66\xa2\xbf\xbd\x6d\xc8\xee\x4f\xdf\x27\x61\x70\x26\xc9\xe9\
\xd9\x61\xed\x80\x10\x82\x75\x7f\xfb\x03\xbb\x3e\x79\x47\x8f\x6d\
\xe7\xa2\xbe\xc0\x41\x5f\x03\x08\xe0\x45\x7d\x62\x29\x55\x09\x05\
\x73\x4b\xf2\x37\x21\x9b\xcd\x64\x8d\xcc\x0d\x8b\x71\x11\x42\xf0\
\xce\x3f\xff\xcc\xce\xcd\x6f\xea\x75\xcf\x45\x7d\x4c\x87\xbe\x0a\
\x10\x20\xa4\x65\x72\x5a\x81\x59\xe5\x7b\x76\xc8\xa7\xab\x8f\x92\
\x33\xf1\x3b\x86\x26\x57\x85\x10\xbc\xf7\xc2\x53\x14\x6c\x78\x1d\
\xa0\x1d\xf5\x55\x90\x2d\x91\x36\x5c\xe1\x3c\x09\xb9\x0d\xd8\x0d\
\xdc\x54\x53\x79\xd8\x76\x78\xf7\x36\x46\x4e\xce\xc3\x6a\x37\xe6\
\x2c\xd0\x86\x95\xcb\xc9\x7f\xef\x55\xdd\xa5\xba\x0d\xf5\x95\x36\
\xfa\x13\x40\x50\xb7\x39\xdf\x07\xe6\x35\xd7\xd7\xc6\x16\x7f\xfe\
\x01\xc3\xc6\x4d\x51\xb7\x26\xbb\x21\x1b\x57\x3d\xa3\x3f\xef\xd4\
\x81\xfa\xc6\xcb\x07\x3d\xe5\x77\x46\xe2\x2c\x6e\xad\x16\xb9\x5c\
\xe3\xf7\xb6\xa6\x15\x6e\x79\x57\x24\x67\x0c\x93\x12\x07\x5f\xda\
\x66\xda\x87\x6b\xfe\xc6\x96\xb5\xff\x02\x08\x00\x77\x6b\xcb\x05\
\xfd\x19\xa0\xbe\xc0\xaf\x02\x86\x84\x82\xc1\xb1\x7b\xf2\x37\x61\
\xb5\xd9\xc9\xcc\x19\xdf\x25\x25\x5b\xde\x78\x81\x0f\x5f\x7b\x5e\
\x5f\x67\xef\xd5\x5c\x27\x2e\x07\x80\x7a\xa7\xdf\x06\xfc\x08\x71\
\x5d\x69\xd1\x36\xa9\xb9\xbe\x96\xe1\xe3\xaf\xbe\x28\xe3\xb2\x75\
\xdd\x4a\x36\xbe\xb2\x42\xd7\x73\x3f\xf0\x7a\x6f\x88\xbb\x7b\xe2\
\x38\xfd\xe7\x5a\x78\x75\x73\x55\xf9\x7e\x4b\xe5\xfe\x42\x46\x5c\
\x75\xcd\x05\x8d\x4b\xfe\x7b\xaf\xb2\xfe\xe5\xbf\xea\xe1\xe3\x0f\
\xb5\xd1\xcc\xe5\x0a\x10\xd4\xfd\x88\x8d\xc0\xbc\x86\xda\xaa\x98\
\xbd\x05\x1f\x31\x6c\xfc\x74\x9c\x31\x71\xdf\xf8\xe2\xf6\x8d\x6b\
\x79\xf7\x5f\x4f\xe8\xf0\x16\x03\x2f\xd1\x8b\xa4\x27\x2f\x74\x54\
\xa3\x6e\x17\xcc\x6c\x6f\x6d\x1e\xb4\xeb\x93\x77\x48\x1b\x3e\xfa\
\xac\x7b\x76\x3b\x3f\x7c\x8b\x75\x7f\x7f\x5c\x87\xf7\x08\xf0\x0f\
\x06\xe4\x1b\xe2\x00\xde\x04\x84\x24\x49\xe2\xd6\x45\x8f\x89\x27\
\xde\x2e\x16\x77\x2e\x79\x42\x48\xb2\x2c\x34\x78\x3f\x1d\xc0\x74\
\x61\x91\x80\x3f\x01\x0a\x20\x6c\x0e\x97\x0e\x4e\x00\xbf\x1a\xc0\
\x73\xf1\xb2\x50\xf3\xef\x74\x78\xcb\x06\x90\x74\x5d\xa6\x01\x8d\
\xda\x88\x1c\x90\x4b\x94\xa4\x01\x04\x97\x89\xfc\x0f\xa4\xe6\x12\
\x80\x81\x29\x02\xa3\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\
\x82\
\x00\x00\x08\x2e\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\x00\x00\x00\x00\x00\xf9\x43\xbb\x7f\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x01\x1e\
\x06\x1a\x2b\x3c\x92\x00\xc1\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x07\x89\
\x49\x44\x41\x54\x78\xda\xed\xdc\x7b\x94\x95\x55\x19\xc7\xf1\xcf\
\x19\x87\x51\x61\x80\x60\x20\x20\xd1\x44\x5d\xc2\x1f\x02\x41\x86\
\x8b\xc2\x34\x08\xc9\x5b\x65\x01\xc3\x1d\x87\x28\x1d\xad\x8c\x4c\
\x0b\x45\x90\x5a\xb6\x20\xa4\xcb\x12\x51\x31\xc1\x04\x5d\x24\xae\
\x4a\x96\x96\x22\x17\x4b\x20\x56\xe1\xb2\xb0\x65\x02\xba\xb8\x38\
\x2b\xf1\xc6\xc0\x8c\x82\x8e\xcc\x9c\xfe\x78\xf7\x1c\x66\x06\x38\
\x73\xce\x70\x9b\xcb\xfb\x5b\x6b\xaf\xd9\xef\x7b\xde\xbd\xdf\x33\
\xdf\xb3\xf7\x7e\x9f\xe7\xd9\x7b\xbf\xc4\x8a\x15\xab\x09\x2b\x71\
\x82\xef\xd7\x0a\xe7\x85\x74\x26\x3a\xa3\x00\xa7\xa2\x12\xaf\x61\
\x35\xfe\x15\xff\x34\x07\xd5\x03\xd3\xf0\x37\xec\x47\x32\x83\xb4\
\x09\xa3\x4e\xc2\x0f\xdc\xa8\x5a\x60\x57\xdc\x1d\x40\x9c\x52\x7d\
\xf2\xac\x33\x39\xeb\xd3\x74\x3f\x83\x2e\x5d\x68\xdf\x9e\x53\x72\
\xd9\xb3\x87\x92\x12\x96\x2f\xe7\xa3\x8f\x52\x75\xac\xc5\x04\x6c\
\x6b\x69\x00\xfb\xe0\xd9\x00\xd1\xd0\xa1\x0c\xff\x26\x03\x07\x46\
\xc0\xd2\xa9\xa2\x82\x25\x4b\xf8\xd5\xaf\x29\x2b\x03\x7b\x30\x1a\
\xcf\xb4\x14\x80\xf9\xa1\x0b\xf6\xe8\xd5\x8b\xf9\xf7\x72\xee\xb9\
\xf5\x17\x2a\x2d\xe5\xdd\x77\xc9\xc9\xa1\x7b\x77\x3e\xf8\x80\x1f\
\xde\xcc\x9a\x35\xe0\x63\x8c\xc5\xb2\x96\x30\xe6\xdd\x84\x64\xfb\
\xf6\x92\xff\x7d\x45\x72\xc7\xf6\xf4\xe9\x89\x65\x92\xfd\xfb\xd7\
\x1e\x03\x73\x73\x55\x5d\x79\x85\xe4\x9a\xd5\x92\x45\x45\xb5\x3e\
\x1b\x72\x98\xfb\xf5\x6e\x8a\x2d\x30\x1f\x5f\x40\xbb\x70\x7c\x4a\
\x78\x8a\xc2\xe3\x30\x7b\x36\xa3\x0a\xd3\x57\xb2\x72\x25\x93\xbf\
\x2d\x99\x4c\xa6\xbe\xc7\x8e\xf0\x54\xce\x87\xfc\x7c\x55\xf7\xcd\
\x97\x33\x7e\x42\xaa\xc8\x02\x5c\x57\xa7\x9a\x75\xb8\x1e\x2f\x37\
\x25\x80\xbd\x43\x37\x3d\xa2\x9e\x5b\xc1\xf9\xe7\x1f\xf9\xf3\xdd\
\xbb\xf9\xe2\x25\x92\xe5\xe5\x12\x78\x1a\x23\xc2\x53\x1a\x3e\x85\
\x3f\x62\x40\x8d\x22\x5b\xf1\x59\x94\xd7\xa9\x6a\x13\x3a\xe1\x22\
\xbc\x71\xa2\x01\xe6\x1e\x6d\x05\x97\x5d\x46\xab\x1a\xb5\x3c\xfd\
\xe7\xe8\x6f\x9b\x36\xe9\xcb\x3d\xbe\x8c\x00\x6f\x3b\xae\x0e\x5d\
\xb4\x5a\xff\xc3\x40\x3c\x87\xc1\xe1\xdc\xf0\xc3\xc0\xab\xd9\x85\
\x77\xe2\x93\x78\xa7\xc9\x00\xec\xd9\x93\x07\x17\xd4\x3e\xf7\xe1\
\x87\x5c\x75\x75\xfd\x00\x57\xaf\x4e\x65\x6f\xab\x03\xaf\x5a\x55\
\xf8\x3a\x5e\xc2\x43\x69\x5a\xfc\x4e\x9c\x15\xf2\x2b\x70\x29\xf6\
\x9e\x28\x80\x39\xc7\xba\xc2\xd3\x4e\x63\xd6\x2c\xf6\xed\x4b\x7f\
\xdd\x96\x2d\xa9\xec\x0b\x69\x2e\x2b\xc7\x30\xcc\x4a\x73\x4d\x4d\
\x58\x9f\xc1\x53\x68\xdd\x64\x01\xc2\x86\xbf\xa7\x6c\xb8\x23\xea\
\xc0\x81\x54\xf6\xfd\x7a\xaa\x7b\xfd\x08\x2d\xb4\x96\x1e\x5e\x14\
\x19\xe6\x18\x14\xcc\x9d\xbc\x46\x0f\x70\xef\xde\x43\xd3\x86\x0d\
\x91\x11\x5c\x9f\xda\xb6\x4d\x65\xcf\x39\x16\xff\x48\xb7\x6e\xfc\
\x7e\x29\x1d\x3b\x82\x2b\xf0\x48\x4d\x0f\xa8\x51\x02\xdc\xb5\x8b\
\x3e\x7d\x6b\xa7\xc2\x51\x51\xeb\xaa\x6f\x0c\xbc\xf0\xc2\x54\xf6\
\x27\x69\x2e\x1b\x83\x77\x71\x7f\x46\x4e\x77\x0f\x16\x3f\x42\x7e\
\xbe\x24\x0a\x31\xff\x78\xfb\xd3\x0d\x05\x58\x89\xd2\x90\xf6\xd4\
\xc8\x97\x56\x5f\xf0\xd6\xdb\xe9\x2b\x98\x54\x44\x22\xfa\xd7\x46\
\x60\x29\xce\x08\x1f\x75\xc0\x38\xfc\x03\x8f\x06\xbb\xf0\xba\x30\
\x16\xd6\xab\x0b\x2e\x60\xd1\x42\x89\x53\x4f\x95\xc4\x77\xea\x19\
\x3f\x4f\x1a\xc0\x57\xd0\x31\xa4\x0e\x35\xf2\x1d\x43\xd7\xb1\x70\
\x61\xfa\x0a\xfa\xf5\x63\xfa\xf4\xd4\x61\x21\x4a\xc2\x58\xb7\x1b\
\x8b\xf1\xb9\xf6\xed\x24\xc3\xb8\x06\x0f\xd4\x30\xdc\xd3\x6a\xc0\
\x00\x1e\xb8\x5f\x22\x37\x57\x12\xb7\xd6\xd3\xca\x8f\x4a\xc7\x63\
\x8c\x78\x1b\x93\xb6\x6e\x95\xe8\x54\x40\xdf\xbe\xe9\x21\x7e\x7e\
\x20\xbb\x4b\x79\xf3\xcd\xa8\xeb\xe7\xe5\x45\x65\x26\x7f\x8b\xb9\
\x73\x25\x0a\x3a\x45\x1e\x0b\x3e\x11\x6c\xbc\x0d\x75\xaa\x29\x46\
\x97\xf1\xe3\xe8\xd4\xa9\x76\x77\x3e\xa7\x87\xc4\x5f\x9e\x91\xc4\
\x97\xc3\xf7\xda\xd8\x54\xa2\x31\xd3\xf0\x33\x18\x32\x98\x3b\x67\
\x46\x61\xac\xfa\x54\x5e\x4e\x7e\x7e\xd4\xb5\xb7\x6f\x67\xda\x1d\
\xbc\x70\xd0\xc8\x59\x82\xc9\xf8\xe8\x30\x9e\x48\xef\x67\x9f\xa1\
\x57\xaf\x43\xeb\x7c\xec\x31\xa6\xde\x96\x1a\x76\x26\x86\x61\xa1\
\x51\xb7\x40\xa2\xe0\xe9\x1e\x7c\x69\xdb\x36\xb9\x8b\x16\xb1\x7e\
\x7d\x64\x1b\xe6\xe5\xd1\xa1\x43\x14\x75\xa9\xab\x56\xad\xd8\xb8\
\x91\x59\xb3\x99\x3a\x95\x9d\x3b\x41\x19\x6e\xc0\xf4\x1a\xfe\x76\
\xbd\x2d\x30\xe5\xa6\xf4\x8e\x6c\xd3\xb5\x6b\xe5\xe0\x2a\xfc\x1b\
\x5b\x1a\x7b\x0b\xac\xd6\x79\xb8\x23\xc4\xf3\x5a\x55\x9f\xcc\xcb\
\xa3\x6b\x57\x0a\x0a\x68\xd3\x9a\x8f\x0f\xb0\xef\x03\x5e\xfe\xcf\
\x21\x9e\xc8\xef\x70\x3b\xde\x4c\x73\x8f\xb4\x2d\xb0\x5a\xb3\x66\
\x73\xdf\x7d\x60\x5f\x00\xb9\xa6\x29\x00\xac\x56\xa7\xe0\xef\x0e\
\xc3\x85\xc1\xf6\x4b\xa4\x31\x9c\xff\x10\xdc\xb7\xcd\x19\xd4\x9d\
\x11\x40\xb8\x7d\x5a\x14\xac\x0d\xde\xcb\x50\xfc\xb3\xa9\x00\xac\
\xab\x76\xa2\xb9\x92\xce\xe1\xb8\x4d\xe8\xf2\xaf\x87\xa7\x71\x36\
\xca\x18\x60\x55\x15\x53\xa6\xf0\xa7\x27\x09\x0f\xa4\x4b\x83\x45\
\x71\xf2\xa2\x31\x0d\x54\x59\x18\x8b\x4e\xa8\x72\x72\x98\x33\x87\
\xf2\xf7\x59\xb5\x4a\x67\xd1\xb4\xc3\xc5\x21\x22\x74\x5c\x00\x7e\
\x25\xfc\x4a\x8d\x59\x59\x45\xa4\xf3\xf2\xb8\x77\x1e\xd7\x16\xb1\
\x61\x83\xee\x21\x64\x36\x08\x6f\x1d\x0f\x80\x97\xe0\xc7\x9a\x99\
\x4e\x3f\x3d\x0a\xc3\x8d\x1d\xc7\xa6\x4d\xce\x0b\x10\x2f\x6e\x48\
\x18\x2c\xa3\x2e\xdc\xae\x1d\x37\x14\x37\x6e\x28\x9d\x3b\x67\x39\
\x08\xb7\x8b\x22\x38\x85\x85\x6c\x7d\x4d\xef\xd0\x9d\x07\x87\xa7\
\xf4\xb1\x05\x58\x7c\x3d\xc5\xc5\x9a\x9d\x0a\x0a\x58\xbc\x98\xe1\
\x23\x28\x29\x71\x11\x9e\xc4\x95\xa8\x38\x21\xd1\x98\xe6\xa0\x6e\
\xdd\x78\x74\x09\x05\x05\x29\x97\x6f\x69\x36\x0e\x46\x8b\x07\x08\
\x67\x9f\xcd\x63\x8f\x4a\xb4\x6d\x2b\x89\x6b\x82\x0d\x9a\x88\x01\
\x66\xa1\x5e\xbd\x58\xfc\x48\x2a\x0c\x36\x11\x73\x63\x80\x59\xaa\
\x5f\x3f\x16\x3e\x94\x0a\x83\x4d\x09\x6e\x68\x0c\x30\x1b\x0d\x1a\
\xc4\xbc\x7b\x24\x42\xb0\xe3\xa7\xf8\x5e\x0c\x30\x4b\x5d\x7e\x39\
\xb3\x0f\xc6\xb1\x7f\x83\xf1\x31\xc0\x2c\x35\x72\x24\x33\xa6\xa7\
\xe2\x05\x0f\xe3\xab\x31\xc0\x2c\x35\x69\x12\x3f\xb8\x29\xc5\xe9\
\x09\x07\x57\x49\xc4\x00\x33\xd5\x94\x29\x5c\x3b\x11\x51\x3c\x73\
\x55\xdd\xd8\x40\x0c\x30\x03\x8d\x1a\x55\xeb\x70\x4c\x0c\x30\x0b\
\xed\xdc\xc9\xc4\x89\xa9\x95\x11\xcb\x45\x53\x08\x31\xc0\x4c\xf4\
\xce\x3b\x8c\x1b\xcf\x5b\x6f\x4b\x88\x76\x0f\x8c\x54\x67\x5e\x26\
\x06\x78\x04\x95\x95\x31\x66\x2c\x3b\x76\x20\x9a\xe4\xff\x86\x43\
\x67\x04\x63\x80\x87\xd3\xfe\xfd\x14\x15\xa5\x56\x90\xbd\x2a\x9a\
\x84\xda\x1b\x9b\x31\x19\xa8\xa2\x82\xeb\x8b\xd9\xf8\x22\xa2\x15\
\xaf\x43\xa5\x59\xb4\x19\x03\xac\xa1\xca\x4a\x6e\xfe\x11\xcf\x3f\
\x1f\x0d\x81\xc1\xee\x2b\x89\x5d\xb9\x0c\x35\x7d\x46\xb4\xd1\x27\
\x74\xd7\x61\xa2\xad\x67\x71\x30\x21\x13\xcd\xfe\x45\x6a\xce\x78\
\x1f\xbe\x26\x5a\x5a\x2c\x06\x98\x81\x16\x2c\x60\xfe\x7c\x44\x1b\
\x7a\x46\xe3\xaf\x99\x96\x6d\xf1\x00\x97\x2d\xe3\xae\x9f\x23\x5a\
\x5a\x57\x14\x8c\xe5\x8c\x95\xd1\xa4\xd2\xda\xb5\xf4\xe9\xd3\x78\
\x21\xb4\x6e\x4d\xff\xfe\xd9\x97\x5b\xb1\x82\x5b\x0f\x4e\xda\x7e\
\x5f\x03\x56\x6e\x65\x04\x70\xdd\xfa\x28\x35\x56\xf5\xec\xc9\x8a\
\x67\xb3\x2b\xb3\x6e\x3d\xc5\x37\x48\x56\x55\x49\xe0\x4e\xcc\x6b\
\xc8\xbd\xeb\x03\xf8\x1a\x56\x36\xe2\x1e\xd8\x1b\x5d\xb2\x2d\xf4\
\xd2\x4b\x4c\x9e\x2c\x79\xe0\x80\x04\xee\xc1\xcc\x86\x7e\x81\x46\
\xbf\xa1\x39\x03\x80\x9b\xb2\x69\x81\x9b\x37\x53\x38\x4a\xb2\xb4\
\x54\x22\x74\xd9\xf1\x32\xd8\x46\x11\x3f\x44\xf0\xc6\x1b\x4c\x98\
\x48\x80\xb7\x5c\x34\xfb\x96\x3c\x9a\x3a\x5b\x0c\xc0\xf7\xde\x8b\
\xd6\xc2\xec\xda\x85\x68\x71\xe5\x68\x87\x5f\xf1\x1a\x03\xac\x27\
\xb2\xf2\xa2\x68\xf2\x7c\xdf\xb1\xa8\xbb\xd9\x03\xdc\xbf\x9f\xa2\
\x49\xbc\xfa\x2a\xa2\xb5\xd1\x97\x3b\x86\x9b\x11\x9b\x35\xc0\x8a\
\x0a\x6e\xbc\x31\x5a\xb8\x1e\x82\x02\x43\x1c\xe3\xed\xb0\xcd\x16\
\x60\x65\x25\xb7\xdc\xc2\xaa\xd5\xa9\xc8\xca\x10\xd9\x2f\x1f\x6e\
\xb9\x00\xa7\xcf\x48\xad\x85\x2e\x13\x6d\x3e\xdc\x72\x3c\xee\xd3\
\x2c\x01\xce\xb9\xbb\x56\x64\xe5\x1a\xc7\x61\x87\x52\xb3\x05\xb8\
\x70\x21\xf3\x22\xa7\xac\x32\x98\x2a\xab\xc5\x4a\xeb\x89\x24\x7b\
\xf6\x8c\x5e\xa1\xf2\xcb\xb9\xa9\xd7\xa3\x54\x89\xde\x33\x13\x2b\
\x53\x80\xbf\x7d\x50\x32\x27\x27\x05\xf0\xbb\x31\x9a\x2c\x00\x0a\
\x2f\xeb\x09\xf9\x99\x31\x96\x06\x00\x0c\x69\x5e\x8c\xa4\xe1\x00\
\x97\x68\xfa\xd1\xa5\x93\x06\x70\xb9\x1a\xbb\x41\x63\x65\x07\xf0\
\x29\x27\xe8\x15\x27\xcd\x51\xed\x63\x78\xb1\x62\xc5\x8a\x15\x2b\
\x56\xac\x58\xb1\x62\x35\x41\xfd\x1f\x00\x1a\x38\xfd\x7f\xab\xc1\
\x34\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x0c\x78\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\x00\x00\x00\x00\x00\xf9\x43\xbb\x7f\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x01\x1e\
\x04\x07\x24\x50\xc5\xa5\x22\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x0b\xd3\
\x49\x44\x41\x54\x78\xda\xed\x9c\x79\x74\x53\x55\x1e\xc7\x3f\x2f\
\x7b\xd3\xb4\x69\x1b\xda\x42\x2d\x94\xd2\x85\x45\x2c\x8b\x30\x14\
\x10\x41\x40\x59\x64\x14\x14\x50\xc1\x2a\x0e\xe8\xa8\x07\x90\x03\
\x47\x47\xf1\xa0\x47\x07\x18\x1d\xc4\x91\x71\x45\x1c\x54\x70\x01\
\x54\x14\x45\x04\x1c\x45\x18\x40\xa0\x2c\x02\xb2\x48\x59\xda\x02\
\xa5\x69\x9b\xb4\xa1\x69\xda\xac\x6f\xfe\xc8\x4b\x49\xa1\xb5\xb4\
\x09\xb4\xd2\x7c\xcf\xe9\xe9\xcd\xbd\xc9\xcb\x7b\x9f\xdc\x77\x7f\
\xcb\xfd\x25\x10\x52\x48\x21\x85\x14\x52\x48\x21\x35\x8d\x84\x6b\
\xe0\x1a\xe4\x40\x4f\xe0\x63\x10\xca\x81\x0a\x10\x2d\x80\x19\x38\
\x0d\x9c\x04\x8e\x02\xfb\xbd\x63\x21\x5d\xac\x1b\x00\xf1\x32\xfe\
\x9c\x08\xb2\xfd\xc0\x42\x60\x90\x04\x3e\x34\x03\x25\x80\x07\x00\
\x22\xbb\xde\x06\x82\x0c\x10\x11\x64\x0a\x00\x3c\xce\x2a\x1c\xa6\
\x7c\xec\xc5\xa7\xc0\xe3\xba\x70\xe1\xaa\x30\xab\x5c\xa5\xfd\xd0\
\x65\x35\x2d\x00\xf2\x42\x00\xeb\x92\x4c\x81\x26\x3e\x15\x4d\xeb\
\x74\x90\x2b\x10\x04\x19\xd6\x9c\xed\x38\xcb\x0a\x24\x02\x82\x47\
\x11\x1e\xf3\x85\xcb\x6a\x7a\x02\x38\xd7\xa2\x01\x1a\xfa\x65\xe1\
\x71\x56\xe2\xaa\x28\xc5\x55\x5e\x8c\xb3\xac\x00\x57\x79\x49\xcd\
\x0b\x96\x2b\xd0\xa5\x0f\x40\x1d\xd7\x01\x87\xe9\x34\xe7\x7f\xdd\
\x28\x81\x96\x57\xe1\x71\xcf\x04\xde\x91\x6e\xf9\x96\x05\x50\x1d\
\x9f\x46\xea\xf4\x2f\x2e\x19\xf4\x38\x6c\x54\x9e\x3d\x8c\x2d\x77\
\x2f\xd6\x9c\xed\xd8\xf2\xf6\x56\x8f\xa9\x62\x93\xd1\x67\x8c\xa4\
\x32\xff\x17\xac\x39\xdb\x7c\xdd\x5f\x01\x59\x80\x35\x04\xb0\x16\
\xb9\xac\x26\x4a\x77\x7f\x89\x79\xc7\xa7\xb8\xca\x8b\x01\xd0\x26\
\xf5\x24\xa2\xcb\x60\x8a\x36\xbe\x86\xe8\x76\x01\xec\x01\x86\x00\
\x96\xfa\x8e\x27\x6b\xc2\x0b\x57\x35\xc5\x9b\x2a\x74\x06\x62\x07\
\x4d\x21\xfd\xc9\xf5\xb4\x1e\xf5\x0c\x32\x75\x38\xb6\xbc\xbd\x94\
\x6c\x7e\x8f\xd6\xb7\x3f\x8d\x3c\x3c\x06\xe0\x46\x60\x03\xa0\x6e\
\xae\x00\x63\x80\x77\x9b\xd4\x01\x96\x2b\x31\xf4\xbd\x8f\xb4\x99\
\x6b\xd1\xa5\xdf\x84\xdb\x56\x46\xe1\xb7\x2f\x11\x3b\xf8\xaf\xc8\
\xb5\x51\x00\x7d\x80\x05\xcd\x11\xa0\x01\xd8\x24\x39\xbf\x4d\x2e\
\x85\xce\x40\xbb\xac\x37\x88\xee\x75\x37\xa2\xdb\x45\xd1\x86\x45\
\xc4\x8f\x98\x05\x32\x39\xc0\x54\xe0\x96\xe6\x04\x30\x16\xc8\x05\
\x32\xa4\xb5\x2b\x78\x12\x3d\xee\x46\xcf\x46\x99\x8c\x84\x31\xcf\
\xa3\xcf\x18\x89\xc7\x61\xc3\xb4\x75\x19\x31\x99\xf7\xf9\x6c\xc4\
\xdf\x9b\x0b\xc0\x78\xe0\x27\x40\x27\x3d\x2e\x09\x32\x3f\x77\xa0\
\xc7\x48\x18\xf3\x3c\x32\x55\x18\x76\x63\x0e\xea\x56\x49\xbe\xee\
\xfe\x40\x72\x53\x03\x4c\x90\xe0\x75\xf1\xeb\x3b\x17\xdc\x19\x28\
\x7a\x02\x3d\x84\x4c\x15\x46\xdc\xb0\x19\x00\x58\x0e\xac\x47\x9f\
\x31\xc2\x37\x34\xa6\x29\x01\xb6\x05\x36\x03\x9d\xda\xb4\xef\x48\
\xd6\xec\x7f\xfb\xfa\x83\x1b\xd8\x0b\x42\x50\xae\x25\xaa\xc7\x9d\
\x00\xd8\x72\xf7\xa0\x8e\xeb\xe0\xeb\xee\xd5\x54\x00\xdb\x4b\xf0\
\x52\x13\x52\xba\x30\xf9\xc5\xf7\x08\x0b\x8f\xac\x76\xc9\x82\xcc\
\x2f\x28\xd7\x22\x57\x6b\x51\xe8\x0c\xde\x49\xed\x76\xfa\xba\xef\
\x03\xe2\xae\x36\xc0\x14\x09\x5e\x72\xdb\xf4\x0c\xa6\xbc\xb0\x04\
\x6d\x84\xbe\x86\x01\x6c\x8e\x33\xd0\x4b\x51\x21\xad\x0a\x35\x22\
\xba\xc9\x57\x13\x60\x47\x09\x5e\xbb\xa4\xce\x3d\x78\xe8\xf9\x77\
\xd0\x84\x47\x5c\x12\x14\x04\x19\x60\x50\xa2\x2a\xd1\xe3\xc1\x65\
\x31\x02\xe0\xae\x28\xf5\x1f\xba\xf7\x6a\x01\xec\x2c\x19\x8c\xeb\
\x92\xaf\xef\xc5\x43\xcf\xbd\x8d\x46\xab\xbb\xf2\x2b\xad\xc7\xe3\
\x0e\xc6\x61\x2a\x4e\x65\x03\xa0\x8c\x4e\xc4\x5d\x79\xde\x7f\x28\
\x03\x48\xbd\xd2\x00\x33\x24\x78\xad\x53\xbb\x65\xf2\xe0\x9c\x37\
\x51\x69\xb4\x57\xc5\xcc\x8b\x62\xe0\x00\x45\x51\xa4\xf0\xdb\x7f\
\x02\xa0\x4b\xe9\xc3\xf9\x5f\x37\x22\x08\x02\x89\x69\x5d\x7d\x4f\
\xb9\xf5\x4a\x02\xec\x01\xfc\x08\xc4\xa5\xf5\xe8\x4f\xd6\xec\xd7\
\x51\xa9\xc3\x2e\x0d\xe6\x9d\x0e\x5f\xd3\x1e\x64\x47\x3a\x60\x37\
\xa6\x64\xcb\x52\xec\xc6\x1c\x64\x6a\x1d\xee\xaa\x72\x00\xd2\x7a\
\xf4\xa7\xe7\x2d\x77\xf8\x9e\xd2\xef\x92\x48\x26\x48\xa7\xdf\x5b\
\x0a\xbe\xa3\x3b\xf5\x1e\xc4\x84\x27\x17\xa2\x50\x2a\x6b\xcf\x86\
\x5c\x00\x58\xd5\x9c\x66\xa0\x79\xc7\x0a\x8a\x36\x2e\x02\x20\xfa\
\x4f\x63\x31\xfd\xef\x03\xef\x94\x9b\x30\x15\x99\xac\x3a\xfb\x9f\
\x79\x25\x00\xf6\x03\xd6\x01\xfa\xeb\x33\x87\x72\xcf\xcc\x97\xeb\
\x84\xd7\x1c\xd7\x40\x8f\xa3\x92\xc2\x75\x0b\x28\xcd\xfe\xdc\x9b\
\xe5\xc8\xbc\x97\xd2\x5d\xde\xf6\x80\xd1\x93\xb8\x2e\xa5\x0b\x6e\
\x97\xd3\xdf\xb3\xd0\xe1\x97\x2b\x0c\x14\xe0\x00\x09\x9e\x2e\xe3\
\xa6\xe1\x8c\x9b\x31\x1f\xb9\x5c\x41\xd3\x48\x14\x1b\xba\xde\x59\
\x0e\xac\xa3\x68\xc3\x22\x9c\x96\x42\x04\xb9\x92\x98\x3e\xf7\x52\
\xb6\x6f\x8d\xe8\xb1\x5b\x85\x0e\x5d\x7b\x8b\xb7\x4e\x98\x26\x78\
\xbd\x1a\x25\x86\x84\x24\x4c\x05\x79\x82\x04\x71\x7f\x30\x00\x0e\
\x01\xbe\x06\xb4\xdd\x07\x8e\x62\xec\xb4\xbf\x23\x93\xcb\x69\x32\
\x09\xb2\xcb\x7a\x73\x97\xcd\x82\xe5\x97\xb5\x98\x77\xae\xc4\x51\
\x92\x0b\x80\x3a\x3e\x0d\x5d\x6a\x5f\xcc\x3b\x57\x78\x44\x97\x43\
\xd6\xae\x63\x37\xee\x7f\x66\x91\xe0\x7f\x27\xb5\x6a\xd3\x0e\x53\
\x41\x1e\x40\x52\x30\x00\x0e\x03\xbe\x04\xc2\x7a\x0d\x19\xc3\xe8\
\xc7\x9e\x6b\x0c\xbc\xdb\xa5\xb5\xf3\x28\x50\x1e\x04\x80\xb2\xba\
\x6c\x8b\xbd\xf8\x04\x15\x27\xb3\x29\x3f\xfc\x23\xb6\xbc\x7d\xd5\
\x11\x86\x32\xaa\x0d\xfa\x8c\x11\x54\x19\x8f\x8b\xa6\x6d\xcb\x04\
\x40\x76\x43\xff\xdb\xb8\x7b\xea\x8b\x97\x78\x0f\x11\xd1\xb1\xbe\
\x66\xbb\x40\xd7\xc0\x91\xc0\x6a\x40\xdd\x67\xf8\x78\xee\x78\xe4\
\xd9\x40\x7c\xd8\x5d\xd2\xff\x22\xe0\x94\x94\xea\x2a\x00\xf2\x01\
\x23\x50\x08\x98\x24\xc0\x65\x40\x65\x2d\xc6\x47\x03\xe0\xb2\x9c\
\xd3\xda\xf2\xf7\xe3\xb4\x18\x71\x9e\x2f\xc4\x6e\x3c\x81\xbd\xf8\
\x14\x55\xe7\x8e\x22\x3a\xab\xfc\x41\x13\x9e\xda\x17\x6d\x52\x4f\
\x1c\xe6\xd3\x9e\x92\x2d\x4b\x05\x40\x50\x69\xc2\xc4\xe1\x0f\xcc\
\x14\xfa\x0c\x1f\x5f\xeb\xf5\x44\x1a\xaa\x23\x39\x43\x20\x00\x47\
\x03\x2b\x01\x55\xdf\x91\xf7\x31\x6a\xca\xd3\x0d\x86\xa7\xd6\x86\
\x5f\x68\xc7\xa7\xe1\x30\xe5\x21\xba\x1c\x71\x52\xac\xd9\xa7\xd1\
\x2b\xa0\xdb\x25\x9c\x5a\x9c\x55\xeb\x98\x42\x1f\x4f\x78\xfb\x5e\
\x68\x12\x3a\x21\xba\x5d\x94\x1f\xd9\x54\x55\xfc\xc3\x9b\x1a\x40\
\x26\x08\x02\x19\x03\x46\x30\x2c\x6b\x86\x10\xd5\xaa\x75\x9d\xc7\
\x57\x28\xd5\x35\x3e\xb0\xc6\x00\x1c\x0b\x7c\x02\x28\x6f\xba\xe3\
\x01\x46\x4c\x9a\xd5\xa8\x99\x27\x97\x5d\x78\x4b\xb9\x36\x8a\xe8\
\xe4\x5e\xc8\x34\x11\x08\x72\x05\x82\x5c\x09\x1e\x37\x2e\x6b\x09\
\x2e\xab\x19\x97\xd5\x84\xdb\x66\xc1\x5d\x69\x71\x7b\xec\x15\x1e\
\x8f\xcb\x2e\xc3\xe3\xae\xb1\x56\x08\x72\x25\x32\x75\xb8\x28\xd7\
\x44\x08\xf2\xf0\x68\x14\x3a\x03\xca\xa8\x36\xa8\x62\x12\x91\xa9\
\x75\x20\x7a\x70\x98\x4f\x63\x3d\xfe\xb3\x68\x39\xb0\x0e\x44\x51\
\x00\x34\x0a\x95\x9a\xee\x03\x46\x72\xd3\xe8\x49\xc4\x25\x26\xd7\
\xff\xc1\x87\x55\xdf\xd2\x91\x8d\x01\x38\x01\x58\x06\xc8\x07\xde\
\x3d\x99\x61\xf7\x3f\xd1\xe8\xa5\x4a\x1f\x7b\xe1\x53\xb6\x9d\xca\
\xc6\x26\x85\x4e\xfe\xb7\x98\x32\xaa\x0d\xca\xc8\x78\x14\x91\xb1\
\x68\xe2\xd3\x90\x6b\xf5\x72\x59\x58\x84\x5c\xa6\xd4\x22\xd7\x84\
\x23\x8a\x1e\x04\x99\x52\x72\x43\x6c\x78\x9c\x95\x82\xdb\x66\xc1\
\x5d\x61\xc6\x69\x31\x62\xcb\xdd\xe3\x29\xdd\xbd\x5a\x14\x9d\x55\
\xf2\x1a\xac\x15\x0a\x92\xbb\xf6\xa6\x6b\xdf\x5b\xc9\xe8\x3f\xac\
\xb6\xf8\xbc\x6e\x77\xc7\x5d\x1d\xba\x0b\x0d\x05\xf8\x20\xf0\x1f\
\x40\x3e\xf8\x9e\x47\x19\x7a\xef\xe3\x01\xad\xf5\x7a\x43\x3c\xf3\
\xbf\x3c\x80\xc5\x64\xa4\x30\xf7\x18\xc6\xfc\xe3\x94\x9c\xcd\xc5\
\x54\x98\x4f\xf1\xd9\x5c\xac\x65\x26\x9c\xa5\x67\x71\x96\x9e\x0d\
\x28\x37\x0a\x10\xa6\x8b\x24\x21\xb9\x33\x89\xe9\x5d\x49\xea\xd8\
\x9d\xe4\xae\xbd\xfd\x67\x52\x03\xdd\x4c\x4f\xad\x49\x90\xfa\x00\
\x3e\x0c\x2c\x06\x84\xdb\x26\x4e\x67\xd0\xd8\x29\x41\xf3\x3a\xf4\
\x86\x78\xf4\x86\x78\x3a\xde\x38\xa0\x46\xbf\xd3\x5e\x45\x69\x51\
\x01\x56\x8b\x99\xf3\x66\x23\x15\x16\x33\xb6\x72\x0b\xf6\x4a\x1b\
\x4e\x47\x15\x55\x15\xe5\x35\xd2\x4c\x4a\xb5\x06\x95\x3a\x0c\x6d\
\x84\x1e\x6d\x84\x1e\x9d\xde\x40\x74\xfc\x75\xc4\xb4\x6e\x8b\x4e\
\x1f\x13\xb4\xf3\xb5\x57\x56\xe7\x7f\x4b\x2f\x17\xe0\xe3\xc0\x1b\
\x80\x30\xe2\xc1\x99\x0c\x18\x3d\xe9\xaa\xb8\x73\x4a\xb5\x86\xb8\
\xb6\x1d\x88\x6b\xdb\x81\xe6\xa4\x0a\x4b\x35\xb7\xe2\xcb\x01\x38\
\x03\x78\x15\x10\x46\x4d\xfe\x1b\xfd\x46\x4d\xa4\xa5\xab\xac\xa4\
\x7a\x0b\xc7\x58\x1f\xc0\xa7\x80\x97\x01\xee\x7c\x74\x0e\x7d\x86\
\x8d\x23\x24\x30\x15\xe4\xfb\x9a\x27\x7f\x0f\xe0\x1c\xe0\x45\x41\
\x26\x63\xf4\x63\xcf\xd1\x7b\xe8\x5d\x21\x72\x80\xc3\x5e\x89\xb9\
\xf0\xb4\xcf\x80\x1c\xa9\x0b\xe0\x5c\xe0\x59\x80\xb1\xd3\xe6\xd2\
\x63\xd0\xa8\x10\x39\x49\x67\x8f\x1f\xf2\x25\x7b\xf6\x03\xb6\xda\
\x12\xaa\x71\x78\xcb\x18\x50\x6b\x75\x21\x78\x17\xe9\xf8\xfe\x1d\
\xbe\x66\x76\xad\xfe\x92\x14\x8b\x8e\x00\x5c\x76\x9b\x95\x1d\xdf\
\xad\x0c\x51\xf3\xd3\xe1\x9d\x9b\x7c\xcd\x0d\x75\x01\x04\xf8\x19\
\x98\x04\x88\xdf\x2c\x99\xef\x4f\xbd\x45\xab\x30\xef\x18\xc6\xfc\
\x1c\xa4\x64\xc6\xef\x02\x04\xf8\x18\x98\x2f\x8a\x22\x1f\xbd\x34\
\x83\xa2\x33\xa7\x5a\x3c\xc0\x6d\xdf\x7c\xe4\xcf\xa6\xb2\x3e\x80\
\x3e\x4b\xbc\xda\x51\x65\x63\xd9\xbc\xa9\x58\x2d\xe6\x16\xec\xfb\
\x15\xb2\xef\xa7\xb5\xbe\x87\x8b\xeb\x8c\x19\x2f\xce\x0c\xe1\xad\
\x11\xde\x6d\x2e\x3c\xcd\x8a\x57\x9e\xc4\xe5\x74\xb6\x48\x80\x5f\
\xbd\xfd\xa2\x2f\x89\xf0\x15\x70\xb0\xd6\xec\x52\x1d\xaf\x75\x02\
\xdf\x01\xe3\x4b\x8b\x0a\x22\xad\x65\x26\x3a\xf7\x1e\xd4\xa2\xe0\
\x6d\xfa\x7c\x09\xd9\x1b\x3f\x07\xef\x06\xd2\x9f\xa9\xa3\x5e\xfa\
\xf7\xf2\xf0\xe7\x81\x2d\xc0\xfd\x05\x27\x8f\x28\x55\x9a\x30\x92\
\x3a\x75\x6f\x11\xf0\x76\x6e\xf8\x8c\x75\xef\x2f\x00\x70\x03\xf7\
\x70\x21\x73\xde\x20\x80\xe0\xad\xe1\x3b\x06\x8c\x3b\x71\x70\xa7\
\x90\x90\xdc\x91\xd8\xeb\x92\xaf\x6d\x78\xeb\x57\xb1\x66\xf1\x5c\
\xdf\x52\x36\x55\x32\x1e\x34\x16\x20\xc0\x61\xc0\x81\x28\x0e\x39\
\xba\x7b\xb3\xd8\xa9\xf7\x40\x41\x17\x65\xb8\xe6\xc0\x89\xa2\xc8\
\x7f\x3f\x7d\x93\xf5\xcb\xfe\xe5\x83\x37\x13\x6f\x36\x8a\x40\x01\
\x02\x6c\x03\x52\xdd\x2e\x57\xc6\xd1\xdd\x5b\xe8\x3e\xf0\x76\x54\
\x9a\xb0\x6b\x06\x9e\xbd\xd2\xc6\xaa\xd7\x66\xb3\x6b\xc3\x2a\xdf\
\x6d\x3b\xf5\x72\xe0\x41\xc3\xbe\x68\xa3\xc6\x5b\x38\x94\x99\x98\
\x76\x03\x8f\xcc\xfb\xa0\x69\x2a\x10\x82\xac\x82\x93\x47\xf8\x64\
\xc1\x2c\xcc\x85\x67\x7c\xeb\x7e\x16\xde\xfd\x6e\x82\x0d\x10\xbc\
\x55\xf6\xd9\x40\x52\xb7\x9b\x47\x32\x7e\xc6\x3f\x82\x55\x96\x77\
\xd5\x55\x59\x71\x9e\x4d\xab\xde\x65\xeb\xd7\xcb\x7c\x5d\x87\x80\
\xbb\xa4\x35\xff\xb2\xd5\xd0\xdd\x70\x1b\xf0\x03\x30\xd1\x98\x97\
\xa3\x96\x2b\x94\x24\x77\xb9\xf1\x0f\x05\xce\x51\x65\x63\xeb\x37\
\xcb\xf9\xf8\xe5\x99\x9c\xfa\x35\x1b\xc0\x03\xbc\x2e\x59\x5b\x63\
\x43\x8f\xd7\x98\x5a\x8c\x22\xc9\xb0\x8c\x3f\x79\x70\x97\x2c\xae\
\x5d\x0a\xf1\x6d\x53\x1a\x74\x80\x1d\xdf\xad\x40\x14\x3d\x44\x44\
\xb5\x22\x48\xa5\xcd\xf5\xca\x74\xee\x34\x5b\x56\x2f\xe5\xd3\x85\
\x4f\x72\x6c\xcf\x56\xdc\xde\x2a\xb1\x9f\x80\xbb\x81\xf7\x69\x64\
\xc5\x6c\x20\xf7\xdf\x2c\xe0\x15\xa5\x4a\xc3\xc3\x73\x97\xfa\x17\
\x21\xd6\xab\xb9\x0f\xdc\x8c\xad\xbc\x0c\xa5\x4a\x43\x4a\xb7\x4c\
\xda\xa5\x67\x90\x98\xde\x95\xc4\x94\xeb\x1b\xb4\xd5\x58\x9f\x55\
\x3d\x97\xfb\x1b\xc7\xf6\x6e\xe3\xd0\xcf\xdf\x73\xf6\xc4\x61\xff\
\xe1\xed\xc0\x3c\xbc\x85\x51\x01\x29\xd0\x05\x6c\x09\x30\x25\xd2\
\x10\xcf\x63\x2f\x2d\x47\xff\x3b\x3b\xfb\xfe\x9a\x3d\x26\xa3\xce\
\xb1\xa8\xd8\x36\xb4\x6e\xdf\x91\x56\x6d\xda\x11\xd3\x3a\x11\xbd\
\x21\x9e\xa8\xd8\x04\x34\xe1\x11\x68\xb4\x3a\xc2\x74\x17\xf6\xb5\
\x3d\x6e\x37\xf6\xca\x0a\xca\xcb\x4c\x58\xcb\x4a\x30\x17\x9e\xa1\
\xe8\xcc\x49\x8c\xf9\xc7\xc9\x3b\xb2\x0f\x47\x55\x8d\xdc\x67\x05\
\xf0\x99\x74\xce\xdb\x83\x35\xb3\x03\x05\xa8\x92\x42\xbe\xc1\x09\
\x29\x5d\x78\x64\xde\xfb\xb5\x56\xa5\x5e\xac\x17\x26\xf6\xc3\x6e\
\xb3\x82\xb7\x24\xb8\x1b\xde\xc2\xc5\x5e\x52\x5b\x13\xc4\x3b\xf7\
\x34\xb0\x51\x3a\xc7\xef\xb8\x28\x9b\xdc\x1c\x00\x02\xb4\xc2\x9b\
\x4b\x4c\xbd\x3e\x73\x28\x13\x9e\x5a\x58\xaf\x65\xf6\x03\x18\x75\
\x51\x8c\xa9\xc0\x5b\xe1\xdf\x05\x6f\x41\x77\x32\xde\x72\xb2\x04\
\x40\x8f\xb7\xac\x42\x7f\x51\xe2\xa3\x0c\xef\x56\xa3\x11\x6f\x51\
\x52\x0e\xde\x6f\xb0\xef\x96\x00\x5e\x51\x05\xcb\x07\x49\x97\xe2\
\x45\xfd\xc0\xbb\xfe\xc2\xb0\xac\x19\x8d\x05\xf8\x87\x53\xb0\x4c\
\xe0\x31\xc9\x87\x72\x6f\x5e\xbd\x94\x5f\x36\x7f\xdb\x62\xb2\x36\
\xc1\xf4\x21\x7e\x04\xa6\x01\x7c\xf1\xc6\x1c\xf2\x7f\xdb\x1f\x02\
\xd8\x08\xbd\x0d\xbc\xe5\x76\xb9\x58\x3e\x7f\x3a\x65\xc5\xe7\x42\
\x00\x1b\xa1\xe9\xc0\xf7\x15\xe7\x4b\xf9\x70\xee\x54\xff\xa2\x9c\
\x10\xc0\xcb\x94\x1b\x18\x07\x1c\x32\xe6\xe7\xb0\xf2\xd5\xa7\x09\
\xc2\x77\xa1\x5b\x14\x40\x24\xcb\x3a\x1a\x28\x3e\xba\x7b\x33\xeb\
\x97\xbf\x16\x02\xd8\x08\x1d\x97\x02\x74\xe7\xd6\x35\x1f\x92\xfd\
\xfd\x17\x21\x80\x8d\xd0\x26\xe0\x51\x80\xaf\xdf\x9d\xc7\x89\x83\
\xbb\x08\xa9\x71\x7a\x09\x10\xc3\x23\xa3\xc5\x59\x6f\xad\x15\xd5\
\x5a\x9d\xef\x27\xe9\xf4\x21\x34\x97\x27\x39\xb0\x06\x10\x5b\x25\
\xb4\xf7\xff\x4d\xbf\x10\xc0\x06\x48\x27\xc5\xa8\x21\x80\x01\x28\
\x51\x0a\xfc\x7d\x00\xa3\x42\x48\x1a\xae\xcc\xd0\x0c\x0c\x5c\x0f\
\x87\x00\x06\xae\xe5\x21\x80\x81\x1b\x15\x55\x08\x43\x48\x21\x05\
\xa2\xff\x03\xe2\xf8\x22\x43\x04\x4e\x0c\x50\x00\x00\x00\x00\x49\
\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x0c\x44\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\xff\x00\xff\x00\xff\xa0\xbd\xa7\x93\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x02\x0b\
\x0c\x31\x19\xaf\xc5\xf4\x83\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x0b\x9f\
\x49\x44\x41\x54\x78\xda\xed\x9c\x69\x50\x54\x57\x16\xc7\x7f\x0f\
\x9a\x6e\x1a\x64\x15\x9a\x45\x6c\x09\x0a\x91\xc5\x46\x81\x44\x34\
\xb8\x24\x48\x50\x94\xc8\x62\x20\x98\x60\x62\xcc\x62\x9c\x99\xaa\
\x4c\x26\x55\xb3\x7c\xc8\x54\x66\x6a\x2a\x53\x93\x54\xcd\x64\x3e\
\x4c\x92\x4a\x46\xc7\x98\xc5\xc8\xa0\x88\x5b\x8c\x93\x68\x74\x50\
\xc7\x8c\x8e\x28\x08\x82\x2b\x8b\xa0\x80\xb8\x42\xd3\x74\xf3\xe6\
\x43\xf7\x83\x96\xb0\x74\xd3\xdd\x2c\xca\xbf\xaa\xab\xde\xed\xf7\
\xde\x7d\xf7\xfd\xdf\xbd\xe7\xdc\x73\xee\x39\x17\xc6\x31\x8e\x71\
\x8c\x63\x1c\xe3\x18\x22\x84\x51\xdc\x36\x19\xa0\x37\x1d\xab\x4d\
\xe5\xfe\xd0\x01\xb4\x99\x95\x75\xc0\xdd\xfb\x89\xc0\x09\xc0\x01\
\xc0\x15\xf0\x36\xbd\x30\x80\x3b\x20\x37\xbb\xce\xa3\x17\x51\x52\
\xfb\x2e\x9b\x48\xb4\x06\x22\x70\x11\x48\x01\x2e\x38\xf2\x2b\x0f\
\x07\x92\x81\x78\x5b\x2b\x71\x12\x04\xbc\xbc\xbc\x7e\xf4\xbf\x5e\
\xaf\xa7\x53\xaf\xef\x2e\x1b\x0c\x06\x3a\x3b\x3b\x05\x20\x0c\x48\
\x05\x3e\x18\xcb\x3d\x50\x09\x54\x02\xea\x88\xa9\x53\x49\x4b\x49\
\xe9\x3e\xe1\xe2\xe2\x82\xcc\xd9\xb9\xbb\x2c\x57\x28\x70\x76\x72\
\xe2\xad\x77\xde\xe9\xb3\x07\xbe\xb1\x6e\x9d\xe8\xed\xe5\x65\x51\
\x9b\x0f\x1d\x3d\xca\xbe\xfd\xfb\x01\xf6\x02\x8b\xc7\x6a\x0f\x74\
\x06\xbe\x02\xd4\x3e\xde\xde\x3c\x9d\x91\x81\x42\x2e\x1f\x96\x0f\
\x3e\x6b\xc6\x0c\xbe\xfb\xfe\x7b\xd1\xd0\xd5\x95\x0a\x24\x01\xff\
\x76\xc4\x0b\x3a\x39\x90\x3c\x57\x60\x3b\x90\xee\xa6\x54\xb2\x32\
\x3b\xdb\x16\xf2\x44\xab\x85\xae\xbb\x3b\x73\x67\xcf\x96\x08\xdf\
\x68\x92\xaf\x63\x86\x40\x5f\xe0\x5b\x60\xa9\xab\x42\x21\xe6\xe7\
\xe6\x12\xa0\x52\xd9\x52\xdf\x2d\x80\x8e\x8e\x0e\xab\x6e\x7a\x3c\
\x29\x09\x95\x9f\x1f\x26\x59\xf8\x0f\x47\x88\x2c\x47\x10\x18\x0e\
\x1c\x06\xe6\x7a\x7a\x78\xf0\x52\x7e\xbe\x30\x29\x28\xc8\xba\x71\
\x2a\x08\xe6\x22\x60\xe8\xf2\x49\x26\xe3\x99\xac\x2c\x14\x72\xb9\
\x08\x64\x01\x7f\x1a\xed\x04\x26\x03\x47\x81\x87\x03\x55\x2a\x5e\
\x5e\xb5\x0a\x95\xbf\xbf\xd5\x95\xc8\x7b\x86\xfa\x04\x5b\x1b\xe4\
\x37\x71\x22\x79\xd9\xd9\x82\xb3\x93\x13\xc0\x9b\xc0\x5b\xa3\x95\
\xc0\x9f\x00\x5f\x03\xbe\xd3\xc3\xc3\x59\x93\x9f\x8f\x97\xa7\xe7\
\xa8\x98\x91\x87\x85\x86\x92\x95\x9e\x2e\xf5\xec\xb7\x81\x5f\x8c\
\x26\x2d\xec\x02\xbc\x0f\xbc\x06\x30\x7f\xce\x1c\x9e\x58\xb0\x00\
\x27\x61\x74\x19\x39\x33\xa2\xa2\xd0\xeb\xf5\x14\xed\xda\x85\x08\
\xef\x99\x3a\xcf\xbb\x23\x4d\xa0\x0f\x50\x00\x24\xcb\x9c\x9d\x59\
\x9e\x96\x46\x6c\x4c\x8c\xcd\x2f\x2b\x76\x75\x39\x84\xc4\x59\x1a\
\x0d\x5d\xa2\xc8\xf6\xdd\xbb\x31\xc9\x43\x67\xe0\x8f\x23\x45\xe0\
\x14\x60\x17\x10\xed\xee\xe6\xc6\xca\x15\x2b\x98\x3c\x69\x92\xcd\
\x2f\xa9\x37\x18\xd0\x75\x76\xf6\xfe\xfb\x26\xc0\x95\xc6\x46\x5b\
\xb5\x39\xf1\xb1\xb1\x00\x14\xef\xd9\x83\x28\x8a\xef\x98\x46\xd0\
\xef\x87\x5b\x06\xc6\x09\x82\x70\x0c\x88\x56\xf9\xfb\xb3\x76\xf5\
\x6a\xbb\x90\x07\x70\xfc\xe4\x49\xe9\xf0\x1c\x70\xdb\x74\x5c\x03\
\x50\x59\x5d\x6d\x97\x67\xc4\xc7\xc6\x92\xb5\x6c\x99\x24\x13\x7f\
\x07\xfc\xc6\x16\x4b\xc1\x5a\x24\x09\x82\xb0\x4f\x14\x45\xdf\xb0\
\xd0\x50\x56\xe5\xe6\x32\xc1\xdd\xdd\x2e\x2f\xd6\x25\x8a\x14\x16\
\x17\xd3\xae\xd5\x02\xac\x03\xca\x4c\xa7\x8e\x02\xaf\x37\xb7\xb4\
\x38\x45\x47\x46\xe2\xee\xe6\x66\xf3\xb3\x02\x55\x2a\x7c\xbd\xbd\
\xa5\x8f\x92\x0c\x68\x81\x12\x47\x13\xf8\xa4\x69\xd8\xba\x47\x46\
\x44\x90\x97\x9d\x6d\x3e\xe5\xb0\x19\x95\xd5\xd5\xfc\x70\xe2\x04\
\x26\x2f\xca\x5a\x33\x0b\xe4\x36\x10\x02\xc4\x1b\x0c\x06\xa6\x87\
\x87\xdb\xe5\x79\x81\x2a\x15\x3e\x5e\x5e\x12\x89\x8b\x80\x3b\xc0\
\x11\x47\x0d\xe1\x14\xa0\x18\x50\x26\xcc\x9c\x49\x6e\x66\xe6\x3d\
\x8e\x00\x7b\xe0\xe4\xe9\xd3\xd2\xe1\x87\x40\x6f\x4d\xf2\x1e\xc0\
\xe9\x8a\x0a\x74\x3a\x9d\xdd\x9e\x39\x73\xc6\x0c\x96\x2f\x59\x22\
\x15\xdf\x05\x5e\x71\x04\x81\xb3\x81\x22\x40\x31\x3b\x3e\x9e\xf4\
\xc5\x8b\x71\x72\xb2\xef\x1c\x5c\xab\xd5\x52\x75\xfe\xbc\x54\xfc\
\xb4\x8f\x4b\xaa\x80\x1f\x74\x3a\x1d\x67\xcf\x9d\xb3\xeb\xb3\xe3\
\x62\x63\x59\x96\x9a\x2a\x39\x2b\xfe\x66\x8d\xf7\xc6\x12\x16\xc2\
\x81\x9d\x80\xdb\x2c\x8d\x86\xb4\x94\x14\x73\x53\xcb\x6e\xb8\x58\
\x53\x83\xc1\x60\x00\x38\x09\x34\xf6\x73\xd9\x16\xc0\xee\x04\x02\
\x3c\x1a\x17\xc7\xfc\x39\x73\x24\xb1\xb6\x19\x98\x66\x0f\x02\x3d\
\x4d\x32\xcf\x2f\x62\xea\x54\x96\x2f\x59\xe2\x10\xf2\x00\xae\x34\
\x34\x48\x87\x7b\x06\xb8\x6c\x1f\x40\xdd\x95\x2b\x0e\x69\x43\xf2\
\x82\x05\x44\x46\x44\x00\x78\x99\x3c\x49\x1e\xb6\x12\xf8\x31\x10\
\xee\xef\xe7\x47\x4e\x66\xa6\xdd\x87\xad\x39\xae\x35\x37\x4b\x87\
\x67\x06\xb8\xac\x1c\xa0\xb5\xb5\x15\xbd\xb1\xb7\xda\x15\x82\x20\
\x90\x95\x9e\x8e\x9f\xaf\x2f\x40\x94\x69\x38\x0f\x99\xc0\x57\x80\
\x1c\x85\x5c\xce\xca\xec\x6c\xe4\x2e\x2e\x0e\x35\xb5\xf4\x3d\x2e\
\x79\xed\x40\x97\x61\x52\xcd\x5d\x0e\x20\x10\x40\x21\x97\xb3\x72\
\xc5\x0a\xa9\xb3\x3c\x07\x64\x0e\x85\xc0\x00\xc9\x4e\x4c\x4b\x49\
\x61\xa2\xf1\x8b\x38\x14\xae\xae\xae\xd2\xe1\x40\x8b\x47\xc1\x00\
\x2e\x32\x99\x68\xcf\xe9\x53\x5f\x1e\x9c\x25\x8b\x16\x99\xcf\x08\
\xbc\xad\x25\xf0\x6d\xc0\x73\x6a\x68\x28\xb3\x34\x9a\x61\x31\xf6\
\xcd\x2c\x99\xdf\x0e\x30\x3f\xfd\x2b\x40\xa8\x5a\xed\x70\x4f\xc5\
\xa3\x71\x71\x52\x9b\x54\x03\xb9\xc0\xfa\x22\x70\x1a\xb0\xc6\x49\
\x10\x48\x7b\xf2\xc9\x61\xf3\x96\xcc\x8c\x89\xc1\x4d\xa9\x94\x14\
\x57\x23\xf0\x2a\xc6\xb5\x8c\x44\xd3\x50\x3a\x06\x64\x03\xcc\x33\
\x6a\x4b\x87\x42\x10\x04\xf3\x05\xb0\xb5\x40\xa0\xa5\x04\xfe\x14\
\x90\xc5\x44\x45\xe1\x3f\x71\xe2\xb0\x11\xe8\xea\xea\x4a\xde\x8a\
\x15\x12\x89\x7e\xa6\xa1\x73\xc8\x64\x19\x6c\x02\x1e\x91\xc9\x64\
\x64\xa4\xa5\x11\xaa\x56\x0f\x4b\x9b\x26\x05\x05\x49\x5a\x59\x09\
\xbc\xde\x27\xd1\x7d\x10\xda\x00\xa8\x5e\x5e\xb5\xca\x6e\x0e\x02\
\x6b\xd0\xd6\xde\xce\x89\xd2\x52\x2e\xd5\xd6\x72\xe7\xce\x1d\xc0\
\xb8\x40\x14\x12\x1c\xcc\x2c\x8d\x66\xd8\x9d\xb4\x97\xeb\xea\xf8\
\xfb\xa6\x4d\x00\x4d\x40\x10\x60\x18\xc8\x9d\x95\x04\xa8\x7c\x7d\
\x7c\x46\x84\x3c\x00\x37\xa5\x92\xa4\xc4\x44\x92\x12\x13\x19\x0d\
\x98\x12\x12\x82\x97\xa7\x27\x37\x6f\xdd\xf2\x07\xe6\xd0\x6b\x79\
\xb4\xf7\x10\x5e\x08\x10\x36\x65\x0a\xe3\xe8\x41\xf4\xf4\xe9\xd2\
\x61\xda\x60\x32\x30\x0c\xb0\xd9\x69\x79\xbf\x21\x24\x38\x58\x52\
\x2c\x89\x83\x11\x18\x0c\xe0\xd3\x47\xfc\xc9\x83\x0c\xd3\xda\x32\
\xc0\xe4\xc1\x08\x54\x02\x38\xdb\xd9\x4d\x35\xd6\xe1\xde\xe3\x30\
\x9e\x38\x18\x81\x77\x01\xb4\x56\x46\x00\xdc\xef\xb8\x6d\x9a\x0d\
\x88\xa2\xe8\x33\x18\x81\xa9\x00\xff\x3b\x75\x6a\x9c\x35\x33\xd4\
\xf7\x78\x8a\x2c\x33\xe5\x2e\x5c\xbe\x3c\xce\x9a\x19\x5a\x5a\x5a\
\x2c\x26\xb0\x56\xf2\x8c\x74\xd8\xd1\x6d\x3e\xd6\x71\xa9\xb6\xd6\
\x62\x02\xbb\xbb\xde\xf8\x30\xee\xc1\x40\x0e\xdc\x7e\xfd\x81\xfb\
\x0f\x1d\xba\x27\x6c\xf6\x41\xc5\xe5\xba\x3a\xf3\x62\xa5\xc5\x04\
\xb6\x6b\xb5\x7c\x5f\x52\xf2\xc0\x13\x78\xe8\xc8\x3d\xab\x9c\x9d\
\x16\x11\xb8\x68\xc1\x02\x00\x0e\x1e\x3e\x4c\x43\x63\xe3\x03\x4b\
\x5e\x4d\x5d\x1d\x55\x83\x2c\x60\xf5\x49\xe0\x94\xc9\x93\x79\x34\
\x2e\x0e\x80\xcd\xdb\xb6\xa1\xd5\x6a\x1f\x38\xf2\xf4\x06\x03\xc5\
\x5f\x7f\x0d\x20\xb9\xb4\xba\x0d\x0d\x8b\x86\x70\x6a\x72\x32\x81\
\x01\x01\xb4\xde\xb8\xc1\xe7\x05\x05\x0e\x59\xc4\x19\xcd\xf8\xd7\
\x81\x03\x5c\x6b\x6a\xc2\xd7\xc7\x87\x94\x85\x0b\xa5\xbf\xe5\x16\
\x13\xe8\x22\x93\x91\x97\x95\x85\x9b\x52\xc9\xe5\xba\x3a\x0a\x8a\
\x8a\xe8\x72\x50\xd8\xd9\x68\xc3\xd9\xea\x6a\x0e\x1f\x3b\x66\x5c\
\xa5\x5b\xb6\x0c\x99\x4c\x66\xbd\x16\x06\xf0\xf1\xf6\xe6\x85\xbc\
\x3c\x14\x0a\x05\x15\x55\x55\x14\x6c\xdf\x8e\xe1\x3e\x27\xb1\xe1\
\xea\x55\xbe\x2a\x2a\xea\xd6\x05\xea\x90\x10\xeb\x65\xa0\x39\x02\
\x03\x02\xc8\xcf\xc9\xc1\xc5\xc5\x85\xf2\xca\x4a\x0a\x8b\x8b\xef\
\xdb\x9e\xd8\x78\xed\x1a\x1f\xac\x5f\x8f\x5e\xaf\x47\x13\x1d\xdd\
\xed\xd4\x35\x0b\x26\x10\xac\x26\x10\x40\x1d\x12\xd2\xdd\x13\xcb\
\x2a\x2a\xd8\xba\x73\xe7\x7d\x47\xe2\xe9\x33\x67\xf8\x68\xc3\x06\
\xa3\xcb\xc5\xd7\x97\x8c\xa5\x4b\xbb\x89\x33\xcb\x6f\xf1\x1c\x12\
\x81\x60\x5c\x76\xcc\xcf\xc9\x41\x21\x97\x73\xaa\xbc\x9c\xc2\x1d\
\x3b\xee\x8b\xe1\xac\xd7\xeb\xd9\xf5\xcd\x37\xdd\xe2\x29\x26\x32\
\x92\x75\x2f\xbe\x68\x71\xe4\x99\x55\xb1\x1a\xea\x90\x10\x9e\xcb\
\xcd\x45\x21\x97\x73\xfa\xcc\x19\x36\x6f\xdd\x4a\xe7\x8f\xc3\x71\
\xc7\x8e\x93\xe0\xfa\x75\x3e\xd9\xb4\x89\xff\x1c\x3f\x8e\xb3\xb3\
\x33\x69\x29\x29\xe4\x64\x64\xe0\x62\x45\x14\x86\xd5\xc1\x2e\x53\
\x42\x42\x78\x3e\x2f\x0f\xa5\x52\xc9\xd9\xea\x6a\x36\x7e\xf9\x25\
\xed\xed\xed\x63\x8e\xbc\x53\xe5\xe5\x7c\xb8\x61\x03\x57\x1a\x1b\
\xf1\xf6\xf2\xe2\xa5\xfc\x7c\x12\x13\x12\xac\xae\x67\x48\xd1\x42\
\x21\xc1\xc1\xac\x79\xf6\x59\x3c\x3d\x3c\xa8\xa9\xaf\xe7\x93\x4d\
\x9b\x68\xb9\x7e\x7d\x4c\x10\xd7\xa1\xd3\x51\xb8\x63\x07\xff\x2c\
\x2e\xa6\x43\xa7\x33\x0e\xd9\x35\x6b\x18\x28\x9b\x4a\xd6\xd3\x23\
\x95\x76\x21\x10\x40\xe5\xef\xdf\x9d\x89\xd4\xd4\xd2\xc2\x47\x1b\
\x37\x0e\x6a\xf6\x8c\x34\xea\x1b\x1a\xf8\x60\xfd\x7a\x4a\xcb\xca\
\x70\x91\xc9\x58\xbe\x64\x09\x39\x19\x19\xb8\x2a\x14\x03\xde\x67\
\x26\x0f\xe5\x76\x23\x10\xc0\xcb\xd3\x93\x97\xf3\xf3\x79\x78\xda\
\x34\xb4\x5a\x2d\x9f\x15\x14\xf0\xcd\xfe\xfd\xa3\x4e\xb9\x74\x89\
\x22\x87\x8e\x1c\xe1\xe3\x4f\x3f\xe5\x7a\x6b\x2b\x01\x2a\x15\x6b\
\x57\xaf\x26\x7e\xe6\x4c\x8b\xee\xbf\xdb\xd6\xd6\xef\xb9\xde\xaa\
\xe6\x45\x40\x1d\xa7\xd1\xe0\x6d\xe1\xca\x9c\x4c\x26\x23\x26\x2a\
\x0a\x27\x41\xe0\x52\x6d\x6d\xb7\x01\x1e\x12\x14\x84\xc7\x84\x09\
\x23\x4e\xde\xad\xdb\xb7\xd9\x5c\x58\xc8\xf1\xd2\x52\x44\x51\x24\
\x31\x21\x81\xdc\x8c\x0c\xab\xda\x56\x50\x54\x24\x89\xa8\xbd\xc0\
\x67\x76\x25\x50\x9a\x68\x86\xaa\xd5\x3c\xa4\x56\x73\xb1\xa6\x86\
\xe6\x96\x16\xfe\x7b\xf2\x24\xad\x37\x6f\x12\xa8\x52\xa1\xec\x09\
\x5d\x1b\x56\x94\x57\x56\xf2\x59\x41\x01\x4d\xcd\xcd\xb8\xbb\xb9\
\x91\x9b\x99\x49\x62\x42\x82\x55\x81\xa2\x07\x8f\x1c\x91\x32\x07\
\xee\x00\xcb\x80\x1b\xf7\xbc\x7b\x6f\xf7\x17\x90\x34\x4b\xa3\x21\
\x73\xe9\xd2\xa1\x09\xe9\x8e\x0e\xbe\x3d\x78\x90\x63\xc7\x8f\xd3\
\x25\x8a\xdd\x4a\x67\xa2\xaf\xaf\xf9\xfa\xaa\xc3\x71\xbc\xb4\x94\
\xeb\xad\xad\x00\x4c\x7b\xe8\x21\xb2\xd2\xd3\xad\xce\x67\x29\xaf\
\xac\x64\x4b\x51\x11\xa2\x28\x8a\xc0\xd3\x40\xe1\x8f\x3a\x4f\xaf\
\xf2\xab\x18\xa3\xa2\x58\x98\x94\xc4\x13\xf3\xe6\x0d\xf9\x05\x9a\
\x5b\x5a\x38\x50\x52\x42\x79\x65\xa5\x14\x3c\x3e\xec\x70\x12\x04\
\x52\x93\x93\x49\x4c\x48\xb0\x3a\xb6\xbb\xea\xdc\x39\xbe\x28\x2c\
\x94\x2c\xae\x5f\xd3\x4f\x4e\x5d\x5f\xb5\xbe\x00\x7c\x02\x38\xc7\
\xc7\xc6\xda\x9c\xd2\xd0\xd6\xde\x4e\xf5\xf9\xf3\x34\x5c\xbd\xea\
\xd0\x18\xeb\xbe\x30\x23\x2a\x8a\xa0\x80\x00\xab\xef\xab\xa8\xaa\
\x62\xcb\xb6\x6d\x92\x32\x7c\x9f\x7e\x42\xdb\xfa\x23\x10\x60\x39\
\xf0\x25\xa0\x8c\x8c\x88\x60\xc5\x53\x4f\x59\x35\x3b\x1f\xcb\x28\
\x2d\x2b\x63\xdb\xce\x9d\x92\xf8\xf9\x0b\xf0\x06\x03\xec\xd9\xd0\
\x9f\xc1\x77\x16\x38\x08\x64\x34\xb7\xb4\x28\x2f\x5c\xba\xc4\xc3\
\xe1\xe1\x38\x32\x2e\x79\x34\xe0\xd0\xd1\xa3\xec\xdc\xbb\x57\x62\
\xeb\x0f\xc0\x2f\x07\x55\xa0\x83\x9c\x8f\x04\x76\x03\xa1\x9e\x1e\
\x1e\xe4\xe7\xe6\x12\x30\x84\x14\xfe\x51\xef\x50\x30\x18\xd8\xb9\
\x77\x2f\x27\x4a\x4b\xc1\x98\x62\xf6\x26\xf0\x67\x4b\xee\x1d\xcc\
\xe5\xd0\x8c\x71\xdf\x97\xf9\x1d\x3a\xdd\xa4\xd2\xb2\x32\x54\x7e\
\x7e\xf8\x0d\x63\xe8\xaf\xa3\x71\xb7\xad\x8d\x2f\x0a\x0a\xa8\xa8\
\xaa\x02\xe3\xfe\x5b\x79\xc0\x06\x4b\xef\xb7\xc4\x67\x73\xc7\x34\
\x79\x0c\x33\x18\x0c\x33\x4e\x57\x54\x20\x08\x02\xea\xc9\x93\x1d\
\x96\xb5\x34\x5c\xb8\xd2\xd8\xc8\x86\xcf\x3f\xe7\x6a\x53\x13\xc0\
\x15\x8c\xd9\xa8\xdf\x59\x53\x87\xa5\x71\x6c\x7a\x60\x2b\xc6\x24\
\x98\xc7\x2f\xd6\xd4\x38\xd5\xd6\xd7\x13\x1e\x16\xe6\xf0\x04\x1c\
\x47\xe1\x44\x69\x29\x9b\xb7\x6e\x95\x72\x93\x8f\x62\x4c\x77\xad\
\xb2\xb6\x1e\x6b\x03\x01\x4b\x30\x46\xcd\x2f\x6e\xbd\x71\xc3\xbd\
\xb4\xac\x8c\xe0\xc0\x40\x7c\xbc\xbd\xc7\x0c\x71\xba\xce\x4e\xb6\
\xef\xd9\xc3\x81\x92\x12\x49\xd3\x7e\x08\x3c\xd3\xdb\xc2\xb0\xd8\
\x0a\x1b\x62\x3b\x26\x99\xa6\x39\xf3\x00\x1e\x9b\x3d\x9b\x27\xe6\
\xcf\xc7\x45\x26\x1b\xd5\xe4\x5d\x6d\x6a\xa2\xa0\xa8\x48\xca\xcb\
\x6b\xc3\x98\x15\xbf\xd1\x96\x3a\x87\x1a\x8a\x7a\x1b\x63\xee\x06\
\xc0\x63\xb5\xf5\xf5\x4e\x67\x2a\x2b\x09\x50\xa9\xac\xb2\xa1\x87\
\x13\xc7\x4e\x9c\x60\xcb\xb6\x6d\x52\xb0\x64\xa5\x49\xde\xed\xb3\
\xb5\x5e\x7b\x68\x81\x47\x80\xf5\x40\x0c\x80\x26\x3a\x9a\x94\x85\
\x0b\x47\xcd\xa6\x3b\x77\xdb\xda\xd8\xbe\x7b\xb7\xf9\x86\x15\xeb\
\x81\x9f\x71\xef\x8e\x97\x23\x4a\x20\x80\x02\xe3\xce\x17\xbf\x02\
\xe4\x32\x99\x8c\x38\x8d\x86\xf9\x73\xe7\xe2\xe9\xe1\x31\x62\xe4\
\x9d\xad\xae\x66\xfb\x9e\x3d\xdc\xb9\x7b\x17\x93\x8c\x7b\x0d\x63\
\x32\xb5\xdd\x60\xef\x79\xc8\x34\x8c\xdb\x88\x3c\x23\xd5\xed\xea\
\xea\x4a\x70\x60\xe0\xb0\x93\x77\xe1\xd2\x25\xf3\xe2\x7e\xe0\x79\
\x4c\x01\xa4\x63\x01\x33\x31\xa6\xe7\xeb\x4c\x76\xe4\x48\xfd\x3a\
\x80\x9f\xe3\xc0\x7d\x12\x1d\x3d\x13\xf6\x05\x66\x31\x72\xbb\x05\
\x5f\xc0\x81\x1b\xd0\x8e\x63\x1c\xe3\x18\xc7\x83\x8e\xff\x03\xac\
\x37\x9f\x01\x8d\x77\x23\x7b\x00\x00\x00\x00\x49\x45\x4e\x44\xae\
\x42\x60\x82\
\x00\x00\x00\xb2\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x01\x00\x00\x00\x01\x08\x06\x00\x00\x00\x1f\x15\xc4\x89\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\x00\x00\x00\x00\x00\xf9\x43\xbb\x7f\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x01\x1e\
\x04\x04\x0e\xa0\x53\x3f\x37\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x00\x0d\
\x49\x44\x41\x54\x08\xd7\x63\x60\x60\x60\x60\x00\x00\x00\x05\x00\
\x01\x5e\xf3\x2a\x3a\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\
\x82\
\x00\x00\x05\xa5\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\x86\x00\xaf\x00\xd2\x7d\x1c\x57\xe8\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x01\x1e\
\x04\x25\x2c\xf9\xac\x6b\x30\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x05\x00\
\x49\x44\x41\x54\x78\xda\xed\x9c\x6b\x50\x54\x65\x1c\x87\x9f\xb3\
\xbb\xdc\xe4\x26\x97\x55\x58\x14\x36\x20\x16\x48\x56\x65\x1d\x4c\
\x85\x14\x1c\x47\xd4\x2e\x86\x62\x32\x65\x25\x21\xcd\xa4\xf9\xa1\
\xc8\x99\xf2\x83\xa8\x35\x95\x4e\x33\x5a\x7d\xc8\x69\xc0\x69\xa6\
\x9c\x3e\x24\x5a\xd3\x4c\x65\xa2\x91\x95\x78\x0d\x47\x41\x4d\x0d\
\x75\x0c\x15\x50\x34\x4c\x94\xcb\x9e\x3e\xec\xb1\xd1\xc9\xcb\x0a\
\xbb\xeb\x2e\xfc\x9f\x99\xf3\x65\xf7\x9c\x77\xcf\x79\xde\xff\x9e\
\xf7\x7d\x7f\x67\x76\x41\x10\x04\x1f\x46\xef\x03\xe7\xb7\x0e\xf8\
\x07\x68\x94\xee\xba\x3f\x02\x81\xaf\x01\x55\xdb\x26\x8b\x12\xe7\
\x09\x05\xb6\xdd\x24\x4f\x05\xae\x03\x4f\x89\x9a\x7b\x13\x0d\xec\
\x01\xd4\xd0\x08\xa3\xba\x78\xcd\x46\x75\xdc\xf4\xa2\x1b\x12\xbb\
\x81\x79\x72\x0f\xbc\x33\xc3\x80\xed\x80\x35\x32\x66\x38\xa5\xef\
\x54\x62\x8c\x33\x63\xb1\xe5\xa0\xaa\x76\x1a\xeb\xf7\xe9\x80\x99\
\xc0\x45\x60\xb7\x08\xbc\x95\x14\x4d\x5e\x72\x8c\x39\x85\x92\x15\
\x15\x84\x47\xc7\xfc\xf7\x66\x62\x46\x16\x01\x41\xc1\x1c\xab\xfb\
\x4d\x01\xa6\x69\x15\x59\x23\x02\x1d\x64\x02\x5b\x81\xb8\x84\xd4\
\x51\x14\x97\xaf\x23\x38\x2c\xe2\x7f\x3b\xc5\xa7\x8e\x64\xb0\x31\
\x96\x23\x7b\x6b\x40\x55\x73\x81\x70\x60\xcb\x40\x17\xf8\x18\xf0\
\x03\x10\x95\x92\x99\xcd\xf3\x4b\x3f\x22\x30\x28\xe4\x8e\x3b\x9b\
\x12\x53\x19\x1a\x9f\x4c\xc3\xae\x6a\x54\xbb\x7d\x1c\x90\x00\x7c\
\xab\x55\xe4\x80\x13\xf8\xb8\x36\x55\x09\xb1\x66\xe7\x33\xf7\xf5\
\xd5\xf8\xf9\x07\xdc\xf3\xa0\x21\xc3\x13\x89\xb7\x8c\xe4\xd0\xce\
\xad\xd8\x7b\xba\x47\x01\x23\x80\xcd\x40\xcf\x40\x12\xf8\x2c\xf0\
\x25\x10\x90\x35\xb5\x90\x82\x85\xcb\xd1\x1b\x0c\x4e\x1f\x1c\x19\
\x33\x8c\xa4\x8c\x2c\x0e\xed\xac\xa6\xbb\xeb\x7a\x1a\x30\x0e\xa8\
\x02\xba\x06\x82\xc0\x45\xc0\xa7\x80\x7e\xd2\xac\x12\x66\x14\x2f\
\x41\xd1\xe9\xee\xbb\x91\xf0\xe8\x18\x2c\xb6\x6c\xea\x6b\xab\xe9\
\xbc\xd6\x91\x08\xe4\x6a\x12\xaf\xf5\x67\x81\xcb\x80\x55\x80\x32\
\xfd\xc5\x32\x72\xe7\x94\xf6\xa9\xb1\x90\xc1\x51\xa4\x65\xe5\x72\
\x78\x4f\x0d\xd7\xae\xb6\x0f\xd7\x46\xe8\xcd\xc0\x15\x4f\x5c\x8c\
\xe2\x41\x71\x0a\xb0\x06\x58\xac\xe8\x74\x14\xbc\x52\x8e\x6d\xf2\
\x4c\x97\x35\x7e\xb9\xf5\x1c\x95\xcb\x5f\xa6\xe5\x4c\x23\xc0\x71\
\x60\x0a\x70\xb2\xbf\x54\xa0\x01\xf8\x0c\x58\xa0\x37\xf8\x51\xf4\
\xc6\x07\x8c\xcc\x99\xe6\xda\x85\xf3\xa0\x10\xac\xd9\xf9\xfc\x79\
\x70\x37\xed\x6d\x2d\x91\xc0\x6c\xe0\x7b\xa0\xd5\xd7\x05\x06\x01\
\x5f\x01\x85\xfe\x81\x83\x78\x61\xe9\xc7\x58\x6c\x39\x6e\xf9\x20\
\xff\x80\x20\xac\xd9\xf9\x9c\x3e\x5a\xc7\xa5\x96\xb3\x61\xc0\x33\
\xda\xe4\xbc\xc9\x57\x05\x86\x69\x73\xb4\xa9\x41\xa1\xe1\x14\x2f\
\x5b\x87\x39\x3d\xd3\xbd\xa5\xee\xe7\x8f\x75\x42\x3e\x67\x4f\x1e\
\xe5\x42\xd3\xa9\x41\xc0\x5c\xa0\xd6\x5d\x5f\x67\x77\x0a\x34\x02\
\x3f\x02\xe3\xc3\x22\x87\x50\xb2\xb2\x02\x53\x62\xaa\x67\x46\x46\
\x83\x81\x8c\xf1\x53\xb8\x78\xee\x0c\xe7\x4f\x1f\x0b\xd0\x2a\xf1\
\x00\xf0\x87\xaf\x08\x8c\xd7\xe2\x28\x6b\x54\x6c\x3c\x0b\xde\xae\
\x20\xda\x94\xe0\xd1\xa1\x5e\xa7\xd3\x93\x3e\x36\x8f\x2b\x97\x2f\
\xf0\xd7\x89\x06\x3f\xa0\x10\x38\x01\x1c\xf4\x76\x81\xa9\x9a\xbc\
\xa4\x58\xb3\x85\x97\x56\x56\x10\x1e\x35\xf4\x81\x4c\x36\x15\x45\
\x21\x75\xcc\x44\xba\xbb\x3b\x39\x75\xf8\x77\x3d\xf0\x34\xd0\x0c\
\xec\xf5\x56\x81\x36\xa0\x1a\x30\x99\xd3\x32\x99\x5f\xfe\xc9\x6d\
\x43\x01\x4f\x93\x6c\x7d\x14\xbf\x80\x40\x8e\x1f\xa8\x55\xb4\xe5\
\x63\x27\xf0\x8b\xb7\x09\x9c\xa8\x85\x02\x11\x16\x5b\x0e\xf3\xde\
\xfa\xf0\xae\xa1\x80\xa7\x49\x48\x1b\x4d\x68\xa4\x91\xa3\xfb\x77\
\x80\xaa\x4e\x06\x82\xb5\x04\xc8\x2b\x04\x3e\xa9\x85\x02\xc1\x19\
\x13\xa6\x52\x54\xe6\x5c\x28\xe0\x69\xe2\x92\xd2\x31\xc6\x99\x39\
\xbc\x67\x3b\xaa\xdd\x3e\x01\x88\x05\xbe\xeb\x4b\x92\xe3\x0a\x81\
\xf3\x80\x0d\x80\xff\xd8\xfc\x39\x14\x2c\x5a\x81\x5e\x6f\xc0\x5b\
\x19\x1a\x9f\x4c\x5c\x52\x3a\x0d\xb5\xdb\xb0\xf7\x74\xdb\x00\x0b\
\xf0\x4d\x6f\x93\x9c\xbe\x0a\x7c\x15\xc7\x63\x47\x7d\x6e\x61\x29\
\xd3\xe7\x97\xa1\x28\x0a\xde\x4e\xb4\x29\x01\xf3\x23\x99\xd4\xd7\
\x56\xd3\xd3\xd5\x39\x02\x18\x03\x6c\xea\x4d\x92\xd3\x17\x81\xe5\
\xc0\xfb\x80\x32\xa3\x78\x09\x93\x66\x97\xe0\x4b\x44\x18\x4d\xa4\
\x8c\x1e\x4f\xfd\xae\x6d\x74\x5d\xef\x78\x18\x47\xb0\x5b\x85\xe3\
\xe9\x9f\x5b\xc3\x04\x1d\xb0\x16\x58\xa4\xe8\x74\xcc\x5a\xb8\x9c\
\xcc\x3c\xdf\x7d\xda\xd8\x7c\xa6\x91\xf5\xe5\xa5\x5c\xbe\x70\x1e\
\x60\xbf\x96\xe6\x34\xbb\x4b\xa0\x01\x58\x0f\x3c\xa7\x37\xf8\x51\
\x54\xb6\x9a\xf4\xb1\x79\x5e\x23\xa3\xbd\xad\x95\xbf\x2f\x36\xdf\
\xf7\x71\x6d\xcd\x4d\x6c\x58\xf5\xda\x2d\x83\x36\x70\xda\xd5\x02\
\xfd\xb5\x50\xe0\x89\x1b\x2f\x98\x92\xd2\x7b\x75\xa1\x05\x0b\xcb\
\x31\x3d\xe4\xfa\x65\xdd\x4f\x1b\x2b\xd8\xf2\xf9\x5a\x57\x34\x75\
\x09\x47\x38\x5b\xe7\x4c\x45\x39\x2b\xaf\x0a\x98\x71\xf3\x8b\x4d\
\x27\x1a\x7a\x75\x76\x9d\x1d\x57\x3d\x51\x90\xfb\x7a\x71\xcc\x60\
\x20\x49\x5b\xf2\xad\x01\x4a\xef\xb5\x7e\x76\x56\x60\x30\x8e\x24\
\x79\x59\x1f\x2f\x6a\x07\x8e\x78\xcb\xdd\xbc\x07\xbc\xe9\x89\x5e\
\x72\x56\x60\x5b\x2f\x7b\xf4\x76\x55\x91\x4d\x3f\x42\x87\x20\x02\
\x45\xa0\x08\x14\x81\x82\x08\x14\x81\x22\x50\x04\x0a\x22\x50\x04\
\x8a\x40\x11\x28\x88\x40\x11\x28\x02\x45\xa0\x20\x02\x45\xa0\x08\
\x14\x81\x82\x08\x14\x81\x22\x50\x04\x0a\x22\x50\x04\x8a\x40\x11\
\x28\x88\x40\x11\x28\x02\x45\xa0\x20\x02\x45\xa0\x08\xec\x3f\x3c\
\x90\x5f\x05\xd6\x6c\xaa\xe4\xd4\x91\x3a\x97\xb7\xfb\x73\x55\x65\
\xbf\xef\xb0\x1d\xdc\xfa\xaf\x94\xee\xda\xde\xed\xaf\x15\xf8\x05\
\xf0\xab\x27\x8a\x5c\x6e\x2e\x82\x20\x08\x82\x20\x08\x77\xe5\x5f\
\x8f\x64\x4e\x41\x71\xfe\x0d\xb2\x00\x00\x00\x00\x49\x45\x4e\x44\
\xae\x42\x60\x82\
\x00\x00\x05\xb6\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\x86\x00\xaf\x00\xd2\x7d\x1c\x57\xe8\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x01\x1e\
\x04\x25\x0b\x5c\xa6\xde\x5b\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x05\x11\
\x49\x44\x41\x54\x78\xda\xed\x9c\x79\x6c\x14\x75\x14\xc7\x3f\xbb\
\xdb\x52\x10\x1a\x5a\x40\x2e\xa1\xd4\x36\xd0\xba\x84\x1a\xab\x50\
\x88\x44\x61\x89\x06\x34\x80\x15\xa3\x21\xd1\x84\x60\xa5\x24\x55\
\x42\x54\x12\x43\x94\x42\x0c\x35\x48\x8c\x36\xf1\x0f\x68\xda\x94\
\x20\x10\x14\x2a\x47\x4c\x68\x6b\xe5\x90\xb5\x90\x6a\x8b\x5d\x7b\
\xa4\xf7\x01\x3d\xa8\x5b\x4a\xef\x6b\xbb\xe3\x1f\x9d\x4d\xaa\x09\
\xa1\xdd\xce\xce\x76\xf1\x7d\x93\xfd\x67\x93\x79\x6f\xde\x67\xde\
\xbe\xdf\xbc\xf7\xdb\x19\x10\x89\x44\x22\x91\x48\x24\xf2\x49\x19\
\x74\xf6\xb7\x13\x08\xd5\xc1\xcf\x55\x20\xf3\x51\xbc\x60\xd7\x01\
\x45\x87\xcf\x17\x7a\x05\xe4\xe7\x0d\x8a\x11\xcf\xbd\x40\xe8\x53\
\xd1\x9a\xdb\xbd\x96\x91\x46\x5f\x4f\xa7\xae\xb1\x78\x05\xe0\x8b\
\xb1\xdb\x09\x35\x6b\x0f\x50\x51\x14\xb2\x4f\x24\xeb\x1a\x8b\x51\
\x96\x01\x01\x28\x00\x05\xa0\x00\x14\x09\x40\x01\x28\x00\x05\xa0\
\x48\x00\x0a\x40\x01\x28\x00\x45\x02\x50\x00\x0a\x40\x01\x28\x12\
\x80\x02\x50\x00\x0a\x40\x91\x00\x14\x80\x02\x50\x00\x8a\x04\xa0\
\x00\x14\x80\x02\x50\x24\x00\x05\xa0\x00\x14\x80\x22\x01\x28\x00\
\x05\xe0\x23\xa4\xd1\xfe\xc9\x3c\x18\x08\xd3\xc0\xdf\xb3\xff\x57\
\x80\xdd\xc0\x01\xe0\x55\x1f\x89\xeb\x13\xe0\x25\x37\x8e\x0b\x02\
\xc2\x81\x7c\xa0\x0b\xd8\x01\x94\x6b\x01\x70\x00\x78\x1d\x38\x0b\
\x6c\x74\x7d\x39\x3f\xdc\xec\x56\x74\x93\xa6\x3c\xa6\x07\xc4\xf1\
\x64\x7b\x38\xb0\xf6\x61\xf0\x60\xec\x8f\x7a\xf9\x01\xe9\xc0\xdb\
\x26\x3f\x7f\xb6\x7e\x7c\x18\x73\x8c\x65\xc2\xa4\x5d\x67\x9b\x9d\
\x8e\x7b\x2d\x63\x3e\xae\xad\xa5\x91\x53\x5f\x7e\x38\xf2\xab\x45\
\x40\xfd\x68\x8e\x75\xe7\x59\x39\x23\x90\x0c\xbc\x6f\x30\x1a\xd9\
\x92\x70\x80\x68\xcb\x66\x9f\xad\x61\x2d\x77\x6a\x48\xdf\xbf\x83\
\xf6\xd6\xbb\x00\x05\xc0\x06\x60\xd4\x57\xc1\xe4\x86\x4f\x05\xb8\
\x04\x18\x50\x94\x35\x25\x79\x57\x98\x3c\x35\x90\x90\x88\x28\x9f\
\x83\xd7\x58\x5d\x4a\x5a\xe2\x7b\x74\xb6\xd9\x61\xf8\x39\xbe\xf5\
\xc0\xbd\xb1\xd8\x30\x8d\xc3\xff\x55\xd5\xd9\xfa\x8a\x5b\xbf\x19\
\x9c\xce\x21\xc2\x97\xad\xf0\x19\x78\x35\x25\xf9\xa4\x1f\xd8\x49\
\x6f\x57\x3b\x6a\x42\x6c\x52\x17\x0e\xf4\x02\x08\x90\x07\x54\x03\
\x1b\x6b\x4b\xf2\x8d\x5d\xed\xad\x2c\x89\x5e\x8d\xc1\x60\x98\xd0\
\xf0\xca\xf2\xaf\xf3\x5d\xd2\x2e\x06\xfa\x7a\x00\xbe\x07\xde\x02\
\xfa\xdc\xb1\x65\xd2\xe0\x7c\x6c\x40\x21\x10\xdb\x50\x59\xec\xf7\
\x77\x43\x0d\xe6\x15\x6b\x31\x1a\x4d\x13\x12\x9e\xcd\x9a\xc9\xe9\
\xaf\xf6\xe0\x18\x1c\x00\x48\x01\xde\x05\x1c\xee\xda\xd3\x2a\xca\
\x32\xc0\x0a\x6c\x69\xb9\x5d\x15\xd0\x58\x5d\x8a\x39\xc6\x82\xc9\
\xcf\x7f\x42\xc1\xcb\xcb\x3e\x4b\xc6\xb7\xfb\x70\x0e\x0d\x01\x1c\
\x06\x76\x03\xce\xf1\xd8\xd4\x32\x4d\xea\x80\x6c\x20\xb6\xb5\xa9\
\x7e\x6a\x6d\x71\x01\xe6\x95\x16\xfc\x27\x05\x4c\x08\x78\xbf\x9e\
\x4b\xe7\xa7\xb4\x43\xa0\x28\x00\x7b\x81\x44\x2d\xec\x7a\xa2\x58\
\x45\x02\x59\x40\xc8\xbc\xd0\x08\xb6\x25\x1e\x21\x30\x68\xa6\x57\
\xe1\x65\x9d\x48\xe6\x5a\x46\x1a\x6a\xb6\x25\x00\x47\xb4\xb2\xed\
\xa9\x6a\x1f\xa2\x42\x8c\x9c\x39\x2f\x84\xed\xfb\x8f\x12\x3c\xfb\
\x09\xdd\xc1\x39\x9d\x4e\x2e\xa6\x1c\x24\x2f\xeb\x0c\xc0\x20\xb0\
\x0d\x38\xa5\xa5\x0f\x4f\x55\xfa\x76\xe0\x07\xc0\xd2\xdb\xd5\x3e\
\xbf\x28\xf7\x67\x16\x47\x3f\xcf\xb4\xe9\x33\x74\x83\x37\xe4\x18\
\xe4\x6c\xf2\xa7\x14\x5c\xbe\x00\xd0\x0b\xbc\x01\x64\x68\xed\xc7\
\x93\x4b\x65\x0f\x70\x1a\x58\xd5\xdf\xdb\x1d\x6a\xb3\x66\x12\xb6\
\x74\x39\xd3\x67\xce\xf1\x38\xbc\xc1\xfe\x3e\x4e\x1e\xfe\x88\xe2\
\x9b\x39\x00\x1d\x6a\xff\x9e\xed\x09\x5f\x9e\xbe\xd7\xe8\x57\x33\
\x31\xca\x31\xd0\x1f\x61\xb3\x66\xb2\x70\xc9\x32\x66\xcc\x59\xe0\
\x31\x87\x7d\x3d\x5d\x1c\x3f\x98\x40\x65\xe1\x4d\x00\x3b\xf0\x32\
\x90\xeb\x29\x7f\x7a\xdc\xac\x39\x80\x33\x40\xd8\x90\x63\x30\xca\
\x66\xcd\x64\xce\xa2\xc5\xcc\x5e\xf0\xa4\xe6\x8e\xba\x3b\xda\x48\
\xdf\x1f\x4f\x7d\x99\x0d\xe0\x0e\x60\x51\xef\x53\xf1\x65\x80\xae\
\xd5\xef\x3c\x10\xac\x38\x9d\x31\x45\xb9\xd9\x04\xcd\x9a\xcb\xfc\
\xb0\x48\xed\x8a\xae\xbd\x99\xd4\x7d\x71\x34\xd7\x55\x00\x54\xaa\
\xe3\xa8\x4a\x4f\x07\xa6\x77\xbb\x30\xfc\x36\x21\x45\x59\x53\x9a\
\x77\x85\x80\x29\x53\x09\x89\x7c\x7a\xdc\x46\xed\x8d\x75\xa4\x7e\
\x16\xc7\xbd\xe6\xdb\xae\xce\xc8\xa2\x66\x20\x8f\x1a\x40\x80\x6b\
\x40\x2b\xb0\xa1\xe2\xcf\x5c\xc3\x90\x63\x90\xf0\xa8\x18\xb7\x8d\
\x35\xd7\x95\x93\xba\x2f\xce\x35\x07\xbc\xa1\xd6\x3c\xbb\x5e\xc1\
\x78\xab\x61\xcd\x53\x7f\x5e\x9b\x6a\x4b\x0b\x8c\x9d\xf7\xed\x2c\
\x79\x66\x35\x06\xe3\xd8\xf6\xb8\xea\xcb\x0a\x49\x4b\x8c\xa7\xa7\
\xf3\x3e\x40\x0e\xc3\x5b\x0e\x1d\x7a\x06\xe2\xcd\x8e\xff\x2f\xe0\
\x16\x10\xdb\x50\x55\xe2\x6f\x6f\xac\x23\x72\xf9\x1a\x8c\xa6\xd1\
\x9d\x52\x65\xe1\x4d\x8e\x7d\x9e\xc0\x40\x6f\x37\xc0\x8f\x0c\x6f\
\x39\xf4\xe9\x1d\x84\xb7\x47\x26\xe5\x0c\x0f\x32\xb7\xdc\xad\xaf\
\x0c\x68\xa8\x2a\xc1\xbc\xf2\xe1\x43\x88\xa2\x1b\x39\x9c\x3c\xb4\
\xdb\x35\x51\x39\x06\xbc\x33\x9e\x89\x8a\x2f\x03\x1c\x39\x84\x78\
\xad\xb5\xa9\x7e\x5a\x4d\xd1\x1f\x2c\x5d\xb5\xee\x81\x43\x88\xfc\
\x5f\xce\x73\x26\x79\xaf\x6b\xa2\xf2\xb5\xda\xdb\x3a\xbd\x75\xf2\
\x13\x65\x68\xd7\x04\x5c\x04\x36\xb5\xdb\x9b\x83\xca\x0b\xac\x98\
\x63\x2c\x04\xfc\x67\xf7\xce\x7a\xe1\x38\x17\x53\x0e\xba\x26\x2a\
\x89\xea\x54\x45\x34\x42\x0b\x80\x52\x40\x99\x31\x77\xa1\xb2\xe7\
\xe8\x25\x25\xe9\x9c\x4d\x49\x3a\x67\x53\x2c\x6f\xc6\xbb\xde\x0d\
\xe8\x04\x3e\x10\x54\x0f\xd6\x2c\xe0\x77\x40\x09\x0c\x7e\x5c\xd9\
\xf5\x4d\x86\xb2\xea\x95\xad\x2e\x78\x0e\xb5\xde\x89\x1e\xa2\x40\
\xe0\x32\xff\x7e\x2b\x65\x3f\xb0\x59\xd0\x8c\x5e\x93\x81\x0b\x23\
\x00\xae\x13\x24\xee\x2d\x72\x29\x6a\x6b\x26\x12\x89\x44\x5a\xeb\
\x1f\x35\x4e\xac\xc1\x8a\xf0\xc4\x68\x00\x00\x00\x00\x49\x45\x4e\
\x44\xae\x42\x60\x82\
\x00\x00\x06\x7d\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\x00\x00\x00\x00\x00\xf9\x43\xbb\x7f\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x01\x1e\
\x06\x20\x02\x5b\x89\x46\xd4\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x05\xd8\
\x49\x44\x41\x54\x78\xda\xed\xdc\x7f\x8c\x1e\x45\x1d\xc7\xf1\xd7\
\x53\x6b\x05\xa5\x77\x90\xd2\xc8\xef\x08\x92\x18\xa5\x47\x22\xb1\
\x90\x28\x7f\x40\xab\x69\x0b\x15\x6c\x4d\x89\x45\x2d\x6a\x1a\x03\
\x28\x1a\x20\x31\xa2\x18\x02\x4a\xc0\x2a\x09\x04\x48\x80\xa8\x91\
\x1f\x46\x6c\x0d\x09\x4d\x8d\x02\x56\x90\x4a\xb0\x10\x02\xb9\x28\
\xa9\xa6\x58\x5b\xb0\x0d\x28\x2d\x0d\x3c\x45\x2a\xbd\xf1\x8f\x9d\
\x1b\x9e\xe7\xb8\xde\xee\x5e\xaf\xbd\x5b\x6e\x3e\xc9\x24\xbb\xcf\
\xcd\xce\xee\xbc\xf7\xbb\xf3\xe3\xfb\x9d\x39\xb2\xb2\xb2\x1a\xac\
\xd6\x01\xbe\xdf\xbb\x71\x62\x4c\xc7\x62\x26\x66\xe0\x3d\xd8\x83\
\x8d\xf8\x03\x9e\xc9\xaf\xe6\x2d\x1d\x8f\x2b\xf1\x28\x5e\x47\xa8\
\x90\xfa\xf1\xb9\x71\x78\xc1\x13\xca\x02\x8f\xc0\x8f\x23\x88\x77\
\xa5\x5f\x3f\x80\x13\x70\x1c\x8e\xc4\xa1\x98\x8a\xed\xd8\x82\x95\
\x78\x23\xe5\xfe\x13\x96\x61\xd3\x64\xb3\xba\x93\xb1\x2d\x59\xd4\
\xd9\x82\x5f\x0a\xfe\x25\x68\x97\xa4\x1d\x82\x15\x82\xde\x64\x8d\
\x3b\x30\x7f\x32\xc1\x3b\x04\xff\x40\x30\x4b\xf0\x74\x05\x68\x6d\
\xc1\x16\xc1\x53\x31\xff\x76\xc1\x66\xc1\xbc\x04\x71\x37\x96\x4c\
\x16\x80\xdf\x44\x70\x98\xe0\xa5\x0a\xe0\x1e\x12\x9c\x3a\xa4\x0d\
\x9c\x6a\xc0\x22\xc1\x33\x82\x8b\xbb\xfe\x36\x77\x98\xfb\xf5\x35\
\xd5\xca\xe6\x45\xab\x58\x12\xdb\xb9\xc1\xe3\xa2\xb2\xb7\x56\x80\
\xb7\x4a\xd0\x32\xd0\x01\xe8\x9f\x78\x35\x9d\x4f\xb7\xc7\xfd\x5d\
\x00\x6f\x1f\xe6\x59\x1e\x6b\x22\xc4\xbe\xd2\x9e\xf4\xc9\x12\x78\
\x9b\x05\x3d\x09\xde\x1a\x1c\xdc\x51\xfe\x51\x58\x3f\xa4\xcc\xbf\
\x63\xfa\x30\xcf\xd2\x8f\xad\x71\x58\xd4\x40\x80\x0b\x05\x8b\x3a\
\xd2\xe0\xef\x1b\x4a\x00\xfe\x20\xe5\xdd\xb4\x97\xd1\xc0\x14\xac\
\xed\x00\x78\xf2\x5e\x9e\xa5\x13\xf2\xcc\x66\x01\x3c\x69\x18\x30\
\x2f\x0b\x3e\x2c\x78\xbe\x04\xe0\xe9\xa9\xd2\x4b\x47\xb8\xcf\xf4\
\x38\xb8\xbe\x62\x84\x3c\x9b\x3b\x00\x3e\x8d\xde\x66\x03\x6c\x0b\
\xd6\x0a\xfe\x56\x02\x70\x46\xaa\xf4\x31\x25\xf7\xfa\x60\xc9\x78\
\xb5\x7f\x88\x15\xae\xc3\x7b\x0f\x14\x88\x29\xfb\xa5\xd4\x47\xf1\
\x4a\x49\x9e\xff\xa5\xa3\xd7\x4a\x72\x3e\x17\xc1\x8c\xac\xfb\xe2\
\xc0\x9c\xd3\xb1\x0a\xd3\x26\x3e\xc0\x1d\xc3\xa4\x75\xb8\xb6\xc2\
\xb5\x3d\xe9\xe8\x84\x31\xa9\xc9\xd1\xf8\x1d\x0e\x07\x67\xe1\xae\
\xae\x19\x50\xe3\x7a\xe1\x67\x4b\x3e\xe1\x25\x29\xef\xca\x11\xee\
\x73\x3e\xfe\x83\xdb\x4a\x3f\xe1\xf5\xb1\xdc\xc7\x04\xd3\x53\xef\
\x7e\xfb\x44\x9d\x4f\x7f\x24\xce\x5e\xb7\x47\xbb\xdb\xde\x91\x0a\
\x30\x6b\x4b\x00\x3e\x22\x68\x25\x88\xf7\x46\x1b\x82\xc3\xf0\x05\
\x3c\x31\xe4\xa5\xcc\xab\x04\xb0\x2d\x78\x50\x70\x50\x82\xf8\xc3\
\xa6\x8d\x11\xef\x44\xb0\xb8\xc2\x40\xfa\x47\x25\x56\x7c\xa8\x01\
\x47\x76\x0d\xb2\x7b\x2a\x01\x6c\x0b\xee\x8b\x33\x9a\xe2\xda\x6f\
\x37\x09\xe0\xc7\x89\x0f\x7e\x63\x05\x88\x0f\x08\x16\x08\x0e\x8e\
\xa0\xa6\xc5\xa9\xdd\xf5\x82\xad\x82\x5b\xba\xa0\x5e\x5a\x19\x60\
\x5b\x70\x67\xd7\x4c\xe7\xa2\x26\x41\xbc\x32\x55\x7a\x81\xe0\xaf\
\x15\x1d\x0a\xdb\x04\xaf\xc5\xe3\x7e\xc1\xdc\x2e\x78\x77\x47\xc7\
\x6b\x75\x80\x6d\xc1\xcd\xe9\xfa\x37\xf1\xf9\xa6\x39\x15\xfe\x9b\
\x00\x7c\x42\x70\x83\xe0\x71\xc1\xce\xbd\x54\xf6\xd5\xd8\x7e\x2d\
\xe9\x02\xb7\x13\x5f\xa9\xdc\x89\x0c\x97\xbe\x9f\xca\x7a\x03\x9f\
\x6e\x12\xc4\x13\x63\x9b\xb8\xbb\xab\x6d\x9b\x26\x38\x5e\x30\x5b\
\x70\x66\x9c\x95\x7c\xf4\x6d\x6d\xe0\x1e\xfc\x2c\x8d\xee\xf6\x05\
\x60\x5b\x70\x79\x2a\xb7\x8d\x33\x9b\xd6\xb1\x1c\x8e\x2f\xc7\xde\
\x76\x63\x6a\x23\x87\x4f\x1b\xb1\x02\x1f\xaa\x58\x76\x35\x80\x6d\
\xc1\xf2\x74\x8f\x57\x30\x7b\x2c\x2a\x36\x5e\x63\xa4\x1e\x45\xac\
\x64\x70\xf2\xff\xbe\x58\xa9\xe7\xf0\x42\xcd\xb2\xfa\xd1\x67\x3d\
\x66\x95\xe4\x1c\xc0\x72\xfc\x0a\xfc\x1b\x67\xe0\x59\x93\x5c\xd5\
\x2d\x70\x30\x64\xb0\x20\x59\xe2\xf3\x8a\x28\xcd\xa8\x35\xb5\xe4\
\xef\xf3\xe3\x5b\x9a\xe8\x8e\x8d\xea\x9a\x16\x27\x79\x8b\xb1\xce\
\x31\x78\x28\xce\x9f\x5f\xdc\x1f\x0f\x77\x9d\x6a\x61\xc8\xf1\x4f\
\x55\x2d\x70\x30\x6d\x15\x9c\xd2\x15\x46\xed\xdd\x1f\x16\x58\xa8\
\x17\x97\x4f\x70\x3b\x7c\x7f\xcd\xfc\xbd\xd1\x83\x33\x1f\x1b\xf4\
\xe1\x01\xcc\xc1\xae\xb1\x07\x78\x59\x03\x00\x8e\x46\x33\xb1\x1a\
\x9f\xc4\x16\xa7\xe1\x7e\x9c\x1d\x87\x5d\xe3\xe8\x0f\x6c\x92\x8e\
\x56\x44\x64\x66\x0a\x11\xe5\xbd\x75\xdc\x60\x19\x20\x85\xcf\x7b\
\x8d\x96\x1e\x01\x8b\xf0\xd3\xaa\x43\xbc\x0c\x70\x50\xb3\xb0\x5a\
\xcb\x41\x02\x2e\xc0\x0d\x19\x60\x5d\xcd\xc6\x2a\x2d\x53\x93\xe7\
\xe7\x7b\x19\x60\x5d\xcd\xc1\x5d\x5a\x91\xcc\x35\xb8\x24\x03\xac\
\xab\x73\x71\x6b\x3a\xbb\x09\x5f\xcc\x00\xeb\x6a\x59\x74\x69\x14\
\x9d\xc9\xcf\x71\x4e\x06\x58\x57\x5f\xc3\x77\x12\xa7\x5f\xc7\x0f\
\x3c\x03\xac\xa5\xef\xe2\x42\x14\xcb\x93\xd7\x0e\xf5\x0d\x64\x80\
\x55\xf4\xa5\xae\xb3\xf3\x33\xc0\x3a\xda\x44\x5c\x34\x25\x4e\xfc\
\x2e\xca\x00\xab\xea\xc5\xd8\x75\x6c\xd3\x52\xec\x1e\x38\x4f\x11\
\x6a\xc8\x00\x4b\xb5\x13\x0b\x15\x8b\x95\x8b\x20\xff\x62\x9d\xcb\
\xdf\x33\xc0\x11\xb4\x2b\xe2\x2a\x9c\xfd\x1b\x22\xca\x9d\x79\x18\
\x53\x45\xbb\x15\xd1\xe3\x3f\xa3\x70\xf9\x7f\x4a\x11\x3f\xc9\x03\
\xe9\x52\xed\xc1\x57\xf1\x20\x11\xda\x1c\x25\x41\xae\x0c\xb0\x53\
\x97\x29\x56\x16\x16\x9f\xeb\x3c\x45\x88\x35\x3b\x13\x2a\xe9\x2a\
\xfc\x24\xb5\x80\xe7\x2a\x96\x0b\xcb\x00\xab\xe8\x26\xc5\xa6\xb4\
\x62\xdd\xec\x52\xfc\xb1\xea\xa5\x19\xe0\xdd\x69\xbe\x1b\x14\xab\
\x27\x56\xd7\xb9\xbc\x5a\x50\xe9\x61\x9c\x32\x81\x21\x1c\x82\x53\
\x47\x71\xdd\x1a\x5c\x9c\xce\xbe\x81\x5f\x8c\xf5\xa3\x35\x23\x2e\
\x7c\x52\xcd\x98\x70\x5b\xf0\x9b\xae\x05\x98\x57\x8d\x16\x50\x99\
\x05\x6e\xc4\xef\x27\xb0\xed\xf5\xa9\x1f\x11\xe6\x49\x9c\x27\x78\
\x53\x0b\x37\xe3\xea\xc9\xda\x82\xf5\xd5\xb6\xc0\x27\x04\x33\x92\
\xe5\xdd\x63\x1f\x17\x58\x4d\xae\x4e\x64\x33\x3e\x83\x97\xb5\x62\
\x67\x71\x81\x2a\x7b\x50\x32\xc0\x38\xaf\x58\xa8\xd8\x96\x58\x74\
\x8b\x4b\x87\x7a\x56\x32\xc0\x6a\x9e\x95\xa7\x14\xc1\xf3\x5d\x63\
\x51\xf4\x3b\x1f\xe0\x2e\x7c\x16\x7f\x41\xb1\x65\x76\xc1\xde\x3c\
\x2b\x19\xe0\x70\x9e\x95\x65\x78\x9c\xe8\x14\x98\x3b\x92\x67\x25\
\x03\x1c\xea\x59\xb9\x10\xbf\x4d\x2d\xe0\x5c\xf5\x97\x0f\x4f\xe2\
\x61\xcc\xf2\xae\x6d\x12\x1f\xcb\xa8\xea\x00\xfc\x56\xd7\x96\x86\
\x39\x19\x53\x1d\x80\x2b\xba\x76\x26\x9d\x93\x11\xd5\x01\x78\x47\
\x82\x37\xa0\x61\xdb\xba\xc6\x1f\xe0\x4a\xc1\x94\x04\xf0\xeb\x19\
\x4d\x1d\x80\xba\x3c\x2b\x57\x67\x2c\xa3\x01\x58\xa4\x5b\x32\x92\
\xd1\x03\xdc\x67\xcf\xca\x64\x06\xb8\x5a\xb1\x7a\x2a\x6b\x14\x00\
\xd7\x38\x40\xff\xe2\xe4\x9d\xa8\xde\x0c\x2f\x2b\x2b\x2b\x2b\x2b\
\x2b\x2b\x2b\x2b\xab\x81\xfa\x3f\x62\xdc\x0c\x6d\x17\x60\x15\xa5\
\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x0c\xee\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\x00\x00\x00\x00\x00\xf9\x43\xbb\x7f\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x01\x1e\
\x04\x08\x25\xa0\x5a\x89\x7b\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x0c\x49\
\x49\x44\x41\x54\x78\xda\xed\x9c\x7b\x70\x54\xd5\x19\xc0\x7f\xe7\
\xde\xbb\x9b\xcd\xee\x66\x93\x4d\x02\x79\x10\x20\x81\x10\x5e\xe1\
\x51\x62\x04\x14\x95\xaa\x88\x50\x8b\x20\xb5\xb5\x2f\xb5\x56\xad\
\x74\x5a\xdb\xd2\x6a\x6b\x55\x6a\x5b\xeb\xb4\xa3\xed\x4c\x7d\x8c\
\xd6\x22\xda\x76\x5a\xb1\xa5\xd5\x5a\x1f\x28\xbe\x5a\xab\x80\xa0\
\x68\x84\x00\x81\x40\x5e\xe4\xfd\xd8\x4d\xf6\x9d\xdd\x7b\xfb\xc7\
\xbd\x1b\x90\x82\x24\xe4\x6e\x12\xd6\x7c\x33\x3b\xbb\x7b\x67\xf7\
\xdb\x73\x7f\xfb\x9d\xf3\x7d\xe7\x3b\xe7\x3b\x30\x2a\x49\x29\x63\
\xcf\x94\x86\xca\x23\xb0\x4d\x0b\x81\xed\x80\x13\x78\x6d\xd4\x96\
\x06\x26\x5f\x06\x7a\x01\xcd\x78\xdc\x39\x8a\xa4\x7f\x22\x80\xbb\
\x01\x15\xd0\x52\xec\x4e\xed\x18\x88\xb7\x8e\xe2\xf9\x78\xb1\x03\
\x7f\x07\x34\x21\x84\xb6\xe2\xc6\xdb\xb5\x7b\x9e\xae\xd0\xae\xfc\
\xce\x3d\x9a\x90\xa4\x38\xc4\xef\x8e\x8e\x81\x27\x96\x02\x60\x33\
\x70\x91\xd5\x66\xe7\x9a\x3b\x1e\x62\xf6\xa2\x4b\x01\xc8\x2b\x2c\
\xc1\x95\x35\x96\x7d\x3b\xde\x00\x58\x0a\xb4\x01\x3b\x46\x01\x1e\
\x95\x32\xe0\x15\x60\x5a\x66\xee\x78\xae\xff\xf9\x06\xc6\x97\xcc\
\xfa\xc8\x07\xc6\x4d\x9a\x8e\xd3\x9d\xcd\xfe\x9d\xff\x11\xc0\x72\
\xa0\x11\x78\x6f\x14\x20\x7c\x0e\x78\x16\xc8\x9a\x54\x5a\xce\xb5\
\xeb\x1e\xc6\x3d\x36\xff\xc4\x26\x5a\x3c\x93\x54\xa7\x8b\xaa\x5d\
\x6f\x09\xe0\x32\xa0\x06\xf8\xe0\x93\x0a\x50\x00\xb7\x01\x8f\x00\
\xd6\xf2\x25\xab\xf9\xc2\xda\x5f\x61\xb3\x3b\x3f\xf6\x4b\xe3\x4b\
\x66\x63\xb5\xa5\x72\xf0\x83\xad\x02\xf8\x2c\x70\x10\xf8\xf0\x93\
\x06\x30\x05\x78\x02\xf8\x9e\x90\x24\xb1\xec\xea\xef\xb1\xf4\xab\
\xdf\x45\x92\xfb\xd7\x84\x89\xd3\xe6\x22\x2b\x16\xaa\x3f\xdc\x2e\
\x01\x2b\x81\x4a\xe3\xf1\x89\x00\x38\x06\x78\x09\x58\x6e\xb5\xa5\
\x6a\x5f\xfa\xc1\x7d\xa2\xec\xa2\x55\x03\x56\x52\x38\x63\x1e\x1a\
\x1a\x87\xf7\xec\x94\x80\x55\x86\x15\xee\x4b\x76\x80\xb3\x80\xd7\
\x81\xd2\xf4\xec\x5c\xae\xff\xd9\x7a\x51\x34\xf3\xac\xd3\x56\x36\
\xa9\xb4\x9c\x68\x34\x42\xed\xde\x5d\x32\x70\x85\xe1\x54\x0e\x24\
\x2b\xc0\x15\xc0\x73\x40\x4e\xc1\x94\x59\xdc\x70\xf7\x06\x32\x73\
\x0a\x06\xad\xb4\x78\xf6\x02\xc2\x41\x3f\x75\xfb\x3f\x90\x0d\x87\
\xb4\x03\xa8\x4e\x36\x80\xdf\x07\xd6\x03\xa9\x73\xce\x5f\xce\x57\
\x6f\xbb\xff\x94\xce\x62\x40\x10\xe7\x2e\x24\xd8\xe3\xa5\xe1\xc0\
\x6e\x05\x58\x0d\x6c\x03\x0e\x27\x03\x40\xab\xe1\x65\x7f\x04\x48\
\x4b\xbe\xfc\x6d\x3e\x73\xdd\xad\xc8\xb2\xb9\x3f\x25\x84\xa0\x64\
\xde\x22\xfc\xde\x4e\x8e\x1c\xdc\x63\x31\x2c\xf1\x4d\xa0\xee\x4c\
\x06\x98\x0d\x3c\x03\xac\xb6\x58\x6d\x7c\x61\xed\x2f\x99\xbf\xf4\
\xf3\x08\x21\x12\x13\x13\x09\xc1\xd4\xb2\xf3\xe8\x6e\x6f\xa1\xf1\
\xf0\x3e\x0b\x70\x25\xf0\x6f\xa0\xfe\x4c\x04\x58\x82\x9e\x7e\x2a\
\x73\x65\xe5\xf0\xb5\x75\x0f\x33\x65\xee\xc2\xc4\x07\x96\x42\x30\
\xb5\xec\x7c\x3a\x5b\x8e\xd0\x5c\x5b\x65\x35\x2c\xf1\x55\x63\xd6\
\x72\xc6\x00\xbc\xd0\x98\x96\xe5\xe7\x4f\x9e\xc1\xd7\xef\x7a\x94\
\xb1\xe3\x27\x0d\x5d\x74\x2e\x49\x4c\x2f\x5f\x4c\x7b\x63\x2d\x2d\
\x75\x07\x6d\x06\xc4\x97\x81\xe6\x33\x01\xe0\x1a\xe0\x49\x20\x75\
\xe6\x82\x8b\xb9\xfa\xf6\xfb\x71\xb8\xdc\x43\xee\x0d\x85\x24\x31\
\x7d\xfe\xa7\x69\xad\xab\xa6\xad\xe1\x50\xaa\x01\x71\x33\xd0\x32\
\x52\x01\xca\xc0\x83\xc0\x5d\x80\x74\xc1\x15\xd7\xb1\x72\xcd\x3a\
\x14\xc5\x32\x6c\x41\xad\x24\x49\xcc\x98\x7f\x21\x4d\x35\x55\xb4\
\x37\xd6\xd8\x0d\xef\xfc\x3c\xd0\x3e\xd2\x00\xa6\x03\xff\x04\xae\
\x92\x15\x85\x2b\x6f\xfe\x05\x8b\x56\x5c\x9d\x30\x67\x31\x20\x88\
\xb2\xcc\xcc\x05\x17\xd3\x70\x70\x0f\x9d\xcd\xf5\x0e\x03\xe2\x73\
\x40\xc7\x48\x01\x58\x0c\x6c\x01\x16\x38\x5c\x6e\xbe\xf6\x93\xdf\
\x31\xb5\xec\xbc\x91\x94\x61\x42\x92\x65\x4a\x17\x2e\xa1\xe1\xc0\
\x87\x74\xb6\x34\x38\x8d\x69\xdf\x3f\x81\xae\xe1\x06\xf8\x69\x63\
\x5c\x29\xcc\x99\x30\x85\x1b\xee\xde\x40\xce\x84\x62\x46\xa2\xc8\
\xb2\xc2\xcc\x85\x17\x53\xbb\xf7\x7d\x3c\x6d\x8d\x2e\x23\x01\xf1\
\x0c\xe0\x19\x2e\x80\xd7\x01\x4f\x01\x69\xd3\xce\xba\x80\x6b\xef\
\x7c\x08\x67\x7a\x26\x23\x59\x64\xc5\xc2\xac\x73\x96\x70\xb8\xf2\
\x5d\xbc\xed\xcd\xe9\xc0\xe5\xc0\x3f\x80\x6e\xd3\x9c\x57\x3f\x21\
\xff\x02\xf8\x21\xc0\xa2\xcb\xaf\xe1\xd2\x01\xa4\xa1\x46\x82\x84\
\x02\x3e\x1e\xff\xe9\x4d\xd4\x57\x55\x80\x9e\x4b\xbc\xc0\xac\x38\
\xf1\x54\x00\x9d\xc0\x9f\x81\x15\xb2\xa2\xb0\xe2\xc6\xdb\x29\x5f\
\xb2\x9a\x33\x51\x42\xfe\x1e\xd6\xff\xe4\x06\x1a\xab\x2b\x41\x4f\
\x81\x2d\x36\x23\xc4\xf9\x38\x80\x05\xc0\x0b\xc0\x2c\x87\xcb\xcd\
\x55\x3f\xb8\x97\xc9\xb3\xce\xe6\x4c\x96\x40\x8f\x97\xc7\xd6\x5d\
\x4f\x53\xcd\x7e\xd0\x93\xb1\x8b\xd1\x17\xab\x4c\x07\xb8\x00\xf8\
\x17\x90\x9d\x9d\x5f\xc8\x35\x77\x3c\x48\x56\xde\x84\x11\x03\xc2\
\xdb\xd1\x82\xb7\xad\x99\x98\x1a\x25\x1c\xf0\x9f\xf0\x33\x8a\xc5\
\x8a\x62\xb1\xfe\xdf\xf5\xa0\xbf\x9b\x3f\xdd\x73\x73\xfc\xad\x0f\
\x28\x1c\x4c\x88\x73\x22\x80\x37\x00\x8f\x1e\x7b\x21\x65\x80\x69\
\xa8\x70\xc0\x87\x3d\x2d\x83\x8b\xbf\xf8\x4d\x16\x2c\xbb\xca\x74\
\x80\x3f\x5e\x35\xdb\x4c\x75\x15\x46\x74\xd1\x79\x3a\x5f\x56\x8e\
\x1b\xef\x1e\x06\xbe\x72\x22\x20\x03\xef\x2e\x1e\xc6\x4d\x9e\x91\
\x10\xeb\x3b\x89\x3c\x7f\xdc\x7b\x1b\xfa\x3a\xcc\xb1\xf7\x1a\x35\
\x9e\x1d\x40\x9e\x91\x3d\x12\xc0\x6f\x80\x1b\x81\xc8\x60\x00\x46\
\x80\x6f\x19\x8f\xb8\x75\x6a\xa7\x71\x8f\x13\x80\x0a\x8b\xd5\xc6\
\xb8\xc9\x33\x4d\x07\xd8\x5c\x53\x05\x80\xbd\xa8\x9c\x58\xc0\x43\
\xb8\xe5\x00\xc0\xd9\x0c\xd3\xa2\xfb\xf1\x00\x23\x26\xe8\x9c\x03\
\x30\x79\xce\x82\x84\x84\x3a\x2d\x75\x07\x75\xf3\xca\x29\xa6\x6b\
\xe7\xdf\xe3\x97\x87\x6d\x61\x49\x4a\x80\xce\x05\x00\x13\x4a\x66\
\x27\xa4\xc1\xed\x47\x6a\xf4\x86\xdb\xd2\xd0\xa2\x11\x80\x56\xa0\
\x27\x99\x00\x9e\x05\x50\x50\x52\x9a\x90\x06\x77\x34\xeb\x19\x7b\
\x21\xf7\x75\x9e\xc3\x0c\xa3\x48\x09\x18\x12\xe6\x00\x14\x24\x60\
\xfc\x03\x68\x33\x2c\x50\xc8\x7d\x69\xb3\x9a\x64\x02\x38\x15\xb0\
\x65\x8c\xc9\xc3\xe6\x48\x33\xbd\xb1\xbd\xe1\x10\x3e\x4f\x07\x08\
\x09\xd4\x58\xfc\x72\x63\x32\x01\x9c\x01\x90\x5b\x38\x35\x21\x8d\
\xed\x6a\xd5\x59\x59\x32\xf2\x88\xfa\xfa\x72\xa4\x75\xc9\x04\xb0\
\x18\x20\x3b\x41\xb3\x16\x9f\x57\x8f\x75\x2d\xae\x1c\xa2\xbe\xbe\
\xb8\xb7\x25\x99\x00\x16\x01\x64\xe6\x16\x24\xa4\xb1\xdd\x9d\x3a\
\x2b\xc5\x35\x86\xa8\xaf\x6f\xf6\xd5\x9c\x4c\x00\x27\x02\xa4\x67\
\xe5\x24\xa4\xb1\x7e\xc3\x02\x15\xbb\x9b\x58\xc0\xdb\xe7\x98\x93\
\x09\x60\x3e\x40\xc6\x98\xfc\x84\x65\x53\x00\x64\x7b\x3a\xb1\xa0\
\x37\xee\x45\x7a\x92\x09\x60\x3a\x90\x10\x0f\x0c\x10\x0e\x06\xf4\
\x46\xa7\xa6\xa1\x86\xfd\xaa\x71\xd9\x93\x4c\x00\x5d\x80\xa9\x9b\
\x88\x3e\x12\xc6\x44\x42\x7a\xa3\x2d\x76\xd4\x68\x38\xde\xf6\x60\
\xd2\x59\x60\xaa\xd3\x95\x90\xc6\x86\xfc\x7a\x6f\x95\x6d\x0e\x50\
\x63\xf1\x89\x76\x28\x99\x00\x26\x54\x34\x4d\x33\x9e\xd5\x11\xd3\
\xa6\x33\x0a\x60\x5c\x84\x64\x49\x5a\x80\x1a\x80\x1a\x8b\xf1\x49\
\x11\xc5\x64\x7d\x1e\xc0\x1d\x0e\xfa\x13\x32\x0e\x5a\x52\x6c\x00\
\xa8\x91\x00\x42\xb6\xa0\xc5\x7a\x01\xca\x87\x60\x1c\xac\x04\x62\
\x43\x01\xb0\x0d\x70\xf7\x78\x3a\x12\x02\xd0\x9a\x92\xaa\x03\xec\
\x0d\x22\xa5\x38\xb4\x58\xc0\x23\x80\x77\x86\xc0\xd0\x4e\x9a\xf1\
\x36\x1b\x60\x0b\x50\xe2\xf3\xb4\x33\xb6\xa0\xc8\xf4\xbb\xb0\xa7\
\xa5\x03\x10\x0b\x78\x91\x6d\x69\x22\x16\xf0\x20\x64\x45\x53\xd2\
\xf3\x02\x68\xaa\x8a\xa6\xc6\x40\x08\x24\x49\x16\x42\x92\x11\x92\
\x24\x84\x24\x23\x49\x32\x9a\xa6\xa1\x69\xaa\xa6\xa9\x2a\x9a\xa6\
\x22\x84\x24\x24\x59\x46\x48\xff\x97\x36\x37\x96\x09\x8e\x95\x3f\
\xa3\x6f\x20\x4d\x38\xc0\x3a\x80\xce\xe6\x06\x26\x95\x96\x27\x0e\
\xa0\xbf\x13\xd9\xe1\x86\xce\x7a\x0a\xaf\x7f\x5c\xd8\x27\xcc\x71\
\xf4\xc7\xf7\xf4\x77\xcc\x6f\x7e\xfe\x5e\x3a\xde\xfe\x13\xae\xd2\
\x4b\xe8\xde\xfd\x32\x20\x7a\x4e\xb6\x3c\x64\xb6\x13\x39\x00\xd0\
\xda\x70\x28\x21\xfd\xc8\x99\x9e\xa5\x07\xd4\xde\x16\x14\xe7\xd1\
\xd7\x66\x8b\xda\x1b\x8c\xbb\xfb\xbe\x69\xf8\x50\x79\xe1\x0a\x38\
\xba\xf0\x63\xb6\xb8\x73\xc6\xe9\xd0\x3c\x8d\xaa\x25\x23\x4f\x7f\
\xdd\x6d\x7e\x32\x26\xea\xef\x3a\x36\xa8\x00\x34\xef\x50\x01\xdc\
\x09\x50\xbb\x77\x57\x5f\xd0\x6b\xa6\x64\xe6\x8e\xd7\xc7\xa8\xf6\
\x5a\xcd\x9a\x59\x60\x8c\x57\xe6\xd7\xd7\x44\x7b\xda\x0c\x03\xec\
\x1b\xe1\x3a\x87\x0a\x60\x3d\x50\x1f\x09\x05\xe2\xfb\x4f\x4c\xee\
\xc2\x99\xa4\x3a\x5d\x68\xbd\x21\x59\x4a\xd1\xe7\xdb\xe1\x36\xf3\
\xd7\x94\x7a\x3d\x8d\x27\xba\xaf\x21\x9b\x89\xbc\x0c\x50\xf5\xde\
\x5b\x09\xe9\xc6\xf9\x45\xd3\x8d\x5e\xa5\x4f\xe7\x42\x4d\xfb\xd0\
\x54\xf3\xa6\x76\x6a\x24\x40\xb4\xa7\x1d\x24\x05\xb5\xb7\x2f\xbc\
\x3c\x34\x94\x00\x5f\x04\xd8\xb3\x75\x4b\x42\x00\xc6\x97\x4b\x23\
\x9d\xf5\x28\xe9\x39\x68\xbd\x21\xc2\x6d\xe6\x75\xe3\xe0\x11\xbd\
\x82\xd6\x96\x53\x4c\xa4\xa3\x6f\xb9\x65\xdf\x50\x03\xf4\x1f\xa9\
\xae\xa4\xa3\xc9\xfc\x82\xa1\x89\x53\xe7\x02\xe0\x3b\xb8\x55\x73\
\x14\xea\x55\x9f\xfe\x43\xe6\xed\xea\x08\xd4\xe8\x27\x0a\xd8\x72\
\x4b\xe2\xc3\x43\x94\x8f\xa9\x90\x4f\x04\xc0\x00\xf0\x37\x80\x1d\
\x2f\x6f\x32\x5d\x79\x51\x69\x39\xb2\xa2\x10\x6a\xdc\x8b\x2d\x7f\
\x1a\x00\x3d\x95\xe6\x9d\xcf\xe3\x3b\xf0\xb6\xfe\x42\x56\x40\x8d\
\x82\x90\x2a\x87\x32\x8c\x89\xcb\xef\x01\xb6\x6d\xde\x48\x24\x14\
\x30\x55\x71\x4a\xaa\x9d\xa2\xd2\x72\xd0\x34\xa1\xc5\xa2\x20\x24\
\x02\xb5\xbb\x88\x06\xbc\x83\xf7\xbe\xbe\x0e\x02\xb5\xef\x21\x64\
\x05\x11\x8f\x01\x35\xf5\x95\xe1\x48\x67\xbd\x0d\xbc\x1d\x09\x05\
\xd9\xfa\xe2\x46\xd3\x95\x97\x2e\x5c\xa2\x5b\xde\xde\xd7\x43\x8e\
\xc9\xf3\xd1\x62\xbd\x78\xdf\x7f\x6e\xd0\x7a\xbb\x76\x3e\xad\x7b\
\xfb\x92\xf3\x8e\x5a\xa2\xbe\xd1\x74\xc8\x01\x82\xbe\x31\x9d\x37\
\x36\xad\x27\xe8\xef\x36\x55\xf1\xec\x73\x97\xa2\x58\x53\x08\xd6\
\x57\xd8\xec\x13\xe7\xe9\x81\xda\xf6\xa7\x06\x15\x7b\x6a\xb1\x5e\
\x3a\xb7\x3d\xa9\x5b\xf9\xd8\x49\xf4\x7a\x1a\x11\xd6\x54\x1f\x7a\
\x09\xed\xb0\x00\x7c\x01\x78\x23\x1c\xf0\xf1\xfa\x5f\x1f\x35\x55\
\xb1\xcd\x91\xc6\xdc\xf3\x96\xc7\xbd\xb1\x6a\xc9\xc8\x23\xd2\x5e\
\x83\xb7\xe2\x85\xd3\xd6\xd9\xf9\xce\x26\xa2\x3d\x6d\x58\xc7\x14\
\x11\xe9\xd0\x9d\x9f\x6c\xb5\xff\xe1\x64\x69\xac\xa1\x00\x08\xb0\
\x16\x50\xff\xfb\xec\x1f\x69\x3c\xb4\xd7\x54\xc5\x8b\x56\x5e\x8b\
\x10\x02\xef\xae\x67\x45\xfa\xec\x65\x00\xb4\xbe\xf4\x5b\xd4\x48\
\xf0\xb4\xc6\xbe\xd6\x2d\xf7\x03\x90\x3e\x7b\xb9\x9e\x40\x10\x42\
\x8d\xfa\x3a\xee\x3d\xd5\x77\x13\x5d\xec\xd1\x0c\x64\x01\xf3\x0f\
\x56\x6c\xa3\xec\xa2\x55\x28\x16\x73\xd2\xf1\x0e\x97\x5b\x2f\x6f\
\xad\x3d\x20\x24\x5b\x9a\x26\x14\xab\x88\x74\xd4\x11\x0b\x78\x48\
\x9b\x76\x41\xff\xbb\xae\xaa\xd2\xb0\xf1\x16\xc2\xad\xd5\xd8\x27\
\xce\x23\xe6\xeb\xd0\x63\x4c\x67\xd6\x26\x35\x12\x5c\x3f\xdc\x00\
\x41\xaf\x20\x5f\x19\xf4\x75\x8f\xed\x68\xaa\xa3\xf4\x9c\x25\xa6\
\x15\x25\x16\x4c\x29\x65\xc7\x96\x4d\x5a\xb0\xa5\x5a\x64\xcc\xbd\
\x8c\x50\x63\x25\xc1\x86\xdd\x28\x0e\x37\xa9\x05\xfd\xdb\x9f\xd8\
\xf4\xcc\xcf\xe8\xfe\xf0\x25\x64\x7b\x06\xee\xf2\xd5\x74\x6d\x7f\
\x0a\x24\x39\xa4\x86\xfd\xcb\xd0\x77\xf1\x0f\x3b\xc0\x28\x7a\x31\
\xf6\x35\xad\xf5\xd5\x29\x9a\xaa\x9a\x56\x6f\x62\xb3\x3b\xb1\x39\
\x5c\x62\xff\xbb\x6f\x12\x6a\xda\xab\x66\xce\xbf\x4a\x04\xeb\x2b\
\xf0\x55\xbd\x89\x50\xac\xd8\x27\x7e\xea\xa4\x7f\x96\x1a\x09\x72\
\x64\xd3\x9d\x78\x76\x3d\x8b\x90\x15\x72\x2e\x5d\x4b\xcb\xe6\xfb\
\xf4\x29\xa2\xa6\xdd\x8c\x7e\x54\x0b\x23\x01\x20\xe8\xfb\x57\x2a\
\x81\xcf\xd7\x54\xbe\x2b\x39\x33\xb2\x28\x28\x36\x67\x03\xe6\xb8\
\xe2\x99\xb4\x35\x1c\xa2\xa5\xb6\x4a\x44\xda\x6b\x34\xf7\x59\xab\
\x44\xb0\x61\x37\xfe\xea\xed\x74\xef\x79\x15\x6b\x76\x21\x96\x8c\
\xfc\x3e\x90\xb1\x70\x80\xae\x9d\x9b\xa8\x7b\xe2\x26\x42\x8d\x7b\
\x91\xac\x76\x72\x96\xad\xa5\xed\xb5\x47\x50\xc3\x7e\xd0\x0b\x12\
\x6f\xe9\xef\xef\x0f\x75\x81\xef\x1a\xe0\x21\x40\x5c\x7e\xd3\x9d\
\xcc\x5f\x7a\xa5\x29\x4a\x23\xa1\x00\x1b\xee\xfa\x06\x75\xfb\x3f\
\x40\x4a\x71\xe2\x3e\xfb\x73\x74\xbd\xb3\x09\x35\x7c\xb4\x07\x2a\
\xe9\x39\x10\x8b\x1e\xbb\xab\x8b\x94\x9c\x29\x64\x2d\xba\x9a\x96\
\x17\x7f\x4d\x2c\xe0\x01\x78\x17\xbd\x7a\xa9\xdf\x75\x1d\x43\x5d\
\x31\xb8\x13\xf0\x02\x4b\xf7\xef\xfc\x8f\x90\x14\x85\xa2\x19\x65\
\x83\x56\x2a\x2b\x16\x4a\xcf\xb9\x84\xfa\xaa\x0a\xad\xb3\xa9\x46\
\x04\xeb\xde\x27\x6d\xfa\x62\xec\x13\xe6\x12\x0b\xf6\xa0\x86\xba\
\x51\xc3\xfe\x3e\x0f\x6d\x2f\x2c\x23\xfb\xfc\xeb\x90\x6c\x4e\x5a\
\x5f\x79\x10\x4d\xbf\xbe\x1d\x58\xc2\x00\x37\x2b\x0d\x57\x89\xf9\
\x1a\xe0\x01\x40\x2e\x99\xb7\x88\x95\x6b\xd6\x91\x91\x9d\x3b\xf8\
\xc1\xb6\xb7\x97\x2d\x7f\x79\x80\x37\x9f\x79\xa2\xef\x9a\xab\xf4\
\x12\xe4\x54\x17\xb2\xc3\x8d\x10\x02\x21\x5b\x08\xb7\x1e\xc2\x5b\
\xf1\x62\x9f\x23\x46\x3f\xba\xe0\x16\x20\x3c\xd0\xdf\x1c\xce\x1a\
\xfd\x15\xe8\xab\x5d\x4e\x49\x56\xf8\xd4\xe2\xcb\x38\xf7\xb3\x5f\
\x21\x77\x62\xc9\xa0\x15\x1f\xa9\xae\x64\xcb\x5f\x1e\xe4\xc0\xae\
\xb7\x4e\x35\x3b\x79\x0b\xfd\xa0\xdb\xd7\x4f\xdb\xfa\x87\x11\xe0\
\x7e\x03\x60\x91\xa6\xa9\xd3\x9a\x0e\xef\x63\xfb\xe6\xbf\xb2\x7b\
\xeb\x2b\xf4\x74\xb5\x21\x49\x12\x8e\x74\x37\xf2\x00\x0f\xb1\x88\
\x45\x7b\x09\xf4\x78\xb1\x58\x53\xf0\x77\x77\xd1\xdd\xd9\x7a\xfc\
\x47\x9e\x44\x3f\x86\x6f\x0d\x7a\x89\x57\xcd\x60\x6e\x62\xf8\x4f\
\x89\xd0\x65\x16\xf0\x0d\xf4\x63\x90\x33\xfa\xa6\x49\x92\x4c\x66\
\xee\x78\xb2\xf2\x27\x90\x91\x9d\x87\x23\xdd\x4d\x4a\xaa\x03\x49\
\x92\x90\x64\x85\x70\x30\x40\xb4\x37\x4c\x77\x47\x2b\x3d\x5d\x6d\
\xb4\x37\xd5\xd1\xd1\x58\x7b\x22\xfd\x15\xc0\x46\xe0\x31\xf4\xc2\
\x1c\xd3\x64\xa4\x00\x8c\x4b\x2a\xfa\x81\xb3\x4b\xd1\xb7\x6c\xcc\
\x61\xe0\x6b\xd7\x1a\xfa\x49\x6e\xdb\x8c\xac\xd0\x16\xf4\x2a\xf5\
\x84\xc8\x48\x03\x78\xbc\xd8\x81\xe9\xc0\x24\x20\x07\xfd\x20\x47\
\xb7\x01\x55\x43\x3f\xfb\x20\x64\xc4\x99\x75\x40\xad\x01\xcf\xc7\
\xa8\x8c\xca\xa8\x8c\xca\xa9\xe5\x7f\xa2\x3a\x37\xce\x5b\xef\x21\
\x51\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x05\x80\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\x86\x00\xaf\x00\xd2\x7d\x1c\x57\xe8\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x01\x1e\
\x04\x26\x06\x09\x3a\xf1\x25\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x04\xdb\
\x49\x44\x41\x54\x78\xda\xed\x9c\x6d\x50\x54\x55\x18\x80\x1f\x59\
\x50\x57\x67\x31\xfc\x40\xcd\xd0\x9d\x9c\x50\x69\x74\x9c\xc5\x89\
\x69\x24\x3f\x28\x3f\xca\x14\xcb\x74\xd2\xc0\x01\x93\x48\x0c\x6d\
\x92\xc8\xc8\x64\xc1\xd0\x19\x3f\x83\xc8\xc0\x19\x81\x41\xc3\xfc\
\x2c\xb5\x41\x21\x75\x14\x9d\xb1\x31\xf9\xa1\x53\x3a\x36\x16\xe9\
\x90\xe3\xa4\x86\x19\xe0\xc2\xc2\xde\x7e\xec\xdd\xe2\x1f\x7b\xd6\
\xdd\x80\xe5\x7d\x66\xee\x8f\xfb\xe3\x9e\xb3\xfb\xec\x3d\xe7\x7d\
\xef\x7b\xcf\x59\x10\x04\x41\x10\x04\x41\x10\x04\x41\x19\x43\x17\
\xff\xfc\x21\x80\x03\x68\xed\xa8\x0f\x10\xd0\xc5\x05\x3e\x09\x1c\
\x02\x7a\xca\x58\xf0\x8c\x48\x40\x03\x8e\x00\x81\xa2\xc3\x73\x81\
\x1a\xb0\xcb\x0f\x46\x54\x87\x0a\xd4\x80\xcf\x44\x89\x87\x02\x0d\
\x81\x41\x2e\x89\x56\xd1\xa2\x28\xf0\xf1\x91\x11\x5a\xdc\xea\x4f\
\xb5\x1e\x01\x01\x2e\x89\xa9\x12\x85\x15\x89\x88\x8a\x61\xde\xf2\
\x2c\xd7\x69\x2e\x10\x2f\x02\x15\xb1\xc4\xc4\x32\x6b\x49\x3a\x40\
\x0f\xa0\x08\x98\x23\x02\x15\x99\x38\x3b\x8e\xa9\xf3\xdf\x42\x4f\
\x6b\xf6\x02\x93\x45\xa0\x22\xd3\x16\xbd\x43\xd4\xcc\x05\x00\xbd\
\x81\xa3\xfa\x5c\x29\x02\x55\x98\x9d\x94\xc1\xd8\x89\x33\x00\x4c\
\xc0\x31\x60\xb4\x08\x54\xf9\x62\x01\x01\x2c\x78\x77\x3d\xa3\x22\
\x9f\x03\x18\x04\x54\x00\xc3\x45\xa0\x02\x86\xc0\x20\x16\xbe\xbf\
\x19\xf3\x18\x0b\xba\xbc\x0a\x5d\xa6\x08\x74\x97\x9e\xbd\x8c\xc4\
\x7f\x94\xc7\x50\xf3\x28\xf4\x61\x7c\x0c\x08\x16\x81\x0a\x18\xfb\
\x06\x93\x90\x59\xc0\x80\xa1\xc3\x5d\xc9\xf7\x61\xc0\x28\x02\x15\
\x30\x3d\x36\x80\x25\xd6\x42\x82\xfb\x87\x02\x4c\xd1\x53\x9c\x40\
\x11\xa8\x40\x48\xe8\x30\x12\xad\x85\x18\x4d\xfd\x00\x66\x03\xc5\
\x7a\xd2\xed\x31\xed\xfd\x02\x6f\x03\x6f\x74\xf2\x67\x61\x25\x06\
\x87\x8d\x24\x61\xcd\x76\x76\x66\x26\xd1\x6c\x6b\x8c\x03\xfe\x04\
\x56\xfa\x4a\xa0\x19\x88\xf6\xb7\x3b\x31\x2c\x7c\x2c\xf1\x1f\xe6\
\x52\xb2\x2e\x85\xd6\x16\xfb\x0a\x5d\x62\x96\x2f\x04\x02\x30\x6a\
\xc2\x24\x26\xbf\xb2\xa4\xf3\x46\x5a\x63\x1f\xe5\x6b\x46\x8e\x8b\
\xe2\xf5\xb4\x4d\x94\x6d\x7c\x0f\xcd\xe1\xb0\x02\xf7\x80\x7c\x9f\
\x08\x34\x8f\xb1\x60\x8e\xb0\xf8\xdd\x9c\xf8\x74\x54\x0c\xaf\xa6\
\x58\x39\x98\xbf\x16\x20\x0f\xa8\x03\xbe\x94\x20\xa2\x32\x89\x3e\
\x3f\x97\x97\x12\xd2\xd0\x83\x49\x09\xf0\xb2\x08\x54\x24\x3a\x76\
\x31\x53\xe6\x2d\x75\x8d\xc8\x7d\xc0\x24\x11\xa8\xc8\xf4\xb8\x15\
\x3c\x33\x63\x3e\x7a\x82\x7d\x14\xb0\x88\x40\x45\xe6\x24\x65\x30\
\x2e\x7a\x26\xfa\xa3\x5e\x39\x10\x2e\x02\x55\xe6\x33\x83\x81\xd7\
\x56\xe4\x10\x6e\x89\x06\x18\x0c\x54\x02\x4f\x88\x40\x95\xb4\x24\
\x28\x88\x45\xe9\x5b\x18\x31\x7a\x3c\xc0\x08\xe0\x3b\x60\xa0\x08\
\x54\xc9\x2b\x7b\x19\x59\xbc\x26\x9f\x21\xe6\x70\xf8\xaf\x82\x63\
\x12\x81\x0a\x18\xfb\x06\x93\xb8\xb6\x80\xfe\x43\xc2\x00\x26\xe0\
\xac\xe0\xf4\x16\x81\x0a\x98\x42\x06\xf2\x66\xd6\x0e\x4c\x21\x83\
\x00\xa6\xe2\xac\xe0\x18\x44\xa0\x02\x21\xa1\xc3\x48\xcc\x2c\xf8\
\x37\x50\x03\x5f\x88\x40\x45\x7e\xa8\x3c\xd0\xf6\xf4\x2b\x11\xa8\
\xc0\x89\x3d\x9f\x73\xbe\x7c\x0f\x40\x33\xf0\x02\x70\x4a\x04\xba\
\xc9\xb9\xc3\xa5\x9c\xda\x57\x08\xce\x15\xb0\x0b\x80\x93\x12\x44\
\xdc\xa4\xfa\xe4\x37\x94\x97\x6c\x06\xe7\x62\xa5\x44\x3d\x0a\x4b\
\x1a\xe3\x0e\x3f\x9e\x3f\xc1\xa1\xed\x56\xd7\xe9\x4a\x9c\x8b\x37\
\x25\x91\x76\x87\xeb\x97\xbe\x67\xef\xd6\x74\x34\x87\x03\x20\x93\
\x76\x16\x6d\x8a\xc0\x36\xdc\xbc\x76\x89\x5d\x1b\x56\xd2\xda\xd2\
\x02\xb0\x0d\xc8\x96\x62\x82\x9b\xdc\xbe\xf1\x33\x25\xeb\x96\x63\
\x6f\x7a\x08\xce\xc2\xea\x2a\xb7\x0a\x10\xa2\x0e\xee\xde\xba\x41\
\x91\x35\x19\x5b\xc3\x03\x70\x6e\x9b\x58\xaa\x07\x0f\x11\xd8\x1e\
\x7f\xdd\xbd\x4d\x91\x35\x99\xfa\xfb\xf7\x00\x4e\x00\x0b\x51\xd8\
\xb8\xe3\xd6\x4b\xa5\x33\x07\x77\xa2\x69\x5a\xa7\x16\x11\x19\x13\
\x8b\x29\x64\xa0\xd2\x35\x0d\x0f\xea\x28\xca\x4a\xe6\xfe\x9d\x5b\
\x00\xe7\x81\xb9\x7a\xc2\x8c\x57\x05\xda\x1a\xff\xa6\x72\x77\x6e\
\xa7\x16\xf8\xd4\xf8\x67\x95\x04\xda\x1a\xeb\x29\xc9\x5e\xc6\x9d\
\xda\x1a\x80\xcb\xc0\x2c\xa0\x41\xb5\xdf\xf6\x04\x9e\x76\x77\x2e\
\xe8\x40\x56\xab\x5e\x60\x6f\xb2\xb1\x6b\x7d\x2a\xbf\xff\x72\x05\
\xe0\x3a\x30\x03\xe7\x2b\x4d\xbc\x2d\xf0\xb8\x7e\x74\x66\xa6\xa1\
\xb0\xc4\xa3\xb5\xc5\x4e\xd9\xe6\x34\x6a\x7e\xaa\x06\xa8\xd5\xaf\
\xbf\xed\x69\xe7\xdd\x2a\x88\x38\x1c\x0e\x0e\xe4\x7d\xcc\xb5\x8b\
\x55\x00\x77\x81\xe9\xc0\x6f\x8f\xd2\x66\xb7\x12\x78\x64\x47\x0e\
\x97\xce\x96\x03\x3c\x00\x5e\x04\xae\x3e\x6a\x9b\xdd\x46\x60\xc5\
\xee\x5c\x2e\x54\xec\x07\x78\x08\xc4\x02\x17\xbd\xd1\x6e\xb7\x10\
\x58\xf5\x75\x31\x67\x0e\xee\x04\xb0\xe3\x2c\x4b\x9d\xf6\x56\xdb\
\x7e\x2f\xf0\x42\xe5\x01\x8e\x97\x6e\x03\xe7\xce\xf6\x04\xe0\x5b\
\x6f\xb6\xef\xd7\x02\x2f\x9f\x3b\xce\xe1\xc2\x4f\x5c\xa7\xcb\x81\
\x32\x6f\xf7\xe1\xb7\x02\xaf\x55\x9f\x65\x7f\x6e\x86\xab\x2c\x95\
\x01\x14\xf8\xa2\x1f\xbf\x14\x58\x73\xa5\x9a\xb2\x8d\xab\x5c\x65\
\xa9\x4d\xc0\x06\x5f\xf5\xe5\x77\x02\x6f\xfd\x7a\x95\xd2\x9c\x54\
\xec\xcd\x36\x80\x1d\xc0\x07\xbe\xec\xcf\xaf\x04\xfe\x51\x5b\x43\
\x71\xf6\x32\x9a\x1a\xeb\xc1\xf9\x12\x3c\xa5\x0b\x3c\x8a\x76\x38\
\x17\x01\x6d\x51\xfa\x56\xad\xdf\x80\xc1\xae\x1d\xeb\xe5\xc8\x5f\
\xa1\xa8\x09\x6c\x73\x54\x01\x7d\x44\x8b\xfb\x5c\x6f\x23\xaf\x1a\
\xe8\x27\x4a\xd4\x68\x7b\xf7\x85\x8a\x0e\xcf\x86\x70\x1d\x3e\xd8\
\x0b\xdc\x5d\xa2\x70\x3d\xce\xa5\x67\x37\xe5\x5e\xf2\x8c\x70\x51\
\x20\x08\x82\x20\x08\x82\x20\xfc\xdf\xfc\x03\x73\x7b\x4e\x1e\xbb\
\xf0\x15\x2f\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x07\x91\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\x00\x00\x00\x00\x00\xf9\x43\xbb\x7f\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x01\x1e\
\x05\x07\x25\x26\x00\xff\x83\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x06\xec\
\x49\x44\x41\x54\x78\xda\xed\x9b\x79\x50\xd4\x55\x1c\xc0\x3f\xc2\
\x72\xa9\xa1\x28\x0a\x8a\x72\x88\x2c\x57\x2a\x2c\x68\x24\x1e\xe5\
\x68\x65\x65\x69\x35\x8d\xa2\xa9\x89\xd3\x54\x1e\x33\x4d\x5a\x8a\
\x62\x92\x4e\x69\x9a\xe2\xa8\xe8\x40\x1e\x59\x96\x95\x67\x56\x6a\
\x78\x60\xda\x68\xd7\xa4\x42\xa3\x99\x59\xe3\x81\x18\x10\x90\x22\
\xb0\xb2\xbb\xfd\xb1\x6f\x8d\x96\x45\xfd\xed\xc5\xb2\xf3\x3e\x33\
\x3b\x0c\xbf\xc7\xbe\xfd\xfd\x3e\x7c\xdf\xf5\x7d\x6f\x41\x22\x91\
\x48\x24\x12\x89\x44\x22\x91\x48\x24\x12\x89\x44\x22\x91\x48\x24\
\x12\x67\xe0\xe9\xe6\xcf\xe7\x05\x0c\x01\x46\x03\xc5\x40\x85\xfc\
\x97\xdf\x99\x6e\xc0\x64\x60\x2b\x50\x09\x18\xc4\xab\x1e\xd8\x04\
\xa8\xa5\xa2\xff\xa3\x02\x06\x01\x6f\x01\xa7\x1a\x08\x33\x00\x86\
\xa0\xd0\x28\x43\x2b\x0f\x0f\x83\x87\xa7\xaa\xa1\xc8\xcd\x40\xac\
\x3d\x3e\xbc\x55\x0b\x95\x16\x0c\x3c\x06\x0c\x07\x86\x02\xed\x4c\
\x05\xde\xbe\x7e\x44\xf6\x4e\x21\x26\x79\x10\xea\xc4\x54\xda\x05\
\x06\x03\x50\xf1\xd7\x65\x0e\x6f\x5b\xc7\x4f\x07\x77\xa2\xab\xaf\
\x07\xd0\x8b\x28\x5d\x08\x14\xba\xbb\x40\x15\xd0\x1f\x78\x44\xbc\
\x12\x1a\xde\x7b\xa7\x90\x70\xa2\x93\x06\x11\x9d\x34\x90\xb0\x58\
\x0d\x2a\x2f\xaf\x26\x2b\xaa\x2c\xbd\xc2\xe1\xed\xeb\xf9\x71\xff\
\x76\x74\xf5\x37\x11\x51\xb9\x43\x88\xfc\xd9\x9d\x04\x06\x37\x10\
\x36\x0c\xe8\x70\x6b\x64\xf0\xf1\xa3\x67\x9f\x14\xd4\x89\xa9\xa8\
\x35\xa9\x04\x74\x0e\x51\x5c\x79\x55\xf9\x55\xbe\xd9\xb1\x81\x1f\
\xf2\xb7\x51\xaf\xad\x33\x89\xdc\x0d\x2c\x00\x7e\x6c\x89\x02\x3d\
\x81\x7e\xa2\x59\x3e\x0a\x68\xcc\xa3\x4c\xad\x19\x88\x3a\x31\x95\
\xf0\xf8\x24\xbc\xbc\x7d\xec\xf2\xa1\xd7\x2a\xca\xf8\x66\xe7\x06\
\xbe\xdf\xb7\x95\x9b\x75\x35\xa6\xcb\x7b\x80\x37\x81\xe3\xae\x2e\
\xb0\x13\xf0\x30\xf0\x78\xa3\x28\xf3\xf6\x25\xe2\xde\x64\xa2\x35\
\x03\x89\xe9\x3b\xc8\xaa\x28\x53\xc2\xf5\xca\x72\x8e\xee\xda\xc4\
\xf1\xbd\x5b\xd0\xd6\xde\x12\x99\x2f\x44\x1e\x75\x15\x81\x9e\x42\
\xd8\x3c\xe0\x3e\x4b\x7f\x10\x14\xda\x13\xb5\x66\x00\x11\x71\x49\
\xa8\x9a\x88\xb2\xf6\x81\xc1\x04\x86\x84\x2b\xfa\xe0\x0b\x67\x4e\
\xb2\xfb\xbd\x45\xe8\xf5\xfa\xdb\xfe\x5d\x5d\xcd\x75\xfe\x2e\xb9\
\xd8\xa8\xc5\x03\x59\x62\xb0\x29\x02\x4a\x9c\x25\x30\x14\xc8\x01\
\x82\x44\x9f\xd6\x19\xf0\xb6\xa5\xc2\xce\xdd\x23\x99\xbc\x60\x1d\
\x6d\xdb\x75\xb8\xeb\xf7\x54\xfc\x55\xcc\x8a\xe9\xa3\xd0\xfe\xd7\
\x44\x6d\x61\x81\x08\x80\x5b\xa3\x9b\x23\x68\x0b\x0c\x06\xc6\x8a\
\xe9\x86\xdd\x50\x2a\xaf\xb6\xfa\x1a\x79\x73\x27\xd9\x4b\x9e\xc9\
\x59\x80\x69\x55\xe3\xe1\xa8\x2e\x05\xf8\x12\x78\xdb\x5e\x15\x06\
\x85\x46\x91\xb1\xb1\x40\x91\x3c\xbd\x4e\xc7\xfa\xac\x17\xa9\x2c\
\x2d\xb6\xe7\xb3\x15\x35\x5c\x12\xaa\x68\x01\xb4\xef\xdc\x95\xf4\
\x37\xf3\x14\xc9\x03\xd8\xba\x2a\x93\x4b\xbf\x35\x39\x47\xde\x6f\
\xe5\xed\x94\x98\x87\xa3\x23\xb9\x00\x3c\x6b\xc5\xfb\x02\x44\x3f\
\x13\xd2\xbe\x53\x17\xc6\xcf\x59\xa5\x58\xde\x81\x4f\xd7\x72\xa2\
\xe0\x0b\x4b\x45\x2f\x03\x6b\xec\xf5\x80\xae\x38\x91\xee\x0a\x1c\
\x04\xa2\x83\xc3\xd5\xa4\x67\xe5\xd1\xc6\x3f\x40\x51\x05\xbf\x1c\
\x3f\xc0\xe6\xc5\xaf\x58\x2a\x5a\x09\x4c\xb7\xe7\xcd\xba\x9a\xc0\
\x10\x21\x4f\xdd\x25\x22\x86\xf4\xf9\xb9\xb4\xf6\x6f\xaf\xa8\x82\
\x8b\x67\x4f\xb1\x76\xf6\x78\x0c\x8d\xa7\x2b\xbb\x81\x51\x80\xce\
\x5d\x05\x76\x13\xf2\xa2\xba\x44\xc4\x90\x9e\x95\x47\xeb\x7b\xda\
\x29\x5b\x9e\x95\x95\xb0\x7c\xfa\x28\xb4\x35\xd5\xe6\x45\xdf\x61\
\xcc\x0b\xde\x70\xc4\x22\xdd\x15\xe8\x0e\x1c\x02\x22\xbb\x46\xc6\
\x91\x3e\x3f\x17\xbf\xb6\xfe\x8a\x2a\xa8\xad\xbe\xc6\xda\xd9\x13\
\x2c\xc9\xfb\x13\x18\xe1\x08\x79\xae\x22\x30\x54\xc8\xeb\x11\x12\
\x19\xc7\xa4\xac\x5c\xfc\xda\x28\x93\xa7\xd7\xe9\xd8\xb8\x70\x0a\
\x55\x65\x57\x2c\xad\x20\x9e\x00\x4a\x1d\x75\xf3\x1e\x2e\x23\xaf\
\x67\x3c\xe9\x59\x79\x8a\xe5\x01\x7c\xb6\x22\x83\x0b\x67\x4e\x98\
\x5f\xd6\x02\x4f\x61\x43\xae\xcf\xd5\x05\x86\x01\x05\x40\x8f\x6e\
\x51\xbd\x48\x9f\x9f\x8b\x6f\x9b\x7b\x14\x57\x52\xb0\x6d\x1d\x27\
\x8f\xec\x31\xbf\x6c\x00\x26\x89\x3e\xd5\xa1\x34\x57\x13\x0e\x17\
\x91\x17\xde\x5d\xdd\x9b\xe7\xe7\xad\xb1\x4a\x5e\xd1\xb1\x7c\xbe\
\xfe\x70\x85\xa5\xa2\x45\x18\xd3\xf6\x0e\xa7\x39\x46\xe1\x08\x21\
\x2f\x2c\x34\xba\x0f\x13\x33\x73\xac\x92\x77\xf9\xfc\x69\x72\x66\
\x8e\xb1\x34\x5d\xd9\x0c\x3c\x27\xa2\xd0\xed\x04\xf6\x10\xf2\x42\
\xc3\x62\x12\x98\x90\x99\x83\x6f\xeb\xb6\x8a\x2b\xa9\x2a\x2b\x61\
\xf9\xb4\x91\x68\x6b\x1b\x0d\xac\x07\x31\x26\x64\xb5\xce\x7a\x20\
\x67\x0a\x8c\x14\xf2\xba\x87\xc5\x26\x32\x31\x33\x07\x1f\xbf\x36\
\x8a\x2b\xd1\xd6\xd5\xb0\x6c\xca\x13\xfc\x53\x7e\xd5\xbc\xe8\x1c\
\x90\x2c\x46\x5e\xa7\xa1\x72\xa2\xbc\x02\xa0\x5b\x78\xac\x86\x09\
\x99\x39\xf8\xf8\xb5\x56\x5c\x89\x5e\xa7\x63\xdd\x1b\x2f\x58\x92\
\x57\x2a\x22\xaf\xca\xd9\xfd\x91\x33\x46\xe1\xa8\x5b\xf2\xe2\x92\
\x98\x38\xcf\x3a\x79\x00\x9f\x66\xcf\xe6\xe2\xaf\x27\xcd\x2f\xdf\
\x10\x13\xe5\x73\xcd\x31\x1a\x3a\x5a\xa0\x5a\x34\x5b\xa3\xbc\xcc\
\xd5\x78\xfb\x5a\x27\xef\xf0\xf6\xf5\x9c\x3a\xba\xd7\xd2\x74\x25\
\x4d\x2c\xd5\x9a\x05\x47\x36\xe1\x68\xd1\xa9\x77\x8d\x88\x4f\x66\
\x42\xe6\x6a\xbc\x7d\xfc\xac\xaa\xa8\xf0\xdb\x7d\xec\xfb\x20\xdb\
\x52\x51\x06\xb0\xab\x39\x57\x02\x8e\x1a\x44\x62\x84\xbc\x2e\x3d\
\x7a\xf5\x63\xfc\x9c\x95\x56\xcb\x2b\xfe\xe3\x34\x39\x33\xd2\xd0\
\xeb\x1b\x25\x51\xd6\x60\xcc\xed\xe1\x6e\x02\x63\x85\xbc\xe0\xc8\
\xde\x29\x3c\x97\xb1\xc2\x6a\x79\x55\x65\x25\x2c\x9b\xfa\x64\xc3\
\xfd\x5a\x13\x9f\x8b\x65\x9a\xce\xdd\x04\xc6\x8a\x3e\x2f\xa8\x67\
\xc2\xfd\x8c\x9b\x95\x6d\xb5\x3c\x6d\x5d\x0d\xcb\xa7\x8d\xa4\xaa\
\xb4\x51\x82\xa0\x10\xb8\x1f\xa8\x76\x85\x34\x92\x3d\xfb\xc0\x38\
\x11\x79\x41\x51\x09\xfd\x19\x37\x2b\x1b\x2f\x1f\x5f\xab\x2a\xd2\
\xeb\x74\xe4\xcd\x4d\xb7\x24\xef\x12\xc6\x53\x0b\x2e\x21\xcf\x9e\
\xa3\x70\xbc\x29\xf2\x6c\x95\x67\xcc\xae\xcc\xe1\xf2\xb9\xa2\x46\
\x2d\x5a\xc8\xbb\x84\x0b\x61\x8f\x08\xec\x05\x1c\x00\x3a\x45\x25\
\xa6\x1a\xe5\xd9\x70\x6e\xe5\xd0\x67\x79\x9c\x3c\xf2\x95\xf9\x65\
\x1d\xf0\x0c\x0e\x4e\x4d\x35\x87\xc0\x3e\x18\xb7\x07\x03\xd5\x9a\
\x01\x8c\x9b\x95\x8d\xca\xcb\xfa\x83\x07\x45\xc7\xf6\x93\xff\xd1\
\x4a\x4b\x45\xd3\xb0\x7e\x1b\xd2\x65\x05\x26\x60\x3c\x7c\x13\x18\
\x9d\x34\x90\xb1\xaf\x67\xdf\xf6\x5c\xde\x1d\xb3\x2b\xbf\xff\xc2\
\xc7\x4b\x67\x5a\x2a\x5a\x84\x1d\xb7\x21\x5d\x65\x14\x4e\x10\x11\
\xd1\x31\x26\x79\x30\x69\xaf\x2d\xb3\x49\xde\xf5\xca\x72\x96\xbc\
\x38\x9c\x9b\x75\xb5\xe6\x45\x4e\x4d\x4d\x39\x4b\x60\xa2\x88\xbc\
\x8e\x31\x7d\x1f\x20\x6d\xe6\xbb\x36\xc9\xbb\x4d\x76\xc5\x61\x3b\
\x69\xcd\xd9\x84\x35\x42\x5e\x87\xd8\x7e\x0f\x32\x66\xc6\x52\x9b\
\xe4\x19\x0c\x06\x72\x33\x26\x36\x95\x9a\x1a\xe1\xea\xf2\x94\x0a\
\x4c\x12\xf2\x02\xe2\xee\x1b\xc2\xe8\x57\x97\xd8\x24\x0f\xe0\x93\
\xe5\xb3\x28\x3e\x7f\xda\xfc\xb2\x29\x35\x55\x4a\x0b\xe0\x6e\xe7\
\x81\xc9\xa2\xcf\x0b\x88\x4f\x19\x6a\x17\x79\xfb\xb7\xac\xe1\x54\
\xe3\xcd\x20\x2d\xf0\x34\xcd\x94\x9a\x72\x54\x04\x26\x8b\x79\x9e\
\xbf\x51\xde\x62\x3c\x55\xb6\xc9\x2b\x3c\x96\xcf\xc1\x4f\x2c\x0e\
\xac\x93\x80\x23\xb4\x20\xee\x14\x81\x29\x22\xf2\xfc\xef\xed\xff\
\x10\xa3\x67\xbc\x63\xb3\xbc\x0b\x67\x0b\xd9\xb2\xc4\xe2\x74\x65\
\x36\x4e\xda\x49\x73\xd6\x28\x9c\x02\x1c\x33\xfd\x32\x2c\x6d\x2a\
\x1e\x9e\xb6\xcd\xbb\xab\xff\xa9\xe0\xe8\xae\xf7\x2d\x15\xad\x05\
\x5e\xc2\x8d\x58\x84\xf1\x2b\x51\x06\x27\xbc\x0e\x60\xe3\xb9\x69\
\x57\xc3\x1b\xd8\xeb\x24\x79\x85\x34\xf8\x9a\x96\x3b\x31\xdd\x09\
\xf2\xca\x31\x1e\x69\x6b\xd1\x78\xd8\x79\x89\x77\xd7\xab\x37\x31\
\x51\xbe\xd4\xd2\x05\x36\x25\x2a\x18\xe3\x69\x51\x3d\x70\x4d\xfc\
\xb4\x95\x6a\x31\xcf\x6b\x05\xd4\xe1\x42\x49\x51\x89\x44\x22\x91\
\x48\x24\x12\x89\x44\x22\x91\x48\x24\x77\xcf\xbf\xad\x86\x46\x8a\
\xe2\xff\x93\x30\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
\
\x00\x00\x0c\xe6\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\x00\x00\x00\x00\x00\xf9\x43\xbb\x7f\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x01\x1e\
\x03\x34\x2b\x31\x5e\xcb\x06\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x0c\x41\
\x49\x44\x41\x54\x78\xda\xed\x9c\x79\x70\x14\x55\x1e\xc7\x3f\xdd\
\x3d\x77\x26\x99\xc9\x4c\x0e\xc8\x1d\x20\x10\x02\x22\x20\xc1\x08\
\xba\x78\x81\x82\x96\x8a\xa2\x82\xca\x2a\xde\xa5\x78\xec\xaa\xb5\
\x2a\xba\xde\xe8\x6a\x69\x81\xeb\x8d\xba\x02\xe2\xaa\x0b\x0a\x2a\
\x08\x78\x12\x05\x43\x40\x25\x31\xa2\xe1\x26\x04\x72\x91\x63\x92\
\xb9\x92\x39\x7a\xff\xe8\x9e\x80\x72\xe5\x98\x40\x20\xf3\xad\xea\
\x9a\xab\xba\x5f\xf7\x67\xde\x7b\xbf\xe3\xfd\xba\x21\xa2\x88\x22\
\x8a\x28\xa2\x88\x22\x3a\x36\x12\xba\xe8\xb8\x51\xc0\xc9\x40\x36\
\xd0\x07\x48\x05\x6c\x20\x58\x94\xdf\xe4\x68\xe0\x6a\xe0\x27\x20\
\x10\xf9\x1b\x40\x02\xce\x04\x9e\x47\x10\x8b\x00\x1f\x20\xb7\x61\
\x3b\xe9\x78\xbf\x70\x4d\x27\xf7\x4f\xd7\x98\xed\xf7\x05\x5a\xdc\
\xd7\xca\x2d\x1e\x33\x00\x72\x10\x44\x0d\xfa\xf8\x4c\x74\xf6\x34\
\x44\xad\x41\xfd\xda\xaf\x74\x78\x39\x48\x63\xc9\xca\x13\xa6\xe7\
\x74\x14\x60\x6f\x8d\xd9\x3e\xdb\xef\xaa\xbb\xcc\xef\xac\x15\x01\
\xb4\xd6\x24\xcc\x59\xa3\x90\xe5\x20\x04\xfc\x78\x2b\x37\xd1\xf4\
\xfb\x2a\x08\xfa\x4f\xe8\xa1\xd7\x5e\x80\x02\x70\x2b\xa2\xf4\x82\
\xdf\x59\x6b\x00\x88\x19\x3c\x0e\x9d\x3d\x95\xe6\xea\x6d\x34\xfc\
\xb4\x18\x39\xf0\x47\x60\x9a\xe8\x38\xb4\xd6\x24\x34\xd1\xf1\x68\
\xa2\x62\x11\xb5\x46\x6a\xd7\xcc\xef\x91\x00\xcd\xc0\x7c\xe0\x12\
\x82\x01\xcc\x59\xa3\x31\xa6\x0d\xc5\x51\xbc\xec\x0f\x43\xd2\x94\
\x3e\x1c\x73\xd6\x28\x4c\x19\xc3\x31\x26\xe7\x20\xea\x4c\x07\x1c\
\xc8\xb9\xb5\x80\xe6\xaa\xcd\x3d\x0a\xa0\x05\xf8\x0a\x38\x45\x90\
\x34\x24\x8c\xbb\x9b\xa6\x8d\x5f\x53\xf3\xd5\xcb\x6a\x2f\x8b\xc7\
\x96\x37\x85\xd8\x11\x13\xd1\x98\xed\x3d\xca\x7a\xb6\x05\xa0\x1e\
\x58\x01\x9c\x22\x45\xd9\x48\x38\xe7\x36\xaa\xbf\x7c\x89\x80\xbb\
\x01\x51\x1f\x45\xc2\xd8\x3b\xb1\x8d\x9c\x84\x20\x69\x8f\xe5\x75\
\xe8\x80\x96\xee\x0a\xf0\x39\xe0\x54\xc9\x64\x25\xfe\xec\x5b\xa8\
\x5c\xfa\x0c\x72\xc0\x8f\xb9\xff\xe9\x24\x5f\xf6\x44\x77\xe9\x71\
\x6f\x00\x7f\x07\xea\x8e\x76\xc3\xe2\x11\x7e\x3f\x0b\x98\x8e\x28\
\x91\x38\xfe\x1e\xaa\x57\xcc\x46\x0e\xf8\x89\x1d\x71\x19\x69\x53\
\x5f\xea\x4e\xc3\x75\x38\xf0\x0d\x60\xef\x6e\x3d\xf0\x09\x40\xb0\
\xe5\x4d\xa1\xf6\xfb\x79\x04\x5b\xdc\x58\x86\x4c\x20\x69\xe2\x23\
\x9d\x6b\x55\x0e\x06\x54\xe7\x3b\x5c\x0a\x39\xe4\x3b\xd4\xc8\xa7\
\xa6\x3b\xf4\xc0\x4c\x60\x34\x80\x3e\x2e\x9d\xe6\xaa\xcd\x88\x3a\
\x63\xe7\xe1\x29\xfc\xc2\x1d\xbe\xed\xdd\xcf\x53\xf8\x16\x48\xec\
\x0e\x00\x27\x02\x58\x86\x8c\xc7\x51\xbc\x1c\x80\x84\xf3\xee\x46\
\xd4\x19\x3b\xdf\xaa\x2c\x07\xc3\x7c\x1d\x15\xfb\xbd\xcf\x51\x21\
\x26\x1d\x6b\x80\x23\x00\xf4\x09\x7d\x70\xef\xf8\x11\x00\xeb\xb0\
\x8b\xc3\x94\xc2\x10\xc4\x30\x5f\x87\x0b\x60\xea\x83\x2f\xd2\x3b\
\x63\x00\x6a\x12\x63\x95\x9a\xc4\x38\x26\x00\x13\x80\x29\x00\x72\
\xc0\xa7\x4c\x96\x66\x3b\x92\xde\x14\x2e\x7e\xe1\x06\xe8\x07\x30\
\x46\xc5\x70\xc3\xe3\x6f\x92\xd4\x37\x07\xa0\x9f\x0a\x31\xe3\x58\
\x00\xbc\x61\xdf\x68\x93\xd5\x7c\x8b\x26\x7c\xad\x86\xbf\x07\xb6\
\x9e\x9c\x29\xda\xc2\x8d\x8f\xcd\x21\xb5\xff\x90\xd0\x3c\xbe\x0a\
\xe8\x7b\xb4\x01\x4e\x0e\xbd\x09\xb8\xea\x95\xbf\xd8\x51\x85\x1c\
\x0c\x86\x0b\xa0\xd0\x15\x3d\x30\x24\x43\x54\x34\xd3\x1e\x79\x8d\
\xf4\x81\xc3\x00\xd2\x54\x88\x03\x8e\x16\xc0\x7e\xc0\x90\x56\x80\
\x9e\x46\xb4\xb1\x29\xca\x44\xb3\x7d\x5d\x78\x5a\x0d\x06\xbb\x3c\
\x89\x6a\x30\x99\x99\xf6\xcf\x57\xc9\x1c\x34\x02\x20\x59\x35\x2c\
\x03\x8f\x06\xc0\xb1\x00\x29\x59\x83\x11\x04\x81\xc6\x92\x95\x98\
\xfb\x9e\x0a\x40\xe5\xd2\x67\xf7\x0d\xe9\xce\x19\xe1\xa3\x92\x85\
\xd6\x19\x4c\x5c\xfb\xf0\xcb\xf4\x3b\x39\x0f\xa0\x97\x0a\x71\x48\
\x57\x03\x1c\x05\x30\xfc\xac\x8b\xc8\x1a\x36\x5a\xe9\x85\xde\x26\
\x44\xbd\x99\xe6\xaa\xcd\xec\xcd\x7f\x3b\x0c\x6e\x4c\x30\xdc\x6e\
\x4c\x33\x80\xdf\x77\x60\x38\xac\xd3\x1b\x99\xfa\xe0\xbf\x43\xd7\
\x92\x00\x7c\x0d\x0c\xeb\x4a\x80\x79\x00\xe9\xd9\xc3\x18\x7b\xd5\
\x74\x00\x1a\x4b\x56\x12\x3b\x72\x12\x00\xd5\x2b\x67\x53\x57\xf0\
\x7e\x77\xeb\x81\xde\x43\x01\x04\xd0\xea\xf4\x4c\x7d\xe0\x45\xb2\
\x73\xcf\x44\x0d\xf7\xbe\x02\x72\xbb\x02\xa0\x39\x64\xb1\x12\x52\
\xfb\x90\xdc\x37\x87\x33\x2e\xb9\x0e\x80\xfa\xc2\x85\xd8\xf2\x14\
\xdb\x52\xf1\xe9\x4c\xf6\x2c\x7e\x9c\x60\x8b\xa7\xdb\xce\x81\x07\
\x98\x69\xad\x96\xab\xee\x7b\x9e\x41\x79\xe7\x02\xc4\x02\x5f\x84\
\x46\x5b\x38\x01\xf6\x05\x04\x7b\x52\x3a\x92\x46\x49\x4f\x8d\xbd\
\xea\x0e\xfa\x0c\xce\x95\x83\xcd\x4e\x1c\x45\xcb\x64\xfb\xa8\xa9\
\x08\x92\x96\xfa\x75\x0b\xd9\x32\xeb\x62\x1a\x8a\x96\x76\x60\x5e\
\x0c\xc3\x44\xda\x41\x88\x93\xef\x7d\x96\x21\xa7\x9f\x0f\x4a\x8e\
\x73\x05\x70\x46\x38\x01\xa6\x03\xc4\xf5\x4e\xfb\x43\xa3\xd7\x3c\
\x30\x5b\x48\x1b\x70\x32\x01\x4f\xa3\x50\x57\xf8\x41\xd0\x96\x37\
\x05\x7d\x62\x16\x3e\x47\x25\xbb\x3f\x7c\x80\x2d\xb3\x2e\xa6\x76\
\xcd\x02\xfc\x6e\x47\x1b\xdd\x18\x51\xe2\x18\x49\x92\x34\x5c\x71\
\xf7\xd3\x0c\x1d\x73\x61\x68\xc4\x2d\x07\xce\x09\x17\xc0\x34\x80\
\xe8\xd8\xf8\x03\x5c\x82\xeb\x1f\x7d\x9d\x93\x46\x8f\x43\xf6\xb7\
\x88\xb5\xab\xe7\xa1\xb5\xf6\x96\xe3\xfe\x72\x3d\x5a\x6b\x6f\x5a\
\xf6\xee\xa0\x72\xe9\xbf\xd8\xf4\xcc\xd9\xec\x78\xeb\x46\x6a\x7f\
\x78\x0f\x6f\xd5\xe6\x43\xdb\x8a\xf0\x45\x22\xd1\xea\x5c\x76\x41\
\xbb\x2e\x5a\x92\x98\x74\xc7\x13\x8c\x38\x67\x22\x80\x09\xf8\x14\
\x38\x2f\x1c\xe9\x2c\x3b\x40\x8c\x3d\xe1\xa0\x2e\xc1\xe4\x7b\x9e\
\x23\x73\x50\x2e\xcb\xe7\xbd\x20\x3b\x4b\xf3\x05\x67\x69\xbe\x6c\
\x19\x76\x91\xac\xb3\xa5\x8a\xee\x9d\x3f\xe1\xda\xba\x16\xd7\xb6\
\x42\x5c\xdb\x0a\x15\x4e\x5a\x03\x86\xde\xd9\xe8\xe3\x33\xd1\x27\
\xf6\x45\x1b\xd3\x0b\xad\x25\x11\xbf\xa3\x22\x14\x13\x1a\x0e\xe6\
\xc2\x01\x46\xc0\xaa\x02\xb2\xab\x2e\x48\xa2\xfa\x07\x27\xa9\xe1\
\x59\xa6\x6a\x55\x3b\xd6\x73\x24\x89\x89\xb7\x3f\x8a\xa4\xd5\xb2\
\x76\xf9\x87\x46\x60\x09\x70\x29\xb0\xac\x33\x00\x0d\xca\xb0\xd5\
\x1f\x32\x80\xc8\x1b\x7f\x25\xd9\xb9\x63\x84\x15\xf3\x67\x51\xfc\
\xdd\xe7\x82\xe3\xe7\x4f\x04\x00\x63\xea\x10\x6f\xc2\xd8\x3b\x0c\
\x82\xa4\xc1\xbb\xe7\x77\x5c\x3b\xd6\xe3\x77\x54\xe1\x29\xdb\x80\
\xa7\x6c\xc3\x01\x87\x52\x5f\x0b\x3b\x15\xd0\x68\x74\xe8\xec\xe9\
\xad\x0b\x54\x7a\x53\x54\xbb\x03\xa2\x8b\x6e\x9e\x81\x28\x4a\xfc\
\xb0\xec\xbf\x7a\xe0\x63\xe0\x4a\x60\x71\x47\x01\xc6\x00\xe8\x8d\
\x87\x4f\x1a\x58\xe3\x7a\x71\xe5\xdf\x9e\xe1\xac\xcb\x6f\xe1\xfb\
\xc5\xef\xb0\xe1\xbb\x65\x78\x76\x15\x1b\x3c\xbb\x8a\x41\x10\x64\
\x43\xd2\x40\xac\x43\x2f\x14\x74\xb6\x54\x10\x44\x82\xcd\x4e\x5a\
\xea\xca\xf1\x35\x54\xe0\x77\xd6\x12\x70\xd5\x13\xf0\x36\xc9\xc1\
\x66\x97\x10\x4a\x56\xec\xd7\x35\x02\xa2\x46\x1f\x14\xf5\x51\xa2\
\x64\xb4\x48\x92\xc9\x82\xc6\x6c\x47\x63\xb6\xa1\x31\xc7\x81\x28\
\x21\x07\x7c\xc8\x01\x3f\x41\x6f\x13\xde\xaa\x2d\xfb\xe6\x37\xb1\
\xfd\xf1\xba\x20\x08\x5c\x78\xe3\xfd\x48\x1a\x2d\xdf\x7f\x32\x4f\
\x07\x7c\x08\x5c\x05\x2c\xec\x08\x40\x01\x20\x18\x68\xdb\x62\x78\
\x42\x4a\x26\x97\x4e\x7f\x8c\x09\xd3\xee\xa5\x78\xf5\x0a\x4a\x7e\
\xf8\x82\xed\x25\xeb\x04\xef\xee\x8d\x78\x77\x6f\xdc\x77\x50\xad\
\x21\xa0\x8f\x4b\x17\xb4\xd6\x24\xd1\x98\x9c\x83\x14\x65\x43\x32\
\x59\x04\x51\x6b\x6c\x5d\xf6\x94\x83\x3e\x04\x41\x24\xe0\x75\x49\
\x41\x9f\x5b\x0a\x7a\x9a\x08\xb8\x1d\xf8\xdd\xf5\xf8\x1b\x6b\xf0\
\xec\xfe\x15\x5f\x43\x85\x52\xf9\x70\x08\x59\xe2\x7b\x75\x38\x34\
\x9f\x30\xed\x5e\x24\xad\x96\x55\x8b\xde\xd2\x02\xef\x03\x7f\x05\
\xde\x6b\x2f\x40\xbf\xe2\xa6\xb5\x2f\x50\x30\x44\x45\x33\x72\xdc\
\x24\x46\x8e\x9b\x44\xb3\xc7\xcd\xf6\x92\x75\xec\x2c\xdd\x40\xf9\
\xa6\x12\xf6\x6c\xff\x0d\x8f\xb3\x51\xf2\x56\x94\xe2\xad\x28\xed\
\xb4\xd5\x30\x5b\xed\xc4\x27\x67\x60\xef\x95\x46\x5c\x72\x06\x89\
\x69\xfd\xe8\x95\xd1\x1f\x8b\xbd\xf3\x49\xe8\xf3\xae\xb9\x0b\x49\
\xa3\xe5\xeb\x0f\x5e\x93\x80\x79\x80\x16\x98\xdb\x1e\x80\xf5\x00\
\xcd\x1e\x57\x87\x4f\x42\x6f\x34\x91\x9d\x3b\x86\xec\xdc\x31\xad\
\xdf\x39\x1d\x75\xd4\x55\xee\xa2\xbe\x6a\x37\x4e\x47\x2d\xee\x26\
\x07\xee\x26\x07\x2d\xcd\x1e\x7c\xcd\xde\x3f\xf4\x04\x43\x54\x34\
\x5a\x9d\x01\xbd\xd1\x84\x29\xda\x42\x94\xc5\x46\x8c\x2d\x11\xb3\
\xc5\x46\x6c\x42\x12\x5a\xbd\xa1\x4b\xdd\x9c\x73\x27\xdf\x86\x46\
\xa3\x63\xe5\x82\x17\x25\xe0\x3f\x28\x4b\xa6\x73\xda\x0a\xb0\x06\
\xc0\xe5\xa8\x0f\xeb\x49\x99\x2d\x36\xcc\x16\x1b\x69\x03\x4e\xe6\
\x78\xd0\x99\x93\x6e\x44\xd2\x68\xf8\x7c\xee\x0b\x02\xf0\xba\xda\
\x13\x5f\x39\xa8\x5f\x79\x10\x47\xfa\x72\xb3\xd5\xce\xd0\xbf\x4c\
\xa0\x27\x2b\x3d\x7b\x28\x46\x73\x0c\x9b\x7e\x5e\x2d\x00\x13\x00\
\x07\x50\x70\x24\x80\x46\xe0\x66\x01\x81\xd3\x2e\x98\x42\x4f\x57\
\x6a\xff\x21\x98\x63\xe3\x28\x5d\x9f\x2f\x00\xe7\x03\x1e\x60\xf5\
\xe1\x00\x3a\x80\x7f\x78\x5d\x4d\xe2\xe9\x97\x5c\xdb\x1a\x0f\xf7\
\x64\xa5\xf4\x1b\x44\x4c\x5c\x22\xa5\x3f\xe6\x83\x2c\x8f\x05\x82\
\x40\xfe\xa1\x00\xfa\x80\x8b\x65\x59\x4e\xca\x1a\x3a\x8a\xd8\x84\
\x24\x22\x82\xe4\x3e\x03\xb1\x25\xa6\xb0\x71\xed\x57\xa0\x54\x6b\
\x68\xd5\xbc\xe2\x41\xf3\x81\xeb\x00\xb6\x14\x15\x44\xc8\xed\xa7\
\x61\x67\x5e\x88\xde\x64\x0e\x7d\x9c\x1e\x0a\x23\x0f\x06\x70\x05\
\xc0\xc6\xb5\xdf\x44\xa8\xed\xa7\x82\xcf\x3f\xa0\xd9\xed\x0c\xf9\
\xca\xe3\x81\xea\xc3\x01\x6c\xa8\x2a\xdb\x4c\xe5\xce\x4d\x11\x72\
\xea\x68\xfc\x74\xce\x4c\x50\x0a\xe3\xaf\x03\x7e\x38\xd4\x1c\x18\
\x22\x9c\x0a\x8c\xf4\xfb\x5a\xc8\x19\x79\x56\x8f\x86\x57\x5d\xbe\
\x9d\xb7\x1e\xb9\x89\x80\xdf\x07\x30\x13\x98\x7d\xb8\x7c\x60\x48\
\xaf\x03\xfc\xfc\xed\x67\x34\xec\xad\xec\xb1\xf0\x9c\x8e\x3a\xe6\
\x3d\x35\x9d\x16\xaf\x1b\xe0\x23\xe0\xe1\x23\xf9\x81\xad\xe0\x81\
\xa1\xb2\x1c\xcc\xae\xd9\xbd\x9d\xa1\x63\x2e\xe8\x71\xf0\xfc\x3e\
\x1f\xef\x3e\x7d\x17\x7b\xb6\xfd\x06\xb0\x1e\xb8\x48\xf5\x52\xda\
\x04\x10\x75\x9c\xdf\x54\x5b\x51\xa6\x13\x35\x1a\x32\x73\x4e\xe9\
\x51\x00\x97\xbc\xfe\x24\xbf\x16\x7c\x09\x50\x8e\xb2\x56\x5e\xdb\
\x96\x50\xee\xcf\x4e\xf5\xaf\xc0\x15\xdb\x7e\x29\x14\xcd\xb1\x71\
\xa4\xf4\x1b\xd4\x23\xe0\x7d\xb7\xf8\x1d\x56\x7d\xf4\x36\x80\x1b\
\x25\xd5\x7f\xc8\x34\xd2\x91\x16\x77\x4a\xd5\x04\xc3\x84\xd2\xf5\
\xf9\x82\xd9\x6a\x3f\xe1\x21\xfe\x56\xf8\x0d\x1f\xbd\xf2\x58\xa8\
\xaa\xea\x6a\x94\x35\x64\x3a\x0a\x30\x34\xfe\x1d\xc0\x79\xa5\x3f\
\xe6\x0b\xc1\x60\x80\x3e\x83\x73\xbb\xa0\x3e\xe8\xd8\xab\x72\xe7\
\x26\xe6\x3e\x79\xbb\x1c\xf0\xf9\x04\x60\x06\x4a\xf1\x3a\x9d\x05\
\x88\x9a\x85\xa8\x06\xce\xdf\xb1\xf1\x47\xb1\x7a\xd7\x36\xfa\x0f\
\x3f\x1d\x8d\xf6\xc4\x89\x95\x9d\x8e\x3a\xe6\x3c\x74\x3d\xee\xc6\
\x06\x01\x58\x00\xdc\xd3\x96\xfd\xda\xb3\x3e\xbb\x1e\xd8\x00\x5c\
\x50\xbd\x6b\xab\xfe\x97\xd5\xcb\xc9\xc8\x19\x7e\xc0\x12\xe8\xf1\
\x6a\x71\xdf\x7e\xf4\x16\x6a\xca\xb7\x85\x3a\xcb\xa5\xfc\xa9\x64\
\x2e\x1c\x00\x43\x73\xe2\x47\xc0\xd9\x1e\x67\x63\x42\xe1\xca\x85\
\x34\x7b\x5c\xa4\xf4\x1f\x8c\x56\xa7\x3f\x2e\xe1\xc9\xb2\xcc\xc2\
\x17\x67\xb0\xf9\xe7\xd5\x00\x3b\x81\xb3\x81\xc6\xb6\xee\xdf\x91\
\x0a\x81\x5a\x94\x54\x77\x34\x90\x5b\x56\x5a\x24\xac\x5d\xfe\x21\
\x82\x28\x90\x94\x39\xe0\xb8\x4b\x81\x7d\xbb\xe8\x4d\xd6\x7c\xb6\
\x00\x15\xda\x58\x60\x7b\x7b\xf6\xef\x68\x89\x85\x1f\xa5\x24\xe2\
\x53\x60\x40\xc0\xd7\x92\xb1\xb5\xa8\x80\x35\x4b\x17\xe0\x75\x39\
\x89\x4d\x4c\xc1\x14\x6d\x39\x2a\x00\x82\x81\x00\xe5\x5b\x4a\xf8\
\xad\xf0\x1b\x52\xb2\x06\xb7\x6b\xdf\x5f\xd6\xac\x64\xc9\x6b\x4f\
\x82\x72\xd7\xfc\x64\xe0\xbb\xf6\xb6\x1f\x2e\x53\x3a\x41\xb5\x5a\
\xad\xd5\x4e\xc9\x7d\x73\x18\x74\xda\x58\xfa\x0f\x1f\x4d\xef\x8c\
\x01\x61\xb3\xda\x5e\x57\x13\xe5\x5b\x7f\xa5\x7c\x53\x09\x65\x9b\
\x8a\xd9\x5a\x54\x80\xaf\xc5\x8b\x29\xda\xca\x43\xf3\xf2\xdb\x7c\
\x9c\xf2\xcd\x25\xcc\x79\xe8\x7a\x7c\x2d\x5e\x80\x7b\x81\xe7\x3b\
\x72\x3e\xe1\xf6\x45\x46\x01\x37\x01\x97\xa3\x3c\x37\x01\x50\xca\
\x42\xd2\x07\x0e\x23\x31\xad\x1f\x09\x29\x7d\xb0\xf5\x4a\xc1\x6c\
\x8d\x23\xda\x6a\x47\x6f\x8c\x42\x94\xf6\x0d\x04\x8f\xb3\x11\xaf\
\xdb\x89\xd7\xd5\x44\x43\xcd\x1e\x1c\xb5\x55\xd4\x55\x96\xb3\xb7\
\xa2\x8c\xca\x1d\xa5\x34\xd4\x54\x1c\xb2\xf1\x99\x1f\x17\xb7\xe9\
\x24\x1d\x7b\x2b\x79\xf5\xfe\xa9\x34\xd6\x56\x01\xbc\xa9\x9e\x33\
\xdd\x01\x60\x48\x26\x94\x9c\xd9\x78\x60\x1c\xe1\xbd\x5f\xc3\x0b\
\x14\xa9\x5e\x41\x81\xfa\xbe\x58\x6f\x32\xf3\xc8\x82\x35\x47\xdc\
\xb9\xa5\xd9\xc3\x1b\x33\xa6\xb1\x67\xeb\x46\x50\xb2\xca\xe3\xe9\
\xc4\x9d\x9e\x9a\x2e\x02\xe8\x06\x16\xa9\x1b\x2a\xc0\x11\x28\xf5\
\xc9\x59\x28\x45\x42\x89\x40\x3c\x4a\x11\x91\xf0\xa7\x10\xb2\x51\
\x7d\xdd\xa3\x5a\xc6\xed\xc0\x16\x60\xa3\xea\x09\xec\xef\x62\xb4\
\x79\xb2\x95\x65\x99\xff\xcd\x9a\x11\x82\xb7\x05\xa5\x0e\xa6\x53\
\xb7\xc9\x76\x15\xc0\x3f\x6b\x97\xba\x7d\x7c\x2c\x2d\xee\xca\x77\
\x67\x87\x12\x04\x0e\x94\x92\xb8\xbd\x9d\x3d\xa6\x48\x0f\xd1\x86\
\x55\x4b\x43\x09\x82\x80\xea\x28\x87\x25\xdd\xde\x23\x00\x96\x95\
\x16\xb1\xe8\xa5\xd6\x5c\xe8\x1d\xea\xdc\x47\x04\x60\x1b\xd4\x50\
\x53\xc1\xfc\x99\x77\x12\xf0\xfb\x41\x29\xcf\x78\x35\x9c\xc7\x3f\
\xa1\x01\x36\x7b\x5c\xcc\x7d\x72\x3a\xae\xc6\x7a\x50\xaa\xf2\xef\
\x0c\x77\x1b\x27\x2c\xc0\x60\x20\xc0\x07\x2f\xdc\x4f\x55\xd9\x66\
\x50\x12\xc3\x97\xd3\x05\xcf\xe9\x3a\x61\x01\x2e\x9f\x3f\x8b\xdf\
\xd7\xaf\x02\x25\x21\x7c\x89\x6a\x79\x89\x00\x6c\x83\xd6\x7d\xb1\
\x88\xef\x97\xcc\x05\x65\x11\xe8\x4a\xd5\xe7\x23\x02\xb0\x0d\xda\
\xfa\x4b\x21\x9f\xbc\xf1\x54\xe8\xe3\xad\x28\x4f\xf3\x88\xe8\x30\
\xb2\x00\xb2\xde\x64\x96\xef\x79\xe5\x33\x39\x2a\x26\x36\xf4\x68\
\xbd\x67\x22\x68\xda\x01\x10\x90\xe3\x92\x32\x42\xf0\x96\x10\xde\
\xc7\xaa\xf4\x0c\x80\xea\x56\x8c\x72\x0b\x57\x44\x6d\x94\x75\x3f\
\x78\x35\x40\x4a\x04\x49\xc7\x7b\x60\x5e\x04\x47\xc7\x01\xde\x14\
\x41\xd1\x71\x80\xf3\x23\x18\x3a\x2e\x5d\xc4\x68\x44\xd4\x73\xf5\
\x7f\x57\x4a\x20\x48\x6a\x48\xa8\x3d\x00\x00\x00\x00\x49\x45\x4e\
\x44\xae\x42\x60\x82\
\x00\x00\x08\x2b\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\x00\x00\x00\x00\x00\xf9\x43\xbb\x7f\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x01\x1e\
\x05\x14\x19\x68\x80\xc2\x96\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x07\x86\
\x49\x44\x41\x54\x78\xda\xed\x9b\x7b\x54\x54\xd7\x15\xc6\x7f\xc3\
\xcc\xf0\x0e\x04\xd1\x80\x04\x4d\x82\x8f\x68\x12\xb0\xb5\x55\xb2\
\x5a\x5a\x69\xb2\x6a\x49\x5d\xe6\xa1\x56\x8d\x98\xa9\x5a\xb5\xb5\
\x9a\xda\x88\xf8\x08\x21\xcb\x36\xd6\x18\xac\x12\xc5\x28\xa9\x84\
\x20\x60\x50\x1a\xdb\x80\x29\x18\xd3\xa8\x01\xaa\x98\xe5\x23\x9a\
\x18\xc5\xc4\x18\x6d\x7c\x05\x09\x2f\x45\x60\x66\x98\xfe\x31\x17\
\x42\x2f\x03\x33\x73\x65\x06\x66\x3c\xdf\x5a\xfc\x31\xfb\xce\xfd\
\xe6\xdc\x8f\x73\xf7\xd9\x7b\x9f\x7d\x40\x40\x40\x40\x40\x40\x40\
\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\xc0\x65\xa0\x72\xa3\
\x67\x19\x0c\x24\x5a\xf9\x4e\x03\xd0\xd4\xc5\x75\x2d\xd0\x08\x34\
\x03\xdb\x80\x2f\x6e\x97\x89\x10\x04\x9c\x05\x4c\xdd\xf4\xf7\x5f\
\x20\xc4\x96\x1f\xd6\xb8\x81\x78\x9e\xc0\x3f\x80\x08\x80\x71\xb3\
\x12\xd1\x7a\xf9\x58\xfc\xa2\xbe\xe9\x26\x06\xbd\xde\xe2\xb5\xf7\
\x72\x5e\x6d\xff\xd1\x1b\x78\x08\xb8\x06\x18\xdd\x5d\xc0\x0c\x20\
\x36\x20\x38\x84\x79\xab\x73\x08\xec\x1b\x6a\x37\xc1\x9e\x6d\x1b\
\xda\x7f\x6c\x91\x74\x31\xd9\x72\xaf\x87\x8b\x8b\xb7\x0c\x78\x46\
\xeb\xe9\x8d\x2e\x29\x4d\x91\x78\x67\x8e\xfe\x87\xfd\x6f\x67\xc8\
\x35\xf1\x01\xae\x58\x9b\x7d\xae\x2e\xe0\x14\x60\x95\xca\xc3\x83\
\xa9\x09\xaf\x10\x76\xdf\x30\xbb\x09\x6a\xab\xae\x92\xf3\xf2\x1f\
\x2c\x5d\xd2\x01\x9f\xb9\xf3\x0c\x8c\x06\xde\x04\x54\x8f\xe9\x16\
\x31\x7c\xf4\xcf\xec\x26\x30\x1a\xf4\x6c\x4a\x9c\x86\xd1\xd0\xc1\
\x27\xbe\x0c\xe4\xdb\xca\xe3\x8a\x02\xde\x0b\xec\x02\x7c\xa2\xe3\
\x26\x13\xf3\x84\x4e\x11\x49\xd6\xca\xf9\xd4\x57\x57\x76\x70\x87\
\x40\xb2\x3d\x3c\xae\x26\x60\x20\x50\x08\xf4\x1b\x14\xf5\x30\xe3\
\x67\x2f\x57\x44\xf2\xef\xed\x9b\x38\x7b\xbc\x5c\x6e\x3e\x07\x4c\
\xb3\xc5\xef\xb9\xaa\x80\x6a\x60\x27\x10\x19\x32\x70\x08\xf1\x4b\
\xd6\xe2\xa1\x56\xdb\x4d\xf2\xc5\x89\x72\xf6\xee\x48\xb7\x14\x60\
\x4f\x04\xaa\xec\xe5\x73\x25\x01\xd3\x80\x47\xfd\x02\x82\xd0\x25\
\x6d\xc0\xdb\xef\x0e\xbb\x09\xea\xaa\x2b\xc9\x5e\xb9\xc0\xd2\xa5\
\xdf\x02\xc7\x94\x0c\xca\x55\x04\x5c\x0c\xcc\xd3\x78\x7a\x99\x74\
\x49\x69\x04\xdd\x75\xb7\xfd\x8b\x86\xd1\xc0\xe6\xc4\x78\x0c\xfa\
\x66\xf9\xa5\xf5\x40\xae\xd2\x81\xb9\x82\x80\x8f\x03\xab\x01\x26\
\x3d\xbb\x52\x35\x60\x68\x94\x22\x92\x9c\x55\x0b\xa9\xad\xba\x22\
\x37\x97\xd8\x90\x3f\xbb\xb4\x80\x23\x81\x3c\x40\x3d\x76\xfa\x42\
\xa2\x62\x7e\xa1\x88\x64\xff\xce\x0c\xce\x1c\x2d\x95\x9b\xbf\x06\
\x26\x03\x7a\x77\x15\x30\x1c\x28\x00\x7c\xbf\x1f\x3b\x9e\xd8\x89\
\xbf\x51\x44\xf2\xe5\xa7\x87\xd9\x93\x9b\x26\x37\x37\x03\xbf\x02\
\xae\xde\xea\x20\x7b\xab\x80\xbe\x40\x11\x10\x1e\x11\x39\x9a\xa7\
\x7e\xbf\x42\x11\x49\x7d\x4d\x15\x59\x2f\xcd\xb3\x94\xd6\xce\x07\
\xca\xbb\x63\xa0\xbd\x51\x40\xb5\xf4\xda\x46\xf6\x09\x1d\x40\xfc\
\x92\x75\x68\xb4\x5a\xbb\x49\x5a\x8c\x46\xd2\x97\x4e\xc7\xd0\xdc\
\x64\xa9\xf8\x90\xd1\x5d\x83\xed\x8d\x02\xae\x05\x1e\xf7\x0b\x08\
\x62\xe6\x8b\x9b\xf1\xf1\x0f\x50\x44\xb2\x2d\x65\x11\xd5\xdf\x5c\
\x94\x9b\x0f\x49\xb3\x0f\x77\x15\x70\x1e\xb0\x50\xad\xd1\xf0\x74\
\xe2\x5a\x82\xfb\x0f\x54\x44\x52\x5a\xb0\x95\x53\x1f\xed\x93\x9b\
\xbf\x01\x26\x49\xfe\xcf\x2d\x05\x8c\x93\x82\x65\x26\x2e\x78\x89\
\x88\x87\x7e\xa8\x88\xe4\xfc\xe9\x8f\x29\xde\xba\x4e\x6e\xd6\x4b\
\x8b\xc6\xd7\xdd\x3d\xe8\xde\x22\x60\x24\xb0\x1d\x50\xc7\x4e\x9a\
\xc3\xf7\xc6\x8c\x53\x44\x72\xbd\xf6\x5b\x32\x57\xcc\x05\x53\x87\
\x45\x23\x51\x8a\xf9\x70\x47\x01\xfb\x49\x2b\x6e\xe0\x88\x9f\xfe\
\x92\x9f\x4f\x5b\xa0\x88\xa4\xc5\x68\x24\x7d\x99\x0e\x7d\x53\x63\
\x07\x77\x28\x65\x1b\xb8\xa3\x80\xbe\x98\x4b\x53\xe1\xe1\x43\x22\
\x99\x30\xff\x4f\xa8\x54\xca\x36\x0a\xf3\xfe\xba\x98\x6f\xaf\x5c\
\x90\x9b\x3f\x06\xe6\x3a\xf2\x01\x7a\x52\x40\x15\x90\x03\x44\xf7\
\x09\x1d\x80\x2e\x29\x0d\xad\xa7\x97\x22\xa2\x83\x45\x79\x9c\x2c\
\xff\x40\x6e\xae\x02\x26\x48\x95\x16\xb7\x14\x70\x15\x30\xc1\xcb\
\xd7\x9f\x67\x96\xaf\xc7\x3f\xb0\x8f\x22\x92\x0b\x15\x27\xd8\x95\
\xb1\xba\x43\xed\x00\x88\xc7\x5c\xe3\xc3\x1d\x05\x9c\x05\x2c\x53\
\x6b\x34\x4c\x5f\x9a\x4a\xc8\xc0\xc1\x8a\x48\x1a\xea\x6a\x3a\x5b\
\x34\x92\x81\xf7\x9c\xf1\x20\x3d\x21\xe0\x23\xc0\x66\x80\xf1\x73\
\x9e\x67\x50\x54\xb4\xf2\x45\xe3\x79\x1d\xcd\x8d\x1d\xde\xd0\x9d\
\xad\xd5\x1b\x77\x14\x70\x08\xe6\x4d\x70\xcf\x31\x13\x66\x31\x7a\
\xec\x24\xc5\x44\x3b\x5e\x5d\xce\xb5\x8b\x5f\xc9\xcd\x9f\x01\x33\
\xb1\x71\x4f\xd7\xd5\x04\x6c\x0b\x57\x86\x8d\x8a\x65\xec\xf4\x85\
\x8a\x89\xca\x8b\xf3\xf9\xa4\x6c\xb7\xdc\x5c\x0b\x3c\x05\xd4\x3b\
\x73\x46\x38\x4b\xc0\xd6\xf6\x8b\xc1\xe1\x43\x22\x99\x9a\xf0\x8a\
\xe2\x70\xe5\xe2\xd9\x93\x14\x6e\xf9\x8b\xdc\x6c\x02\x66\x00\x67\
\x9c\xed\x8f\x9c\x21\xa0\x0a\xc8\x04\x62\x02\x82\x43\x88\x5f\xba\
\x0e\xcf\x4e\x7a\x57\xac\x2e\x1a\xf5\xb5\x64\x24\xcf\xb6\xb4\x68\
\xac\x04\xde\xe9\x89\xd5\xd0\xd6\xde\x98\x91\x40\x1f\xcc\xed\x5f\
\xf6\x56\x70\xff\x08\x8c\xf3\xf2\xf1\x33\xcd\x48\x7e\x4d\x15\x18\
\x1c\xa2\x68\xa0\x2d\x46\x23\x79\x6b\x16\xd3\x74\xf3\x86\xfc\x52\
\x31\xb0\xc2\x06\x8a\x07\x31\x37\x0d\x1d\xe9\x09\x01\x47\x48\xb3\
\x48\xd9\x14\x54\xa9\x98\xf2\xdc\x6a\x55\xe8\x3d\x43\x15\x0f\xb4\
\x28\x6b\x2d\x67\x3f\x39\xd4\xa6\xa7\xf4\xf6\xe8\x81\xe1\xc0\xe7\
\x9d\xdc\x76\x87\xe4\x7b\x5b\x71\x53\x8a\x0d\x77\x48\x85\x8b\x6a\
\x67\x08\x38\x13\x48\x69\x6f\x18\x14\xf5\xb0\x5d\x3f\x12\xf5\x93\
\x38\x86\x8d\x1a\xa3\x78\x90\x15\x47\x4a\x39\xf0\x6e\xae\x25\xd7\
\xa3\xc5\xdc\xa9\x60\x8f\x2f\x6e\xc0\xdc\xba\x66\xec\x2e\xff\x64\
\x0d\x99\x92\x88\x6d\x98\x9a\x90\x42\x54\x4c\x9c\xd3\xfc\x4c\x7d\
\xf5\x35\x4b\x45\x82\x0e\x38\x7d\xb8\x84\xfd\x3b\xb7\x70\xbd\xa6\
\xcb\xfd\xf1\x53\xc0\x6c\xcc\xc5\x55\xa3\x33\x04\x0c\x96\x5e\x91\
\xa0\x56\x83\x97\x8f\x1f\x2f\x64\x97\xa0\xd6\x68\xe9\x69\x18\xf4\
\xcd\x94\x15\x66\x53\x56\x90\x4d\x43\x7d\x8d\xb5\xaf\x7f\x04\xa4\
\x03\xd9\xce\x9c\x81\x00\x73\x80\xbf\xb5\x37\xfc\xe0\xd1\x27\x99\
\xb8\xe0\xcf\x3d\x26\x5c\x7d\xf5\x35\x76\x67\xa7\x72\xa2\x6c\xb7\
\xa5\x0e\x2b\x79\x5e\xfc\x4f\x20\x15\x38\xe0\x88\x10\xc3\xd6\x70\
\xe7\x20\x30\xba\xdd\xca\xc0\xa2\x8d\x85\xf4\x0d\xbb\xc7\xa9\xc2\
\x5d\xa8\x38\x41\xd1\x9b\x6b\xb8\x50\x71\xdc\xaa\xc6\xc0\x1b\xd2\
\x62\xf1\xa5\x23\x63\x34\x5b\x31\x52\x7a\x05\xda\x3a\x7a\xfa\xdd\
\x7d\x1f\xcf\x6d\x2c\x70\xb8\x68\x2d\x46\x23\x47\xf7\x15\xb2\x37\
\x3f\x9d\x9a\xca\xcb\x56\x35\x96\x44\xdb\x22\x65\x27\x0e\x85\x3d\
\xed\x4d\x97\x31\x77\xae\x8f\xfa\x2e\xb0\xad\x21\xb0\x6f\x28\x61\
\x11\xc3\x1d\x32\xb8\x9b\x37\xea\x78\xff\xad\x8d\xbc\xb5\x26\x81\
\x4f\x0f\xbe\x4f\x63\xc3\x75\x6b\xfe\x6d\x11\xe6\x8d\xa9\x32\xba\
\x3e\xce\xd0\x23\x33\x10\xe0\x4e\x29\x5d\x6a\x8b\xad\xb4\x5e\xde\
\xbc\x90\x5d\xaa\xb8\x18\x6a\x09\x95\x17\xcf\x51\xbc\x35\x95\x8a\
\x23\x25\x98\x5a\x5a\xac\xf9\xb7\x02\xcc\x5b\xa1\x07\xe8\x01\x28\
\x49\x48\x7f\x0d\x64\xb5\x37\x44\xc6\xc4\xf1\x74\x42\xca\x2d\x0d\
\xc4\x64\x32\x71\xfa\x48\x09\x7b\x72\x37\x70\xf5\xfc\xe7\xb6\xf8\
\xb7\x4c\x60\x83\x23\xfd\x9b\xa3\x04\x54\x61\xde\xe1\x8a\x69\x6f\
\x7c\x36\xf5\xef\xf4\xbf\xf7\x7e\xbb\xc9\x9a\x1b\x1b\x28\x2f\xce\
\xa7\xe4\x9d\x4c\x1a\xea\xac\x86\x21\x4e\xf5\x6f\x8e\x12\xb0\x35\
\xb5\x3b\xdc\x3e\x93\xb9\xf3\xae\x30\x96\xbc\xbe\xdb\x66\x82\x9a\
\xca\xcb\xec\xdd\xf1\x3a\xc7\x3e\xdc\x65\x2d\x0c\x69\xf5\x6f\xeb\
\x30\x17\x4b\x0d\xf4\x22\xa8\x15\xde\x77\x55\x0a\xb0\xdb\x72\xba\
\xc6\x1b\xf5\x78\xf9\xfa\x31\xf0\xfe\x11\x5d\xde\xf8\xd5\xa9\x63\
\xe4\xaf\x4f\xe2\x5f\x99\x29\x5c\x3a\x77\xaa\x2b\x1f\xd7\x1a\xbf\
\xcd\x05\x5e\x04\x4e\x4a\x39\x70\xaf\xc2\xad\x1c\x36\x0c\x00\x2a\
\x80\xb6\xd3\x2d\x6a\xad\x96\xa4\xac\x0f\xf1\xf6\xf5\x97\x65\x0b\
\x7a\x8e\x97\x16\xf1\xc1\xf6\xcd\xd4\x54\x5e\x72\x19\xff\xe6\x68\
\x01\xc1\xdc\xd5\xbe\xad\xbd\x61\xe8\xc8\x18\x66\x24\x6f\x02\xe0\
\x7a\x4d\x15\x65\xbb\x72\x29\x2f\xca\xb3\xb4\x77\x21\xc7\x79\x60\
\x63\x6f\xf2\x6f\xce\xfa\x07\xec\x43\x76\xda\xf1\xc9\xdf\x25\x9b\
\x1e\x88\x7e\xc4\xa4\x52\x79\xd8\x72\x32\xf2\x10\xe6\xbe\x15\x0d\
\xb7\x29\x1e\xc4\xdc\xf1\x64\xcf\x71\x52\x03\xf0\x36\xf0\x63\x04\
\x00\x58\x63\xa3\x70\x75\x52\x52\x1f\x21\x24\xfb\x7f\xf8\x4b\xa9\
\x5e\x67\xc2\x5d\xc2\x7c\x54\x21\x50\x48\xd5\x39\xa6\x74\xe2\xdf\
\x26\xdf\xce\xfe\xcd\x5e\xec\x91\xfc\xe1\x5e\xe0\x47\x42\x0e\xfb\
\x11\x06\xf4\x17\x32\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\
\x08\x08\xf4\x62\xfc\x0f\x26\xe8\x67\x77\xd3\x1a\x91\x04\x00\x00\
\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x0b\xf1\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
\x06\x62\x4b\x47\x44\x00\x00\x00\x00\x00\x00\xf9\x43\xbb\x7f\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\
\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x01\x1e\
\x04\x36\x20\x91\xf5\x66\x89\x00\x00\x00\x19\x74\x45\x58\x74\x43\
\x6f\x6d\x6d\x65\x6e\x74\x00\x43\x72\x65\x61\x74\x65\x64\x20\x77\
\x69\x74\x68\x20\x47\x49\x4d\x50\x57\x81\x0e\x17\x00\x00\x0b\x4c\
\x49\x44\x41\x54\x78\xda\xed\x9c\x79\x58\x55\x65\x1e\xc7\x3f\x17\
\x51\xd9\x65\x93\x4d\x45\x45\x05\x0d\xb1\x5c\xc2\x05\xd3\xd2\x34\
\x4d\x1d\xd3\x6c\xb1\xc5\x27\x9d\x56\xcb\x99\x51\x6b\x4a\xab\xf1\
\x19\x97\x0c\x5b\xa7\x66\xca\x9e\x71\x14\x4d\x0b\x9d\xb4\x5c\x92\
\xb2\xc5\x25\x4c\x71\x43\xdc\xc0\x1b\x21\x20\x20\x08\x5c\xe0\xb2\
\x5c\x2e\x97\x7b\xcf\xfc\x71\xcf\xb1\x5b\x79\xcf\xb9\xc0\x05\x6e\
\xcd\xf9\x3e\xcf\x7d\x9e\xf7\x9c\xf3\x2e\x87\xef\x79\xcf\xf9\x7d\
\x7f\xbf\xf7\xf7\x02\x2a\x54\xa8\x50\xa1\x42\x85\x0a\x15\xbf\x49\
\x68\xda\x79\xfc\x50\x20\x0c\x08\x04\x02\x80\x0e\x36\xd7\x1a\x80\
\x2a\xa0\x0c\xb8\x2c\x96\xff\xaf\x09\x1c\x00\x8c\x05\xe2\x81\x1b\
\x81\x18\xc0\xbb\x09\xed\x75\xc0\x05\xe0\x14\x70\x14\xf8\x16\x28\
\xf9\x3d\x13\xa8\x01\x6e\x01\x66\x03\x93\x80\x5e\xbf\xac\xd0\xc9\
\xc3\x0b\xff\xe0\x30\x7c\xfc\x83\xe8\xe8\xe1\x89\xbb\x7b\x47\x34\
\x6e\xd6\x49\x68\x32\x1a\xa8\xab\xa9\xa2\xae\xba\x0a\x7d\x59\x09\
\xa6\x86\xfa\x5f\x36\xb7\x00\x27\x81\x5d\xc0\x26\x20\xff\xf7\x42\
\x60\x67\xe0\x21\xe0\xaf\x40\xb4\x74\xd2\xdb\x2f\x80\xa8\xb8\x78\
\x7a\x0e\x18\x4c\x44\xd4\x00\x42\x7b\xf4\xc1\xd3\xc7\xcf\xe1\x4e\
\xf5\xba\x52\x8a\xf3\xb4\x5c\xd6\x9e\x25\x2f\xf3\x14\x79\x99\xa7\
\x6d\x49\xb5\x00\x9f\x00\x89\xe2\x0c\xfd\x4d\x12\xe8\x0e\x3c\x0e\
\xbc\x04\x84\x03\x78\xf9\xfa\x33\x74\xfc\x5d\x0c\x1a\x3d\x89\x88\
\xa8\x01\x68\x34\xce\x1b\xce\x64\xac\x47\x9b\x7e\x98\x73\x47\xbe\
\x22\xe3\xd0\x5e\xdb\x4b\x7b\x81\x85\x80\xf6\xb7\x44\x60\x2c\x90\
\x04\x0c\x03\x08\xef\x15\xc3\x98\x19\x73\x19\x98\x30\x91\x0e\x1d\
\xdc\x5b\xfd\x8f\xd0\xeb\x4a\x49\xdd\xb9\x91\xd4\x5d\x9b\xa4\x53\
\x46\xf1\x41\xbe\x29\xce\x4e\x97\x25\x50\x03\x2c\x06\x56\x02\x9d\
\xbd\xbb\x04\x32\xfd\x89\x17\x89\x1d\x71\xbb\x53\x67\x9b\xa3\xa8\
\xd5\x57\xb0\x67\x5d\x22\x19\xdf\x5d\x9b\x91\x87\x80\xfb\x81\x2b\
\xae\x48\x60\x67\xf1\xe3\x7d\x2f\x40\xfc\xc4\x59\x4c\x7e\x64\x31\
\x9d\x3d\xbd\x69\x6f\x5c\x3c\xf9\x1d\xdb\xde\x5e\x82\xa1\x46\x0f\
\x50\x04\x4c\x04\xce\xbb\x12\x81\xbe\xc0\x4e\xe0\x36\xf7\x8e\x9d\
\xb8\x6f\xf1\x1a\x62\x87\x8f\x73\x29\x7d\x56\x53\x59\xce\xc6\x55\
\xcf\x50\x98\x7d\x5e\x92\x40\x13\x5a\xc3\xc0\x34\x87\x40\x1f\xe0\
\x2b\x60\x84\x6f\x40\x30\x73\x97\x7d\x40\x58\xcf\x7e\xcd\xbe\x81\
\xea\x8a\x32\x74\x25\x05\xd4\x55\x57\xd2\xd8\xd0\x70\xed\xbc\xa7\
\x8f\x1f\x7e\x81\x21\x04\x86\x75\xc7\xbd\x63\xa7\xe6\x19\x9a\x06\
\x23\x1f\xbf\xf6\x2c\x59\x27\x0e\x02\xe8\x81\xd1\xc0\xd9\xf6\x24\
\xb0\x03\xf0\x19\x30\xd5\x2f\x28\x94\x27\x5e\x49\x22\x20\xa4\x9b\
\xc3\x8d\x2d\x16\x0b\x45\x3f\x5e\x20\xeb\xe4\x21\x72\xce\x1c\xa3\
\xe8\x52\x26\x0d\xf5\x06\xf9\x1b\xd4\x68\x08\x08\xed\x46\x64\xcc\
\x4d\xf4\x1f\x36\x96\xe8\x21\x09\x78\x78\xf9\x38\x3c\xa6\xb9\xd1\
\xc4\x87\xab\xff\x8c\xf6\x54\x2a\x40\x9e\x68\xe8\xca\xda\x8b\xc0\
\xd7\x80\x67\x3d\x7d\xfc\x78\xf2\xd5\x0f\xe9\xda\xad\xb7\x43\x8d\
\x8c\x86\x3a\x8e\xed\xfb\x2f\x47\x53\xb6\x52\x51\x52\x70\x3d\x0f\
\xa3\x00\x28\xb6\x71\xd7\xdc\x81\x10\xf1\xd7\x0b\xe8\x78\x4d\x2b\
\x75\xec\x44\xdc\xe8\x49\xdc\x7a\xf7\x1f\x1d\x1e\xbf\xd1\x64\xe2\
\x83\x25\x0f\x53\xf8\xe3\x05\x80\x7d\xc0\x9d\x80\xb9\xad\x09\x9c\
\x2e\xce\x3e\x1e\x5b\xb9\x9e\xde\xb1\xc3\x94\x67\x9c\xd9\xcc\xd1\
\x94\x64\xbe\xd9\xfa\xbe\x60\xa8\xd1\x4b\x63\x95\x01\xdb\x80\xaf\
\x81\x54\xa0\xd4\x01\x7d\x39\x10\x98\x0c\x4c\x01\x12\x00\x34\x6e\
\x6e\x0c\xb9\xed\x0f\x4c\x9e\xb3\x08\x2f\x3f\x7f\xc5\x7b\xa9\x2a\
\x2b\xe6\x9d\x85\xb3\x24\xc3\xb2\x04\x78\xb5\x2d\x09\x0c\x04\xb2\
\x80\xae\x53\xe6\x3d\x47\xc2\xb4\x87\x15\x1b\x54\x5c\x2d\x64\xdb\
\xdb\x4b\xc9\xcb\x4c\x97\x4e\x1d\x16\x3d\x85\xcf\x5b\xa8\xcd\xfa\
\x01\x8b\x80\x27\x01\xfc\x02\x43\xb8\x6f\xd1\xab\x0e\x3d\x50\xed\
\xa9\x54\x92\x56\xcc\x97\x74\xe2\x00\xe0\x52\x4b\x09\xec\xe0\x60\
\xbd\xb5\xc0\xa8\xa8\xb8\x78\xa6\x3f\xf1\x92\xa2\xc6\xcb\xcd\x4c\
\x67\xdd\xcb\xf3\x84\xb2\xa2\x3c\x8d\xe8\xf0\x3f\x02\x3c\x27\x7a\
\x07\x42\x0b\xef\x59\x27\x3e\x84\x8f\x81\x91\x46\x43\x6d\xc4\xe9\
\x83\x9f\x13\x10\x12\x41\x78\xaf\x18\xd9\x86\x41\xe1\x91\xe8\xae\
\x16\x52\x9c\x7b\xd1\x1d\xe8\x0b\x7c\xd4\x16\x04\x0e\x07\xde\x71\
\x73\xeb\xa0\x99\xbb\x6c\x2d\x5e\xbe\xf2\xaf\x4b\xce\xb9\xe3\x24\
\x2d\x7f\x4a\x30\x1a\x6a\x35\xc0\x7e\x31\x02\xd3\x1a\xfe\x69\x39\
\xb0\x01\x08\x10\x04\xcb\xf0\xcc\xe3\x07\x08\x0e\x8f\x54\x54\x04\
\x91\xd1\x83\x38\x9a\x92\x8c\xc5\x6c\x8e\x06\x0e\x02\xb9\xad\x4d\
\xe0\x46\x20\x6a\xcc\x8c\xb9\xc4\x25\xdc\x21\x5b\xf1\xca\xa5\x8b\
\xfc\x67\xd9\x63\x98\x1a\xea\x35\xc0\x7a\x51\x64\xd7\xb5\xa2\xdc\
\xb3\x00\x29\x40\x03\x82\x30\x3e\xeb\xc4\x01\xa2\xe2\xe2\xf1\xef\
\x1a\x6e\x5f\xfd\x7b\x7a\x21\x08\x02\x39\xe7\x8e\x03\x44\x8a\xce\
\x40\xb3\xe1\xa6\x70\x7d\x34\x30\xde\xc3\xcb\x97\x31\x33\xe7\xc9\
\x56\x34\xd4\xea\xd9\xb2\x66\x21\x26\xa3\x01\xe0\x53\xe0\x51\x67\
\x59\x3a\x07\xb0\x1a\x58\x6b\x6e\x6c\x64\xdb\x5b\x4b\xa8\xaf\xad\
\x96\xad\x3c\x72\xca\x6c\xc9\x63\x1a\x07\x0c\x6e\x4d\x02\x9f\x05\
\x18\x71\xe7\xfd\x78\x7a\xcb\x87\x9e\xf6\xac\x4b\x44\x57\x5c\x00\
\x70\x0e\x78\xc0\x09\xdf\xba\xa6\xe2\x4f\xc0\xe9\xca\xd2\x22\xbe\
\xdc\xfc\x0f\xd9\x8a\x9e\xde\x7e\x0c\x19\x37\x5d\x3a\x5c\xd0\x5a\
\x04\x76\x07\xa6\x02\x24\x4c\x7b\x48\xe1\xbb\x77\x82\xf4\x03\xbb\
\xa5\x57\x6a\x26\x50\xdf\x0e\xde\x9b\x09\x78\x10\xe0\xf8\xbe\xed\
\x5c\x2d\x90\x37\xb0\xa3\xa6\x3c\x20\x15\xef\x01\xbc\x5a\x83\xc0\
\x47\x80\x0e\x71\x09\x13\xf1\xf6\x0b\xb0\x5b\x49\x10\x04\x52\x92\
\x5e\x97\x0e\x57\x02\x3f\xb4\xa3\x0b\x7c\x01\x58\x6f\xb1\x98\x39\
\xb8\x7d\x9d\xa2\x45\xee\x11\x33\x48\x72\x4d\xa7\xb5\x06\x81\xb3\
\x01\x06\x8f\x95\xef\xfb\x87\xf4\xc3\x92\xc2\x2f\x77\x96\x38\x6d\
\x21\x96\x03\x9c\x49\x4d\xa1\xa6\xb2\x5c\xb6\x62\xec\xf0\xf1\x52\
\xf1\x6e\x67\x13\x18\x0d\xdc\xe0\xe1\xe5\x4b\xbf\x21\x09\xb2\x1d\
\x1c\xdc\xb1\x5e\x2a\x26\x02\x06\x17\x20\x30\x0f\xd8\x6d\x6e\x6c\
\xe4\xe4\xfe\x9d\xb2\x15\x07\x8e\x9c\x20\x15\x27\x38\x60\x0f\x9a\
\x44\xe0\x54\x80\xe8\x21\x09\xb2\x11\x65\x5d\x71\x01\x97\xce\x9f\
\x40\x34\x18\x6b\x5d\x28\x9a\xb5\x01\xe0\x6c\xea\x97\xf2\xee\x55\
\x58\x77\x29\x18\xe2\xdf\x5c\x6b\x6c\x8f\xc0\x71\x00\xd1\x83\xe5\
\x67\xdf\xd9\x23\xfb\xa4\xe2\x36\xa0\xda\x85\x08\x4c\xb1\xea\xd2\
\x2c\x6a\xf5\x15\xb2\x15\x7b\xc5\x0e\xb5\x95\x6c\x4e\x21\x50\x03\
\x8c\x04\x88\x8a\x8b\x97\x6d\x9c\x9d\x7e\x44\x2a\xee\xc0\xb5\x50\
\x0f\x1c\x14\x04\x81\xcb\x5a\xf9\xf0\x5f\x8f\x7e\x03\xa5\xe2\x10\
\x67\x11\xd8\x0f\x08\xf4\x0d\x08\x96\x55\xf4\xa6\x06\x23\xb9\x99\
\xd7\x3c\xb4\xaf\x71\x3d\x9c\x02\x28\xc8\x3e\x27\x5b\x29\xbc\x77\
\x7f\xa9\x38\xc8\x59\x04\xde\x04\x10\xa6\xe0\x98\x5f\xc9\xc9\xc2\
\xdc\x68\x92\xa4\x83\xce\x05\x09\x4c\x07\x28\x55\xd0\x83\xa1\x3d\
\xfa\xd8\x1a\x4e\xa7\x10\xd8\x1f\x20\x34\xb2\xaf\x6c\xc3\xa2\x4b\
\x59\x52\xf1\x38\xae\x09\x2d\x40\xf9\x15\xf9\x84\x05\x0f\x6f\x5f\
\x3c\x7d\xbb\x20\x8a\xe9\x30\x67\x10\x18\x05\x10\x1c\xd1\x53\xb6\
\x61\x69\x41\x8e\xad\x78\x75\x45\x14\x02\x54\x57\x94\x2a\x56\xf4\
\x0b\x08\xb1\xf5\xbe\x5a\x4c\x60\x77\x40\x71\xad\xa3\xa2\xf4\xda\
\x52\x6b\xbe\x8b\x12\x58\x06\x50\x57\xad\x9c\xd4\xe5\xfd\x53\x44\
\x3b\xd0\x19\x04\x06\x03\x78\x77\x09\x90\x6d\x58\x53\x59\xf6\xb3\
\x27\xed\x82\xa8\x07\xa4\xef\xb4\x7c\x70\xc1\xa7\x8b\x54\x0c\x68\
\xea\x20\xd7\x53\xc9\x5d\x01\x3c\x3c\xe5\x57\xbe\x4c\x46\xa3\x54\
\xac\x6d\x43\x52\xba\x63\x8d\x22\x7b\x8b\xb2\xe3\xa4\x33\x3a\xb5\
\x59\x36\x4d\xc6\x1a\x39\xc7\x8e\xbc\x93\xc6\x2c\xc5\x9a\xf1\x50\
\x75\x3d\x02\x1b\xaf\x55\x97\x41\x43\x7d\x9d\x6d\xc7\x6d\x85\x02\
\xe0\x75\xac\x8b\xfa\x00\x43\x9b\x40\x8e\x5d\x18\x6a\xf5\xb6\x87\
\x4a\x7d\x0e\x05\x46\x20\xae\x20\x5e\x8f\x40\x1d\x10\x59\xa7\xaf\
\x24\x30\xb4\xbb\xcc\xb4\xf7\xa3\xe2\x6a\xa1\xbd\x3e\x5a\x13\xbb\
\x80\xbf\x49\x41\x83\x3b\xe6\xfc\x85\xbe\x83\x46\xd8\xad\xac\x71\
\x53\x76\x71\xa7\x3d\xfa\x02\xf5\x75\x35\x76\xaf\xa7\xa5\x6c\xe5\
\xc4\x37\x9f\x4a\x87\xf7\x00\x69\x72\xaf\xf0\x55\x40\xd1\x05\xf2\
\xf1\x0f\xb2\x7d\xad\xd2\xda\x98\xc4\x15\xa2\xec\x78\xe1\xc0\x27\
\xeb\x88\x19\x32\x9a\xb0\x9e\xd1\xcd\xee\x2c\x28\x3c\xd2\xee\xb5\
\xcc\x63\xfb\x6d\x83\x12\x73\xb0\xe6\x21\xca\x1a\x91\x7c\x80\xca\
\xb2\x62\xd9\x41\x6d\x16\xb5\xfb\xb7\x93\x91\x58\x0a\x6c\x31\xd6\
\xd5\x90\xb4\xe2\x69\xc5\xfb\x6d\x0e\x7e\x3c\x93\xc6\x96\xc4\x45\
\x08\x16\x8b\x34\xde\x87\x8e\x58\xe1\x5c\x80\xb2\xc2\x5c\x05\x17\
\x28\xe6\x67\x9e\x4b\x3b\x40\x00\xe6\x01\xfb\xf5\xe5\x25\x6c\x5c\
\x31\x5f\x71\x2d\xa4\x29\x28\xce\xd3\xb2\x39\x71\x21\x16\x8b\x19\
\xe0\x7d\xac\xeb\x2e\x0e\xc9\x98\x4c\x80\xe2\x5c\xf9\x04\xcf\x88\
\xa8\x01\x52\xf1\xb6\x76\x94\x2a\x0d\xc0\x0c\xe0\x7c\x49\x7e\x36\
\x9b\x13\x17\xd2\x68\x32\xb5\xb8\xd3\xaa\xb2\x62\x92\x56\x3c\x8d\
\xd1\xfa\x5d\xdc\x8e\xcc\xba\xc9\xf5\x08\x3c\x66\x75\xd5\x32\x11\
\x04\xfb\xeb\x42\xa1\x91\x7d\xf1\xee\x12\x08\x10\xd4\x8e\xb3\x10\
\xd1\x1a\x4e\x02\x0a\x72\xce\x1e\x63\xfb\x3f\x5f\x96\xbd\x6f\x25\
\xd4\x54\xe9\x48\x5a\x31\x1f\x7d\x79\x09\x58\x77\x02\x3c\x80\xcc\
\xea\xa2\x9b\x1d\xa9\x50\x6c\xa8\xd1\x53\x2a\xf3\x1a\x6b\x34\x1a\
\x62\x47\x5c\x0b\x89\x3f\xd4\xce\xa2\xb9\x00\x6b\xc2\x90\x3e\xe3\
\xd0\x5e\xf6\x29\xac\xca\xd9\x9d\xce\x46\x03\x9b\x56\x2d\xa0\x24\
\x3f\x1b\xac\x69\x70\x33\xc5\x59\xde\x24\x4f\x04\xac\x2b\xf6\x64\
\x67\x1c\x91\x1d\x70\xd8\xed\x33\xa5\xe2\xe3\x34\x6d\xcf\x47\x6b\
\xe0\xac\xf8\x3a\x37\x1c\xdc\xb1\x9e\xa3\x29\x5b\x9b\xd4\xd8\x62\
\x36\x93\xfc\xc6\xf3\x14\xfc\x70\xd6\xf6\x81\x28\xfa\x81\xf6\x32\
\x13\x7c\x80\xbb\x04\x41\x60\xf0\xd8\xa9\xf6\x9d\xf0\xc0\x10\xb4\
\xe9\x87\xd1\x97\x97\x74\x06\x2a\x81\xef\xdb\x99\xc4\x4b\xe2\x6f\
\x86\x36\xfd\xb0\x26\xa2\x77\x8c\xc3\x29\x70\xbb\xfe\xfd\x0a\x19\
\x87\x3e\x47\xf4\x32\xc6\xe0\x60\xca\x87\xbd\x19\xb8\x07\x30\x67\
\x9f\xfe\xfe\x97\x2a\xfd\x57\xb8\x7d\xf6\xd3\x52\x71\x4d\x73\xa2\
\x19\xad\x80\x2d\xc0\x52\xc1\x62\x21\xf9\x8d\xe7\xb9\xac\x3d\xa3\
\xd8\xe0\xeb\xe4\xf7\x48\xfb\x62\x1b\x58\xd3\x50\xa6\x01\xd9\x8e\
\x0e\x66\x6f\x06\xd6\x61\x4d\x0a\xea\x1d\x18\xda\x9d\x6e\x7d\x6e\
\xb0\x2f\x42\xc3\x7a\x50\x98\x93\x49\x59\x51\x2e\x62\x9b\x8d\xb4\
\x5d\x4a\x87\x3d\xa4\x02\xa1\x16\x73\xe3\xcd\x99\xc7\xf6\x13\x3b\
\x62\x3c\x5e\xbe\x5d\xae\x5b\xf1\x68\xca\x56\xbe\xd8\xf4\x16\xe2\
\x3d\xdf\x2b\x1a\x8e\x16\x45\x63\x24\x6c\x06\x38\xf9\xcd\x67\x8a\
\x9d\xcc\x98\xbf\x0c\xdf\x80\xae\x92\x9f\xb8\x1b\xf0\x70\x81\x99\
\xb8\x00\xd8\x55\xab\xaf\x60\xc3\xf2\x27\xa9\xa9\xfa\x75\xd0\xfc\
\x42\xda\xb7\xec\x5e\xb7\x5a\xd2\x94\xcf\x88\x6e\x22\xce\x22\x30\
\x19\xd0\x5d\xd6\x9e\x21\x2f\xeb\xb4\x6c\x27\xbe\xfe\x41\xcc\x79\
\xf1\x5d\x3c\x7d\xfc\x04\xac\x6b\xac\x5a\xac\x9b\x09\xdb\x13\x66\
\xac\xc9\x01\x69\xba\xe2\x02\x36\xad\x5a\x40\x83\xf1\xa7\x65\xeb\
\xfc\x8b\x19\x24\xbf\xf9\xbc\x60\xe3\x65\x34\x6b\x59\x56\x2e\xbd\
\xad\x51\x0c\x6d\x8d\xaa\xab\xae\xe4\xc6\x5b\x26\xcb\x76\xe4\x17\
\xd8\x95\xde\x37\x0c\xd5\x88\x4e\x77\x17\xe0\x4b\xda\x68\xbb\x95\
\x5c\xd4\x4d\x8c\xdc\xcc\xd4\xeb\xae\x06\x16\xe7\x65\x13\x37\x6a\
\x22\x25\x97\xb3\x59\xf7\xf2\xa3\x98\x8c\x06\x8d\x48\xdc\x92\xe6\
\x0e\xa0\x14\x8a\x0a\x17\xad\x5a\xe7\xa7\x12\xb7\xd0\x23\x3a\x4e\
\xb6\xf2\xde\x0d\xaf\x4b\xdb\xad\xd2\xb1\x66\xc3\x5b\x70\x0d\xf4\
\x05\x8e\x00\xc1\x31\x43\x6f\xe1\x4a\xae\x56\x12\xca\xbb\x44\xad\
\xd7\xec\x6f\xb6\x52\x82\x65\x8d\xa8\xef\x46\x5f\xc9\xbd\xc8\xcd\
\x13\xee\xb6\x9b\xde\x5b\x94\x93\xc9\xf6\x7f\x2d\x03\x41\x30\x8b\
\x96\xac\x08\xd7\x81\x0e\xeb\xb6\xaf\x07\xcb\xaf\xe4\x77\x34\x1a\
\x6a\x25\x43\x73\x97\x92\x50\x6e\xc9\x37\x50\xc2\x6a\xe0\x6a\x61\
\xf6\x79\x8e\xec\xfd\xd8\xae\x08\xdd\xf1\xde\xdf\xa5\xa8\xc5\xbb\
\xb4\xf1\x96\x53\x07\x91\x26\x7e\x13\xc1\x9a\xc3\x38\x15\x27\x64\
\xcf\x3a\x92\xe2\x6b\x14\x43\x5c\xf7\x5c\x3a\x77\x82\x01\xf1\xb7\
\xda\xc6\x02\x01\x38\xbc\x67\x33\xa7\xbe\xdd\x29\x85\xc2\x66\xb5\
\xf4\xa9\xb6\x22\x2e\x62\xfd\xf7\x01\xcb\x51\xde\x5e\xe1\x34\x02\
\xc1\xba\x51\x2f\xd2\x62\x6e\x1c\x9c\x79\xec\x00\x37\x8e\x9d\x42\
\x67\x0f\x6b\x4e\xa2\xae\xa4\x80\x8f\xd6\x2c\xc6\x62\x6e\x04\x6b\
\x82\xe3\x79\x5c\x1b\xe9\x58\xb7\x7d\xb5\x39\xbc\x80\x0c\x40\x08\
\x8d\xec\x2b\x2c\xdd\xb0\x5f\x58\xb5\x23\x43\xe8\x13\x37\x5c\x10\
\x75\xd4\x47\xa8\x50\x44\x37\xac\xf1\x42\xc1\x37\x20\x58\x88\x9f\
\x38\x4b\x22\xaf\x14\x71\x39\x54\x85\x32\x42\x44\x23\x21\xd8\xfc\
\x66\xa9\xb4\x34\x0d\xde\xc0\x07\x22\x79\xeb\x55\x3a\x9a\x8f\x88\
\x26\x18\x22\x15\x2a\x54\xa8\x50\xa1\x42\x85\x0a\x15\x2a\x54\xa8\
\x50\xa1\x42\x85\x0a\x15\x2a\x54\xb4\x2f\xfe\x07\x9e\xbb\xc6\xbd\
\x95\x4e\xb5\xb4\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
\
"
qt_resource_name = "\
\x00\x09\
\x0a\x6c\x78\x43\
\x00\x72\
\x00\x65\x00\x73\x00\x6f\x00\x75\x00\x72\x00\x63\x00\x65\x00\x73\
\x00\x12\
\x00\x20\xd5\xa7\
\x00\x74\
\x00\x72\x00\x61\x00\x6e\x00\x73\x00\x6c\x00\x61\x00\x74\x00\x65\x00\x5f\x00\x6c\x00\x65\x00\x66\x00\x74\x00\x2e\x00\x70\x00\x6e\
\x00\x67\
\x00\x0f\
\x05\xf1\x15\x67\
\x00\x72\
\x00\x6f\x00\x61\x00\x74\x00\x65\x00\x5f\x00\x78\x00\x5f\x00\x6e\x00\x65\x00\x67\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x0f\
\x04\xa5\x8e\xc7\
\x00\x61\
\x00\x72\x00\x6d\x00\x5f\x00\x6c\x00\x65\x00\x66\x00\x74\x00\x5f\x00\x6f\x00\x6e\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x10\
\x09\x84\xcf\xc7\
\x00\x61\
\x00\x72\x00\x6d\x00\x5f\x00\x6c\x00\x65\x00\x66\x00\x74\x00\x5f\x00\x6f\x00\x66\x00\x66\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x10\
\x05\xf2\xd3\x27\
\x00\x72\
\x00\x6f\x00\x74\x00\x61\x00\x74\x00\x65\x00\x5f\x00\x79\x00\x5f\x00\x6e\x00\x65\x00\x67\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x11\
\x05\x90\x96\x27\
\x00\x61\
\x00\x72\x00\x6d\x00\x5f\x00\x72\x00\x69\x00\x67\x00\x68\x00\x74\x00\x5f\x00\x6f\x00\x66\x00\x66\x00\x2e\x00\x70\x00\x6e\x00\x67\
\
\x00\x10\
\x05\xf2\xdd\x27\
\x00\x72\
\x00\x6f\x00\x74\x00\x61\x00\x74\x00\x65\x00\x5f\x00\x7a\x00\x5f\x00\x6e\x00\x65\x00\x67\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x0f\
\x00\x79\xd5\xe7\
\x00\x61\
\x00\x72\x00\x6d\x00\x5f\x00\x67\x00\x72\x00\x69\x00\x70\x00\x70\x00\x65\x00\x72\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x09\
\x07\xbc\x8f\xc7\
\x00\x65\
\x00\x6d\x00\x70\x00\x74\x00\x79\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x10\
\x0d\x98\xa0\x27\
\x00\x74\
\x00\x72\x00\x61\x00\x6e\x00\x73\x00\x6c\x00\x61\x00\x74\x00\x65\x00\x5f\x00\x75\x00\x70\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x12\
\x0d\x56\x2a\x87\
\x00\x74\
\x00\x72\x00\x61\x00\x6e\x00\x73\x00\x6c\x00\x61\x00\x74\x00\x65\x00\x5f\x00\x64\x00\x6f\x00\x77\x00\x6e\x00\x2e\x00\x70\x00\x6e\
\x00\x67\
\x00\x10\
\x0b\x64\xcb\x47\
\x00\x61\
\x00\x72\x00\x6d\x00\x5f\x00\x72\x00\x69\x00\x67\x00\x68\x00\x74\x00\x5f\x00\x6f\x00\x6e\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x10\
\x06\x2e\xd3\x27\
\x00\x72\
\x00\x6f\x00\x74\x00\x61\x00\x74\x00\x65\x00\x5f\x00\x79\x00\x5f\x00\x70\x00\x6f\x00\x73\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x13\
\x02\x80\xed\xc7\
\x00\x74\
\x00\x72\x00\x61\x00\x6e\x00\x73\x00\x6c\x00\x61\x00\x74\x00\x65\x00\x5f\x00\x72\x00\x69\x00\x67\x00\x68\x00\x74\x00\x2e\x00\x70\
\x00\x6e\x00\x67\
\x00\x10\
\x0e\xda\xa0\x27\
\x00\x74\
\x00\x72\x00\x61\x00\x6e\x00\x73\x00\x6c\x00\x61\x00\x74\x00\x65\x00\x5f\x00\x69\x00\x6e\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x10\
\x06\x2e\xdd\x27\
\x00\x72\
\x00\x6f\x00\x74\x00\x61\x00\x74\x00\x65\x00\x5f\x00\x7a\x00\x5f\x00\x70\x00\x6f\x00\x73\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x11\
\x03\x78\x2f\x67\
\x00\x74\
\x00\x72\x00\x61\x00\x6e\x00\x73\x00\x6c\x00\x61\x00\x74\x00\x65\x00\x5f\x00\x6f\x00\x75\x00\x74\x00\x2e\x00\x70\x00\x6e\x00\x67\
\
\x00\x0f\
\x06\x35\x16\xe7\
\x00\x72\
\x00\x6f\x00\x61\x00\x74\x00\x65\x00\x5f\x00\x78\x00\x5f\x00\x70\x00\x6f\x00\x73\x00\x2e\x00\x70\x00\x6e\x00\x67\
"
qt_resource_struct = "\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x12\x00\x00\x00\x02\
\x00\x00\x00\x18\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
\x00\x00\x01\x24\x00\x00\x00\x00\x00\x01\x00\x00\x40\xc0\
\x00\x00\x01\xfc\x00\x00\x00\x00\x00\x01\x00\x00\x6c\x94\
\x00\x00\x02\x74\x00\x00\x00\x00\x00\x01\x00\x00\x86\x97\
\x00\x00\x00\x66\x00\x00\x00\x00\x00\x01\x00\x00\x10\xf8\
\x00\x00\x00\xd6\x00\x00\x00\x00\x00\x01\x00\x00\x2c\x12\
\x00\x00\x00\x42\x00\x00\x00\x00\x00\x01\x00\x00\x05\x4d\
\x00\x00\x00\xb0\x00\x00\x00\x00\x00\x01\x00\x00\x1f\x2c\
\x00\x00\x00\xfe\x00\x00\x00\x00\x00\x01\x00\x00\x34\x44\
\x00\x00\x01\xd6\x00\x00\x00\x00\x00\x01\x00\x00\x5f\xa2\
\x00\x00\x02\x4e\x00\x00\x00\x00\x00\x01\x00\x00\x79\xad\
\x00\x00\x02\x9c\x00\x00\x00\x00\x00\x01\x00\x00\x8e\xc6\
\x00\x00\x01\x48\x00\x00\x00\x00\x00\x01\x00\x00\x4d\x08\
\x00\x00\x00\x8a\x00\x00\x00\x00\x00\x01\x00\x00\x17\x5b\
\x00\x00\x01\xb0\x00\x00\x00\x00\x00\x01\x00\x00\x59\x21\
\x00\x00\x01\x86\x00\x00\x00\x00\x00\x01\x00\x00\x53\x67\
\x00\x00\x01\x60\x00\x00\x00\x00\x00\x01\x00\x00\x4d\xbe\
\x00\x00\x02\x28\x00\x00\x00\x00\x00\x01\x00\x00\x72\x18\
"
def qInitResources():
QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
def qCleanupResources():
QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
qInitResources()
| [
[
1,
0,
0.0038,
0.0004,
0,
0.66,
0,
154,
0,
1,
0,
0,
154,
0,
0
],
[
14,
0,
0.4805,
0.9523,
0,
0.66,
0.1667,
131,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.9728,
0.0314,
0,
... | [
"from PyQt4 import QtCore",
"qt_resource_data = \"\\\n\\x00\\x00\\x05\\x49\\\n\\x89\\\n\\x50\\x4e\\x47\\x0d\\x0a\\x1a\\x0a\\x00\\x00\\x00\\x0d\\x49\\x48\\x44\\x52\\x00\\\n\\x00\\x00\\x50\\x00\\x00\\x00\\x50\\x08\\x06\\x00\\x00\\x00\\x8e\\x11\\xf2\\xad\\\n\\x00\\x00\\x00\\x01\\x73\\x52\\x47\\x42\\x00\\xae\\xce\\x1... |
#! /usr/bin/python
import roslib; roslib.load_manifest('kelsey_sandbox')
import rospy
import roslib.message
import rosbag
import sys
import rosservice
from pr2_msgs.msg import AccelerometerState
import scipy.io
class AccelSaver:
def __init__(self):
self.data = []
self.first = True
def proc_acc(self, msg):
if len(msg.samples) > 0:
if self.first:
self.beg_time = msg.header.stamp.to_sec()
self.first = False
sum_x, sum_y, sum_z = 0, 0, 0
for sample in msg.samples:
sum_x += sample.x
sum_y += sample.y
sum_z += sample.z
self.data.append((msg.header.stamp.to_sec() - self.beg_time, sum_x / len(msg.samples), sum_y / len(msg.samples), sum_z / len(msg.samples)))
def main():
rospy.init_node('accel_save')
asave = AccelSaver()
rospy.Subscriber('/accelerometer/l_gripper_motor', AccelerometerState, asave.proc_acc)
print "Starting:"
rospy.spin()
mat_data = {}
mat_data['accel'] = asave.data
scipy.io.savemat('accel_data.mat', mat_data)
if __name__ == "__main__":
main()
| [
[
1,
0,
0.075,
0.025,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.075,
0.025,
0,
0.66,
0.0909,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.1,
0.025,
0,
0.66,
... | [
"import roslib; roslib.load_manifest('kelsey_sandbox')",
"import roslib; roslib.load_manifest('kelsey_sandbox')",
"import rospy",
"import roslib.message",
"import rosbag",
"import sys",
"import rosservice",
"from pr2_msgs.msg import AccelerometerState",
"import scipy.io",
"class AccelSaver:\n d... |
#######################################################################
#
# USE pr2_object_manipulation/pr2_gripper_reactive_approach/controller_manager.py
# That code has much of the ideas at the bottom, with more.
#
#######################################################################
# TODO Update code to throw points one at a time. Sections are labled: "Hack"
import numpy as np, math
from threading import RLock, Timer
import sys
import roslib; roslib.load_manifest('hrl_pr2_lib')
roslib.load_manifest('force_torque') # hack by Advait
import force_torque.FTClient as ftc
import tf
import rospy
import actionlib
from actionlib_msgs.msg import GoalStatus
from kinematics_msgs.srv import GetPositionFK, GetPositionFKRequest, GetPositionFKResponse
from kinematics_msgs.srv import GetPositionIK, GetPositionIKRequest, GetPositionIKResponse
from pr2_controllers_msgs.msg import JointTrajectoryAction, JointTrajectoryGoal, JointTrajectoryControllerState
from pr2_controllers_msgs.msg import Pr2GripperCommandGoal, Pr2GripperCommandAction, Pr2GripperCommand
from trajectory_msgs.msg import JointTrajectoryPoint
from geometry_msgs.msg import PoseStamped
from teleop_controllers.msg import JTTeleopControllerState
from std_msgs.msg import Float64
from sensor_msgs.msg import JointState
import hrl_lib.transforms as tr
import time
import functools as ft
import tf.transformations as tftrans
import operator as op
import types
from visualization_msgs.msg import Marker
node_name = "pr2_arms"
def log(str):
rospy.loginfo(node_name + ": " + str)
##
# Convert arrays, lists, matricies to column format.
#
# @param x the unknown format
# @return a column matrix
def make_column(x):
if (type(x) == type([])
or (type(x) == np.ndarray and x.ndim == 1)
or type(x) == type(())):
return np.matrix(x).T
if type(x) == np.ndarray:
x = np.matrix(x)
if x.shape[0] == 1:
return x.T
return x
##
# Convert column matrix to list
#
# @param col the column matrix
# @return the list
def make_list(col):
if type(col) == type([]) or type(col) == type(()):
return col
return [col[i,0] for i in range(col.shape[0])]
##
# Class for simple management of the arms and grippers.
# Provides functionality for moving the arms, opening and closing
# the grippers, performing IK, and other functionality as it is
# developed.
class PR2Arms(object):
##
# Initializes all of the servers, clients, and variables
#
# @param send_delay send trajectory points send_delay nanoseconds into the future
# @param gripper_point given the frame of the wrist_roll_link, this point offsets
# the location used in FK and IK, preferably to the tip of the
# gripper
def __init__(self, send_delay=50000000, gripper_point=(0.23,0.0,0.0),
force_torque = False):
log("Loading PR2Arms")
self.send_delay = send_delay
self.off_point = gripper_point
self.joint_names_list = [['r_shoulder_pan_joint',
'r_shoulder_lift_joint', 'r_upper_arm_roll_joint',
'r_elbow_flex_joint', 'r_forearm_roll_joint',
'r_wrist_flex_joint', 'r_wrist_roll_joint'],
['l_shoulder_pan_joint',
'l_shoulder_lift_joint', 'l_upper_arm_roll_joint',
'l_elbow_flex_joint', 'l_forearm_roll_joint',
'l_wrist_flex_joint', 'l_wrist_roll_joint']]
rospy.wait_for_service('pr2_right_arm_kinematics/get_fk');
self.fk_srv = [rospy.ServiceProxy('pr2_right_arm_kinematics/get_fk', GetPositionFK),
rospy.ServiceProxy('pr2_left_arm_kinematics/get_fk', GetPositionFK)]
rospy.wait_for_service('pr2_right_arm_kinematics/get_ik');
self.ik_srv = [rospy.ServiceProxy('pr2_right_arm_kinematics/get_ik', GetPositionIK),
rospy.ServiceProxy('pr2_left_arm_kinematics/get_ik', GetPositionIK)]
self.joint_action_client = [actionlib.SimpleActionClient('r_arm_controller/joint_trajectory_action', JointTrajectoryAction),
actionlib.SimpleActionClient('l_arm_controller/joint_trajectory_action', JointTrajectoryAction)]
self.gripper_action_client = [actionlib.SimpleActionClient('r_gripper_controller/gripper_action', Pr2GripperCommandAction),actionlib.SimpleActionClient('l_gripper_controller/gripper_action', Pr2GripperCommandAction)]
self.joint_action_client[0].wait_for_server()
self.joint_action_client[1].wait_for_server()
self.gripper_action_client[0].wait_for_server()
self.gripper_action_client[1].wait_for_server()
self.arm_state_lock = [RLock(), RLock()]
self.r_arm_cart_pub = rospy.Publisher('/r_cart/command_pose', PoseStamped)
self.l_arm_cart_pub = rospy.Publisher('/l_cart/command_pose', PoseStamped)
rospy.Subscriber('/r_cart/state', JTTeleopControllerState, self.r_cart_state_cb)
rospy.Subscriber('/l_cart/state', JTTeleopControllerState, self.l_cart_state_cb)
if force_torque:
self.r_arm_ftc = ftc.FTClient('force_torque_ft2')
self.tf_lstnr = tf.TransformListener()
self.arm_angles = [None, None]
self.arm_efforts = [None, None]
self.jtg = [None, None]
self.cur_traj = [None, None]
self.cur_traj_timer = [None, None]
self.cur_traj_pos = [None, None]
self.marker_pub = rospy.Publisher('/pr2_arms/viz_marker', Marker)
rospy.Subscriber('/joint_states', JointState,
self.joint_states_cb, queue_size=2)
rospy.sleep(1.)
log("Finished loading SimpleArmManger")
##
# Callback for /joint_states topic. Updates current joint
# angles and efforts for the arms constantly
#
# @param data JointState message recieved from the /joint_states topic
def joint_states_cb(self, data):
arm_angles = [[], []]
arm_efforts = [[], []]
r_jt_idx_list = [0]*7
l_jt_idx_list = [0]*7
for i, jt_nm in enumerate(self.joint_names_list[0]):
r_jt_idx_list[i] = data.name.index(jt_nm)
for i, jt_nm in enumerate(self.joint_names_list[1]):
l_jt_idx_list[i] = data.name.index(jt_nm)
for i in range(7):
idx = r_jt_idx_list[i]
if data.name[idx] != self.joint_names_list[0][i]:
raise RuntimeError('joint angle name does not match. Expected: %s, Actual: %s i: %d'%('r_'+nm+'_joint', data.name[idx], i))
ang = self.normalize_ang(data.position[idx])
arm_angles[0] += [ang]
arm_efforts[0] += [data.effort[idx]]
idx = l_jt_idx_list[i]
if data.name[idx] != self.joint_names_list[1][i]:
raise RuntimeError('joint angle name does not match. Expected: %s, Actual: %s i: %d'%('r_'+nm+'_joint', data.name[idx], i))
ang = self.normalize_ang(data.position[idx])
arm_angles[1] += [ang]
arm_efforts[1] += [data.effort[idx]]
self.arm_state_lock[0].acquire()
self.arm_angles[0] = arm_angles[0]
self.arm_efforts[0] = arm_efforts[0]
self.arm_state_lock[0].release()
self.arm_state_lock[1].acquire()
self.arm_angles[1] = arm_angles[1]
self.arm_efforts[1] = arm_efforts[1]
self.arm_state_lock[1].release()
def r_cart_state_cb(self, msg):
trans, quat = self.tf_lstnr.lookupTransform('/torso_lift_link',
'r_gripper_tool_frame', rospy.Time(0))
rot = tr.quaternion_to_matrix(quat)
tip = np.matrix([0.12, 0., 0.]).T
self.r_ee_pos = rot*tip + np.matrix(trans).T
self.r_ee_rot = rot
marker = Marker()
marker.header.frame_id = 'torso_lift_link'
time_stamp = rospy.Time.now()
marker.header.stamp = time_stamp
marker.ns = 'aloha land'
marker.type = Marker.SPHERE
marker.action = Marker.ADD
marker.pose.position.x = self.r_ee_pos[0,0]
marker.pose.position.y = self.r_ee_pos[1,0]
marker.pose.position.z = self.r_ee_pos[2,0]
size = 0.02
marker.scale.x = size
marker.scale.y = size
marker.scale.z = size
marker.lifetime = rospy.Duration()
marker.id = 71
marker.pose.orientation.x = 0
marker.pose.orientation.y = 0
marker.pose.orientation.z = 0
marker.pose.orientation.w = 1
color = (0.5, 0., 0.0)
marker.color.r = color[0]
marker.color.g = color[1]
marker.color.b = color[2]
marker.color.a = 1.
self.marker_pub.publish(marker)
ros_pt = msg.x_desi_filtered.pose.position
x, y, z = ros_pt.x, ros_pt.y, ros_pt.z
self.r_cep_pos = np.matrix([x, y, z]).T
pt = rot.T * (np.matrix([x,y,z]).T - np.matrix(trans).T)
pt = pt + tip
self.r_cep_pos_hooktip = rot*pt + np.matrix(trans).T
ros_quat = msg.x_desi_filtered.pose.orientation
quat = (ros_quat.x, ros_quat.y, ros_quat.z, ros_quat.w)
self.r_cep_rot = tr.quaternion_to_matrix(quat)
def l_cart_state_cb(self, msg):
ros_pt = msg.x_desi_filtered.pose.position
self.l_cep_pos = np.matrix([ros_pt.x, ros_pt.y, ros_pt.z]).T
ros_quat = msg.x_desi_filtered.pose.orientation
quat = (ros_quat.x, ros_quat.y, ros_quat.z, ros_quat.w)
self.l_cep_rot = tr.quaternion_to_matrix(quat)
def normalize_ang(self, ang):
while ang >= 2 * np.pi:
ang -= 2 * np.pi
while ang < 0.:
ang += 2 * np.pi
return ang
##
# Create a joint configuration trajectory goal.
#
# @param arm 0 for right, 1 for left
# @param pos_arr list of lists of 7 joint angles in RADIANS.
# @param dur_arr list of how long (SECONDS) from the beginning of the trajectory
# before reaching the joint angles.
# @param stamp header (rospy.Duration) stamp to give the trajectory
# @param vel_arr list of lists of 7 joint velocities in RADIANS/sec.
# @param acc_arr list of lists of 7 joint accelerations in RADIANS/sec^2.
def create_JTG(self, arm, pos_arr, dur_arr, stamp=None, vel_arr=None, acc_arr=None):
# Hack
vel_arr = [[0.]*7]*len(pos_arr)
acc_arr = [[0.]*7]*len(pos_arr)
##
# Compute joint velocities and acclereations.
def get_vel_acc(q_arr, d_arr):
vel_arr = [[0.]*7]
acc_arr = [[0.]*7]
for i in range(1, len(q_arr)):
vel, acc = [], []
for j in range(7):
vel += [(q_arr[i][j] - q_arr[i-1][j]) / d_arr[i]]
acc += [(vel[j] - vel_arr[i-1][j]) / d_arr[i]]
vel_arr += [vel]
acc_arr += [acc]
print vel, acc
return vel_arr, acc_arr
if arm != 1:
arm = 0
jtg = JointTrajectoryGoal()
if stamp is None:
stamp = rospy.Time.now()
else:
jtg.trajectory.header.stamp = stamp
if len(pos_arr) > 1 and (vel_arr is None or acc_arr is None):
v_arr, a_arr = get_vel_acc(pos_arr, dur_arr)
if vel_arr is None:
vel_arr = v_arr
if acc_arr is None:
acc_arr = a_arr
jtg.trajectory.joint_names = self.joint_names_list[arm]
for i in range(len(pos_arr)):
if pos_arr[i] is None or type(pos_arr[i]) is types.NoneType:
continue
jtp = JointTrajectoryPoint()
jtp.positions = pos_arr[i]
if vel_arr is None:
vel = [0.] * 7
else:
vel = vel_arr[i]
jtp.velocities = vel
if acc_arr is None:
acc = [0.] * 7
else:
acc = acc_arr[i]
jtp.accelerations = acc
jtp.time_from_start = rospy.Duration(dur_arr[i])
jtg.trajectory.points.append(jtp)
return jtg
##
# Executes a joint trajectory goal. This is the only function through which
# arm motion is performed.
#
# @param arm 0 for right, 1 for left
# @param jtg the joint trajectory goal to execute
def execute_trajectory(self, arm, jtg):
if self.cur_traj[arm] is not None or self.cur_traj_timer[arm] is not None:
log("Arm is currently executing trajectory")
if rospy.is_shutdown():
sys.exit()
return
print "Yo 2"
# Hack
# self.cur_traj[arm] = jtg
self.cur_traj_pos[arm] = 0
# if too far in past, shift forward the time the trajectory starts
min_init_time = rospy.Time.now().to_sec() + 2 * self.send_delay
if jtg.trajectory.header.stamp.to_nsec() < min_init_time:
jtg.trajectory.header.stamp = rospy.Time(rospy.Time.now().to_sec(),
2 * self.send_delay)
print "dfsdfsfd", jtg
jtg.trajectory.header.stamp = rospy.Time.now()
self.joint_action_client[arm].send_goal(jtg) # Hack
return
# setup first point throw
call_time = ((jtg.trajectory.header.stamp.to_nsec() - self.send_delay -
rospy.Time.now().to_nsec()) / 1000000000.)
self.cur_traj_timer[arm] = Timer(call_time, self._exec_traj, [arm])
self.cur_traj_timer[arm].start()
##
# Callback for periodic joint trajectory point throwing
def _exec_traj(self, arm):
jtg = self.cur_traj[arm]
i = self.cur_traj_pos[arm]
beg_time = jtg.trajectory.header.stamp.to_nsec()
# time to execute current point
cur_exec_time = rospy.Time(jtg.trajectory.header.stamp.to_sec() +
jtg.trajectory.points[i].time_from_start.to_sec())
# create a one point joint trajectory and send it
if i == 0:
last_time_from = 0
else:
last_time_from = jtg.trajectory.points[i-1].time_from_start.to_sec()
cur_dur = jtg.trajectory.points[i].time_from_start.to_sec() - last_time_from
cur_jtg = self.create_JTG(arm, [jtg.trajectory.points[i].positions],
[cur_dur],
cur_exec_time,
[jtg.trajectory.points[i].velocities],
[jtg.trajectory.points[i].accelerations])
# send trajectory goal to node
print "cur_jtg", cur_jtg
self.joint_action_client[arm].send_goal(cur_jtg)
self.cur_traj_pos[arm] += 1
if self.cur_traj_pos[arm] == len(jtg.trajectory.points):
# end trajectory
self.cur_traj[arm] = None
self.cur_traj_timer[arm] = None
else:
# setup next point throw
next_exec_time = beg_time + jtg.trajectory.points[i+1].time_from_start.to_nsec()
print "diff times", next_exec_time / 1000000000. - cur_exec_time.to_sec() - cur_dur
call_time = ((next_exec_time - self.send_delay -
rospy.Time.now().to_nsec()) / 1000000000.)
self.cur_traj_timer[arm] = Timer(call_time, self._exec_traj, [arm])
self.cur_traj_timer[arm].start()
##
# Stop the current arm trajectory.
#
# @param arm 0 for right, 1 for left
def stop_trajectory(self, arm):
self.cur_traj_timer[arm].cancel()
self.cur_traj[arm] = None
self.cur_traj_timer[arm] = None
##
# Move the arm to a joint configuration.
#
# @param arm 0 for right, 1 for left
# @param q list of 7 joint angles in RADIANS.
# @param start_time time (in secs) from function call to start action
# @param duration how long (SECONDS) before reaching the joint angles.
def set_joint_angles(self, arm, q, duration=1., start_time=0.):
self.set_joint_angles_traj(arm, [q], [duration], start_time)
##
# Move the arm through a joint configuration trajectory goal.
#
# @param arm 0 for right, 1 for left
# @param q_arr list of lists of 7 joint angles in RADIANS.
# @param dur_arr list of how long (SECONDS) from the beginning of the trajectory
# before reaching the joint angles.
# @param start_time time (in secs) from function call to start action
def set_joint_angles_traj(self, arm, q_arr, dur_arr, start_time=0.):
if arm != 1:
arm = 0
jtg = self.create_JTG(arm, q_arr, dur_arr)
cur_time = rospy.Time.now().to_sec() + 2 * self.send_delay / 1000000000.
jtg.trajectory.header.stamp = rospy.Duration(start_time + cur_time)
self.execute_trajectory(arm, jtg)
##
# Is the arm currently moving?
#
# @param arm 0 for right, 1 for left
# @return True if moving, else False
def is_arm_in_motion(self, arm):
# Hack
# if self.cur_traj[arm] is not None:
# return True
state = self.joint_action_client[arm].get_state()
return state == GoalStatus.PENDING or state == GoalStatus.ACTIVE
##
# Block until the arm has finished moving
#
# @param arm 0 for right, 1 for left
# @param hz how often to check
def wait_for_arm_completion(self, arm, hz=0.01):
while self.is_arm_in_motion(arm) and not rospy.is_shutdown():
rospy.sleep(hz)
##
# Transforms the given position by the offset position in the given quaternion
# rotation frame
#
# @param pos the current positions
# @param quat quaternion representing the rotation of the frame
# @param off_point offset to move the position inside the quat's frame
# @return the new position as a matrix column
def transform_in_frame(self, pos, quat, off_point):
pos = make_column(pos)
quat = make_list(quat)
invquatmat = np.mat(tftrans.quaternion_matrix(quat))
invquatmat[0:3,3] = pos
trans = np.matrix([off_point[0],off_point[1],off_point[2],1.]).T
transpos = invquatmat * trans
return np.resize(transpos, (3, 1))
##
# Performs Forward Kinematics on the given joint angles
#
# @param arm 0 for right, 1 for left
# @param q list of 7 joint angles in radians
# @return column matrix of cartesian position, column matrix of quaternion
def FK(self, arm, q):
if rospy.is_shutdown():
sys.exit()
if arm != 1:
arm = 0
fk_req = GetPositionFKRequest()
fk_req.header.frame_id = 'torso_lift_link'
if arm == 0:
fk_req.fk_link_names.append('r_wrist_roll_link')
else:
fk_req.fk_link_names.append('l_wrist_roll_link')
fk_req.robot_state.joint_state.name = self.joint_names_list[arm]
fk_req.robot_state.joint_state.position = q
fk_resp = GetPositionFKResponse()
fk_resp = self.fk_srv[arm].call(fk_req)
if fk_resp.error_code.val == fk_resp.error_code.SUCCESS:
x = fk_resp.pose_stamped[0].pose.position.x
y = fk_resp.pose_stamped[0].pose.position.y
z = fk_resp.pose_stamped[0].pose.position.z
q1 = fk_resp.pose_stamped[0].pose.orientation.x
q2 = fk_resp.pose_stamped[0].pose.orientation.y
q3 = fk_resp.pose_stamped[0].pose.orientation.z
q4 = fk_resp.pose_stamped[0].pose.orientation.w
quat = [q1,q2,q3,q4]
# Transform point from wrist roll link to actuator
ret1 = self.transform_in_frame([x,y,z], quat, self.off_point)
ret2 = np.matrix(quat).T
else:
rospy.logerr('Forward kinematics failed')
ret1, ret2 = None, None
return ret1, ret2
##
# Performs Inverse Kinematics on the given position and rotation
#
# @param arm 0 for right, 1 for left
# @param p cartesian position in torso_lift_link frame
# @param rot quaternion rotation column or rotation matrix
# of wrist in torso_lift_link frame
# @param q_guess initial joint angles to use for finding IK
def IK(self, arm, p, rot, q_guess):
if arm != 1:
arm = 0
p = make_column(p)
if rot.shape == (3, 3):
quat = np.matrix(tr.matrix_to_quaternion(rot)).T
elif rot.shape == (4, 1):
quat = make_column(rot)
else:
rospy.logerr('Inverse kinematics failed (bad rotation)')
return None
# Transform point back to wrist roll link
neg_off = [-self.off_point[0],-self.off_point[1],-self.off_point[2]]
transpos = self.transform_in_frame(p, quat, neg_off)
ik_req = GetPositionIKRequest()
ik_req.timeout = rospy.Duration(5.)
if arm == 0:
ik_req.ik_request.ik_link_name = 'r_wrist_roll_link'
else:
ik_req.ik_request.ik_link_name = 'l_wrist_roll_link'
ik_req.ik_request.pose_stamped.header.frame_id = 'torso_lift_link'
ik_req.ik_request.pose_stamped.pose.position.x = transpos[0]
ik_req.ik_request.pose_stamped.pose.position.y = transpos[1]
ik_req.ik_request.pose_stamped.pose.position.z = transpos[2]
ik_req.ik_request.pose_stamped.pose.orientation.x = quat[0]
ik_req.ik_request.pose_stamped.pose.orientation.y = quat[1]
ik_req.ik_request.pose_stamped.pose.orientation.z = quat[2]
ik_req.ik_request.pose_stamped.pose.orientation.w = quat[3]
ik_req.ik_request.ik_seed_state.joint_state.position = q_guess
ik_req.ik_request.ik_seed_state.joint_state.name = self.joint_names_list[arm]
ik_resp = self.ik_srv[arm].call(ik_req)
if ik_resp.error_code.val == ik_resp.error_code.SUCCESS:
ret = list(ik_resp.solution.joint_state.position)
else:
rospy.logerr('Inverse kinematics failed')
ret = None
return ret
##
# Evaluates IK for the given position and rotation to see if the arm could move
# @param arm 0 for right, 1 for left
# @param p cartesian position in torso_lift_link frame
# @param rot quaternion rotation column or rotation matrix
# of wrist in torso_lift_link frame
def can_move_arm(self, arm, pos, rot):
begq = self.get_joint_angles(arm)
endq = self.IK(arm, pos, rot, begq)
if endq is None:
return False
else:
return True
##
# Moves the arm to the given position and rotation
#
# @param arm 0 for right, 1 for left
# @param pos cartesian position of end effector
# @param rot quaterninon or rotation matrix of the end effector
# @param dur length of time to do the motion in
def move_arm(self, arm, pos, begq=None , rot=None, dur=4.0):
if begq is None:
begq = self.get_joint_angles(arm)
if rot is None:
temp, rot = self.FK(arm, begq)
endq = self.IK(arm, pos, rot, begq)
if endq is None:
return False
self.set_joint_angles(arm, endq, dur)
return True
def cancel_trajectory(self, arm):
self.joint_action_client[arm].cancel_all_goals()
##
# Move the arm through a trajectory defined by a series of positions and rotations
#
# @param arm 0 for right, 1 for left
# @param pos_arr list of positions to achieve during trajectory
# @param dur length of time to execute all trajectories in, all positions will
# be given the same amount of time to reach the next point
# (ignore if dur_arr is not None)
# @param rot_arr achieve these rotations along with those positions
# if None, maintain original rotation
# @param dur_arr use these times for the time positions
# @param freeze_wrist if True, keeps the rotation of the wrist constant
def move_arm_trajectory(self, arm, pos_arr, dur=1.,
rot_arr=None, dur_arr=None, freeze_wrist=False):
if dur_arr is None:
dur_arr = np.linspace(0., dur, len(pos_arr) + 1)[1:]
initq = self.get_joint_angles(arm)
curq = initq
q_arr = []
fails, trys = 0, 0
if rot_arr is None:
temp, rot = self.FK(arm, curq)
for i in range(len(pos_arr)):
if rot_arr is None:
cur_rot = rot
else:
cur_rot = rot_arr[i]
nextq = self.IK(arm, pos_arr[i], cur_rot, curq)
q_arr += [nextq]
if nextq is None:
fails += 1
trys += 1
if not nextq is None:
curq = nextq
log("IK Accuracy: %d/%d (%f)" % (trys-fails, trys, (trys-fails)/float(trys)))
if freeze_wrist:
for i in range(len(q_arr)):
if not q_arr[i] is None:
q_arr[i] = (q_arr[i][0], q_arr[i][1], q_arr[i][2], q_arr[i][3],
q_arr[i][4], q_arr[i][5], initq[6])
self.set_joint_angles_traj(arm, q_arr, dur_arr)
##
# Returns the current position, rotation of the arm.
#
# @param arm 0 for right, 1 for left
# @return rotation, position
def end_effector_pos(self, arm):
q = self.get_joint_angles(arm)
return self.FK(arm, q)
##
# Returns the list of 7 joint angles
#
# @param arm 0 for right, 1 for left
# @return list of 7 joint angles
def get_joint_angles(self, arm):
if arm != 1:
arm = 0
self.arm_state_lock[arm].acquire()
q = self.arm_angles[arm]
self.arm_state_lock[arm].release()
return q
# force that is being applied on the wrist.
def get_wrist_force(self, arm, bias = True, base_frame = False):
if arm != 0:
rospy.logerr('Unsupported arm: %d'%arm)
raise RuntimeError('Unimplemented function')
f = self.r_arm_ftc.read(without_bias = not bias)
f = f[0:3, :]
if base_frame:
trans, quat = self.tf_lstnr.lookupTransform('/torso_lift_link',
'/ft2', rospy.Time(0))
rot = tr.quaternion_to_matrix(quat)
f = rot * f
return -f # the negative is intentional (Advait, Nov 24. 2010.)
def bias_wrist_ft(self, arm):
if arm != 0:
rospy.logerr('Unsupported arm: %d'%arm)
raise RuntimeError('Unimplemented function')
self.r_arm_ftc.bias()
def get_ee_jtt(self, arm):
if arm == 0:
return self.r_ee_pos, self.r_ee_rot
else:
return self.l_ee_pos, self.l_ee_rot
def get_cep_jtt(self, arm, hook_tip = False):
if arm == 0:
if hook_tip:
return self.r_cep_pos_hooktip, self.r_cep_rot
else:
return self.r_cep_pos, self.r_cep_rot
else:
return self.l_cep_pos, self.l_cep_rot
# set a cep using the Jacobian Transpose controller.
def set_cep_jtt(self, arm, p, rot=None):
if arm != 1:
arm = 0
ps = PoseStamped()
ps.header.stamp = rospy.rostime.get_rostime()
ps.header.frame_id = 'torso_lift_link'
ps.pose.position.x = p[0,0]
ps.pose.position.y = p[1,0]
ps.pose.position.z = p[2,0]
if rot == None:
if arm == 0:
rot = self.r_cep_rot
else:
rot = self.l_cep_rot
quat = tr.matrix_to_quaternion(rot)
ps.pose.orientation.x = quat[0]
ps.pose.orientation.y = quat[1]
ps.pose.orientation.z = quat[2]
ps.pose.orientation.w = quat[3]
if arm == 0:
self.r_arm_cart_pub.publish(ps)
else:
self.l_arm_cart_pub.publish(ps)
# rotational interpolation unimplemented.
def go_cep_jtt(self, arm, p):
step_size = 0.01
sleep_time = 0.1
cep_p, cep_rot = self.get_cep_jtt(arm)
unit_vec = (p-cep_p)
unit_vec = unit_vec / np.linalg.norm(unit_vec)
while np.linalg.norm(p-cep_p) > step_size:
cep_p += unit_vec * step_size
self.set_cep_jtt(arm, cep_p)
rospy.sleep(sleep_time)
self.set_cep_jtt(arm, p)
rospy.sleep(sleep_time)
# TODO Evaluate gripper functions and parameters
##
# Move the gripper the given amount with given amount of effort
#
# @param arm 0 for right, 1 for left
# @param amount the amount the gripper should be opened
# @param effort - supposed to be in Newtons. (-ve number => max effort)
def move_gripper(self, arm, amount=0.08, effort = 15):
self.gripper_action_client[arm].send_goal(Pr2GripperCommandGoal(Pr2GripperCommand(position=amount, max_effort = effort)))
##
# Open the gripper
#
# @param arm 0 for right, 1 for left
def open_gripper(self, arm):
self.move_gripper(arm, 0.08, -1)
##
# Close the gripper
#
# @param arm 0 for right, 1 for left
def close_gripper(self, arm, effort = 15):
self.move_gripper(arm, 0.0, effort)
# def get_wrist_force(self, arm):
# pass
######################################################
# More specific functionality
######################################################
##
# Moves arm smoothly through a linear trajectory.
#
# @param arm
def smooth_linear_arm_trajectory(self, arm, dist, dir=(0.,0.,-1.), max_jerk=0.25,
delta=0.005, dur=None,
freeze_wrist=True, is_grasp_biased=True):
####################################################
# Smooth trajectory functions
def _smooth_traj_pos(t, k, T):
return -k / T**3 * np.sin(T * t) + k / T**2 * t
def _smooth_traj_vel(t, k, T):
return -k / T**2 * np.cos(T * t) + k / T**2
def _smooth_traj_acc(t, k, T):
return k / T * np.sin(T * t)
# length of time of the trajectory
def _smooth_traj_time(l, k):
return np.power(4 * np.pi**2 * l / k, 1./3.)
def _interpolate_traj(traj, k, T, num=10, begt=0., endt=1.):
return [traj(t,k,T) for t in np.linspace(begt, endt, num)]
####################################################
# Vector representing full transform of end effector
traj_vec = [x/np.sqrt(np.vdot(dir,dir)) for x in dir]
# number of steps to interpolate trajectory over
num_steps = dist / delta
# period of the trajectory
trajt = _smooth_traj_time(dist, max_jerk)
period = 2. * np.pi / trajt
# break the trajectory into interpolated parameterized function
# from 0 to length of the trajectory
traj_pos_mult = _interpolate_traj(_smooth_traj_pos, max_jerk, period,
num_steps, 0., trajt)
# traj_vel_mult = _interpolate_traj(_smooth_traj_vel, max_jerk, period,
# num_steps, 0., trajt)
# traj_acc_mult = _interpolate_traj(_smooth_traj_acc, max_jerk, period,
# num_steps, 0., trajt)
# cartesian offset points of trajectory
cart_pos_traj = [(a*traj_vec[0],a*traj_vec[1],a*traj_vec[2]) for a in traj_pos_mult]
# cart_vel_traj = [(a*traj_vec[0],a*traj_vec[1],a*traj_vec[2]) for a in traj_vel_mult]
# cart_acc_traj = [(a*traj_vec[0],a*traj_vec[1],a*traj_vec[2]) for a in traj_acc_mult]
cur_pos, cur_rot = self.FK(arm, self.get_joint_angles(arm))
# get actual positions of the arm by transforming the offsets
arm_traj = [(ct[0] + cur_pos[0], ct[1] + cur_pos[1],
ct[2] + cur_pos[2]) for ct in cart_pos_traj]
if dur is None:
dur = trajt
if is_grasp_biased:
self.grasp_biased_move_arm_trajectory(arm, arm_traj, dur,
freeze_wrist=freeze_wrist)
else:
self.move_arm_trajectory(arm, arm_traj, dur, freeze_wrist=freeze_wrist)
# return the expected time of the trajectory
return dur
def bias_guess(self, q, joints_bias, bias_radius):
if bias_radius == 0.0:
return q
max_angs = np.array([.69, 1.33, 0.79, 0.0, 1000000.0, 0.0, 1000000.0])
min_angs = np.array([-2.27, -.54, -3.9, -2.34, -1000000.0, -2.15, -1000000.0])
q_off = bias_radius * np.array(joints_bias) / np.linalg.norm(joints_bias)
angs = np.array(q) + q_off
for i in range(7):
if angs[i] > max_angs[i]:
angs[i] = max_angs[i]
elif angs[i] < min_angs[i]:
angs[i] = min_angs[i]
return angs.tolist()
##
# Same as move_arm but tries to keep the elbow up.
def grasp_biased_IK(self, arm, pos, rot, q_guess, joints_bias=[0.]*7, bias_radius=0., num_iters=5):
angs = q_guess
for i in range(num_iters):
angs = self.IK(arm, pos, rot, angs)
angs = self.bias_guess(angs, joints_bias, bias_radius)
return self.IK(arm, pos, rot, angs)
##
# Same as move_arm but tries to keep the elbow up.
def grasp_biased_move_arm(self, arm, pos, rot=None, dur=4.0, num_iters=20):
if rot is None:
temp, rot = self.FK(arm, begq)
angs = self.get_joint_angles(arm)
angs = self.grasp_biased_IK(arm, pos, rot, angs)
self.set_joint_angles(arm, angs, dur)
##
# Move the arm through a trajectory defined by a series of positions and rotations
#
# @param arm 0 for right, 1 for left
# @param pos_arr list of positions to achieve during trajectory
# @param dur length of time to execute all trajectories in, all positions will
# be given the same amount of time to reach the next point
# (ignore if dur_arr is not None)
# @param rot_arr achieve these rotations along with those positions
# if None, maintain original rotation
# @param dur_arr use these times for the time positions
# @param freeze_wrist if True, keeps the rotation of the wrist constant
def grasp_biased_move_arm_trajectory(self, arm, pos_arr, dur=1.,
rot_arr=None, dur_arr=None, freeze_wrist=False):
bias_vec = np.array([0., -1., -1., 0., 0., 1., 0.])
q_radius = 0.012 # Calculated as q_radius = arctan( delta / wrist_flex_length )
q_off = q_radius * bias_vec / np.linalg.norm(bias_vec)
if dur_arr is None:
dur_arr = np.linspace(0., dur, len(pos_arr) + 1)[1:]
initq = self.get_joint_angles(arm)
curq = initq
q_arr = []
fails, trys = 0, 0
if rot_arr is None:
temp, rot = self.FK(arm, curq)
for i in range(len(pos_arr)):
if rot_arr is None:
cur_rot = rot
else:
cur_rot = rot_arr[i]
q_guess = (np.array(curq) + q_off).tolist()
nextq = self.IK(arm, pos_arr[i], cur_rot, q_guess)
q_arr += [nextq]
if nextq is None:
fails += 1
trys += 1
if not nextq is None:
curq = nextq
log("IK Accuracy: %d/%d (%f)" % (trys-fails, trys, (trys-fails)/float(trys)))
if freeze_wrist:
for i in range(len(q_arr)):
if not q_arr[i] is None:
q_arr[i] = (q_arr[i][0], q_arr[i][1], q_arr[i][2], q_arr[i][3],
q_arr[i][4], q_arr[i][5], initq[6])
self.set_joint_angles_traj(arm, q_arr, dur_arr)
if __name__ == '__main__':
rospy.init_node(node_name, anonymous = True)
log("Node initialized")
pr2_arm = PR2Arms()
if False:
q = [0, 0, 0, 0, 0, 0, 0]
pr2_arm.set_jointangles('right_arm', q)
ee_pos = simparm.FK('right_arm', q)
log('FK result:' + ee_pos.A1)
ee_pos[0,0] -= 0.1
q_ik = pr2_arm.IK('right_arm', ee_pos, tr.Rx(0.), q)
log('q_ik:' + [math.degrees(a) for a in q_ik])
rospy.spin()
if False:
p = np.matrix([0.9, -0.3, -0.15]).T
#rot = tr.Rx(0.)
rot = tr.Rx(math.radians(90.))
pr2_arm.set_cartesian('right_arm', p, rot)
# #------ testing gripper opening and closing ---------
# raw_input('Hit ENTER to begin')
# pr2_arm.open_gripper(0)
# raw_input('Hit ENTER to close')
# pr2_arm.close_gripper(0, effort = 15)
# #------- testing set JEP ---------------
# raw_input('Hit ENTER to begin')
r_arm, l_arm = 0, 1
# cep_p, cep_rot = pr2_arm.get_cep_jtt(r_arm)
# print 'cep_p:', cep_p.A1
#
# for i in range(5):
# cep_p[0,0] += 0.01
# raw_input('Hit ENTER to move')
# pr2_arm.set_cep_jtt(r_arm, cep_p)
raw_input('Hit ENTER to move')
p1 = np.matrix([0.91, -0.22, -0.05]).T
pr2_arm.go_cep_jtt(r_arm, p1)
#rospy.sleep(10)
#pr2_arm.close_gripper(r_arm, effort = -1)
raw_input('Hit ENTER to move')
p2 = np.matrix([0.70, -0.22, -0.05]).T
pr2_arm.go_cep_jtt(r_arm, p2)
| [
[
1,
0,
0.0151,
0.001,
0,
0.66,
0,
954,
0,
2,
0,
0,
954,
0,
0
],
[
1,
0,
0.0161,
0.001,
0,
0.66,
0.0312,
83,
0,
2,
0,
0,
83,
0,
0
],
[
1,
0,
0.0171,
0.001,
0,
0.66,... | [
"import numpy as np, math",
"from threading import RLock, Timer",
"import sys",
"import roslib; roslib.load_manifest('hrl_pr2_lib')",
"import roslib; roslib.load_manifest('hrl_pr2_lib')",
"roslib.load_manifest('force_torque') # hack by Advait",
"import force_torque.FTClient as ftc",
"import tf",
"im... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'controller_gui.ui'
#
# Created: Thu Feb 2 04:31:00 2012
# by: PyQt4 UI code generator 4.7.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_Frame(object):
def setupUi(self, Frame):
Frame.setObjectName("Frame")
Frame.resize(609, 289)
Frame.setFrameShape(QtGui.QFrame.StyledPanel)
Frame.setFrameShadow(QtGui.QFrame.Raised)
self.start_button = QtGui.QPushButton(Frame)
self.start_button.setGeometry(QtCore.QRect(20, 20, 161, 181))
self.start_button.setStyleSheet("font: 16pt \"AlArabiya\";\n"
"background-color: rgb(120, 255, 96);")
self.start_button.setObjectName("start_button")
self.kill_button = QtGui.QPushButton(Frame)
self.kill_button.setGeometry(QtCore.QRect(210, 20, 161, 181))
self.kill_button.setStyleSheet("background-color: rgb(255, 67, 67);\n"
"font: 16pt \"AlArabiya\";")
self.kill_button.setObjectName("kill_button")
self.controller_combo = QtGui.QComboBox(Frame)
self.controller_combo.setGeometry(QtCore.QRect(20, 230, 351, 31))
self.controller_combo.setEditable(True)
self.controller_combo.setObjectName("controller_combo")
self.restart_button = QtGui.QPushButton(Frame)
self.restart_button.setGeometry(QtCore.QRect(400, 20, 161, 181))
self.restart_button.setStyleSheet("background-color: rgb(85, 170, 255);\n"
"font: 16pt \"AlArabiya\";")
self.restart_button.setObjectName("restart_button")
self.arm_combo = QtGui.QComboBox(Frame)
self.arm_combo.setGeometry(QtCore.QRect(400, 230, 161, 31))
self.arm_combo.setObjectName("arm_combo")
self.arm_combo.addItem("")
self.arm_combo.addItem("")
self.retranslateUi(Frame)
QtCore.QMetaObject.connectSlotsByName(Frame)
def retranslateUi(self, Frame):
Frame.setWindowTitle(QtGui.QApplication.translate("Frame", "Frame", None, QtGui.QApplication.UnicodeUTF8))
self.start_button.setText(QtGui.QApplication.translate("Frame", "Start", None, QtGui.QApplication.UnicodeUTF8))
self.kill_button.setText(QtGui.QApplication.translate("Frame", "Kill", None, QtGui.QApplication.UnicodeUTF8))
self.restart_button.setText(QtGui.QApplication.translate("Frame", "Restart", None, QtGui.QApplication.UnicodeUTF8))
self.arm_combo.setItemText(0, QtGui.QApplication.translate("Frame", "right", None, QtGui.QApplication.UnicodeUTF8))
self.arm_combo.setItemText(1, QtGui.QApplication.translate("Frame", "left", None, QtGui.QApplication.UnicodeUTF8))
| [
[
1,
0,
0.1887,
0.0189,
0,
0.66,
0,
154,
0,
2,
0,
0,
154,
0,
0
],
[
3,
0,
0.6038,
0.7736,
0,
0.66,
1,
206,
0,
2,
0,
0,
186,
0,
44
],
[
2,
1,
0.5377,
0.6038,
1,
0.86... | [
"from PyQt4 import QtCore, QtGui",
"class Ui_Frame(object):\n def setupUi(self, Frame):\n Frame.setObjectName(\"Frame\")\n Frame.resize(609, 289)\n Frame.setFrameShape(QtGui.QFrame.StyledPanel)\n Frame.setFrameShadow(QtGui.QFrame.Raised)\n self.start_button = QtGui.QPushButto... |
#! /usr/bin/python
import numpy as np
import sys
import roslib
roslib.load_manifest('hrl_pr2_arms')
import rospy
import tf
import tf.transformations as tf_trans
from std_srvs.srv import Empty, EmptyResponse
from hrl_generic_arms.ep_trajectory_controller import EPArmController
from hrl_pr2_arms.pr2_arm import create_pr2_arm, PR2ArmJointTrajectory
from hrl_pr2_arms.pr2_controller_switcher import ControllerSwitcher
joint_ctrl = '%s_arm_controller'
def setup_servoing_arms(msg):
ctrl_switcher = ControllerSwitcher()
ctrl_switcher.carefree_switch('r', joint_ctrl, reset=False)
ctrl_switcher.carefree_switch('l', joint_ctrl, reset=False)
r_arm = create_pr2_arm('r', PR2ArmJointTrajectory, controller_name=joint_ctrl)
l_arm = create_pr2_arm('l', PR2ArmJointTrajectory, controller_name=joint_ctrl)
r_ep_arm_ctrl = EPArmController(r_arm)
l_ep_arm_ctrl = EPArmController(l_arm)
r_ep_arm_ctrl.execute_interpolated_ep([-1.91, 1.25, -1.93, -1.53, 0.33, -0.03, 0.0],
15, blocking=False)
l_ep_arm_ctrl.execute_interpolated_ep([1.91, 1.25, 1.93, -1.53, -0.33, -0.03, -3.09],
15, blocking=True)
return EmptyResponse()
def main():
rospy.init_node("servo_prepare")
if len(sys.argv) < 2:
print "-s for server, -p for play"
if sys.argv[1] == "-s":
rospy.Service("/pr2_ar_servo/arms_setup", Empty, setup_servoing_arms)
if sys.argv[1] == "-p":
setup_servoing_arms(None)
rospy.spin()
if __name__ == "__main__":
main()
| [
[
1,
0,
0.0652,
0.0217,
0,
0.66,
0,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.087,
0.0217,
0,
0.66,
0.0714,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.1304,
0.0217,
0,
0... | [
"import numpy as np",
"import sys",
"import roslib",
"roslib.load_manifest('hrl_pr2_arms')",
"import rospy",
"import tf",
"import tf.transformations as tf_trans",
"from std_srvs.srv import Empty, EmptyResponse",
"from hrl_generic_arms.ep_trajectory_controller import EPArmController",
"from hrl_pr2... |
##
# Periodically logs the output of a callback function by calling it at a certain
# rate and gathering up the results into a list
class PeriodicLogger():
##
# initializes the logger but doesn't start it
#
# @param callback the function to be called each time
# @param rate the rate in seconds at which to call the callback
# @param args the function arguments to pass into the callback
def __init__(self, callback, rate=0.01, args=None):
self.ret = []
self.cb = callback
self.rate = rate
self.args = args
self.is_running = False
self.max_calls = None
self.num_calls = 0
self.beg_time = 0.
self.thread = None
##
# begins the logger
# @param max_calls the maximum number of times to call the callback
def start(self, max_calls=None):
if self.is_running:
return
self.max_calls = max_calls
self.is_running = True
self.num_calls = 0
self.beg_time = rospy.Time.now().to_sec()
self.thread = threading.Timer(self.rate, self._run)
self.thread.start()
def _run(self):
if not self.is_running:
return
act_time = self.beg_time + self.rate * (self.num_calls + 2)
interval = act_time - rospy.Time.now().to_sec()
self.thread = threading.Timer(interval, self._run)
self.thread.start()
if self.args is None:
retval = self.cb()
else:
retval = self.cb(*self.args)
self.ret += [retval]
self.num_calls += 1
# break if we have called the sufficent number of times
if self.max_calls is not None:
if self.num_calls == self.max_calls:
self.is_running = False
return
##
# stops the monitor
# @return the result of the monitor
def stop(self):
self.thread.cancel()
if not self.is_running:
return None
self.is_running = False
return self.ret
##
# If max_calls sets to automatically terminate, return the ret vals
def get_ret_vals(self):
if self.is_running:
return None
return self.ret
##
# Periodically monitors the output of a callback function by calling it at a certain
# rate and compares it with a provided model to insure the value doesn't vary greatly
# within a degree of tolerance provided by the variance function
class PeriodicMonitor():
##
# initializes the monitor but doesn't start it
#
# @param callback the function to be called each time
# @param rate the rate in seconds at which to call the callback
# @param args the function arguments to pass into the callback
def __init__(self, callback, rate=0.01, args=None):
self.ret = []
self.cb = callback
self.rate = rate
self.args = args
self.is_running = False
self.num_calls = 0
self.beg_time = 0.
self.thread = None
self.mean_model = None
self.variance_model = None
self.std_devs = 0.
self.failure = False
##
# begins the monitor
# TODO DOCS
# @param max_calls the maximum number of times to call the callback
def start(self, mean_model, variance_model, std_devs=2.5, max_calls=None,
contingency=None, contingency_args=None):
if len(mean_model) != len(variance_model):
log("Models must be of same length")
return
if self.is_running:
return
self.is_running = True
self.mean_model = mean_model
self.variance_model = variance_model
self.std_devs = std_devs
self.max_calls = max_calls
self.contingency = contingency
self.contincency_args = contingency_args
self.model_index = 0
self.failure = False
self.num_calls = 0
self.beg_time = rospy.Time.now().to_sec()
self.thread = threading.Timer(self.rate, self._run)
self.thread.start()
def _run(self):
if not self.is_running:
return
act_time = self.beg_time + self.rate * (self.num_calls + 2)
interval = act_time - rospy.Time.now().to_sec()
self.thread = threading.Timer(interval, self._run)
self.thread.start()
if self.args is None:
retval = self.cb()
else:
retval = self.cb(*self.args)
# go through each coordinate in the vector
for coord_i in len(retval[1]):
diff = abs(retval[1][coord_i] - self.mean_model[self.model_index][coord_i])
deviation = np.sqrt(self.variance_model[self.model_index][coord_i])
if diff > self.std_devs * deviation:
# signal is outside allowable range
self.failure = True
self.is_running = False
# call contingency function
if contingency_args is None:
self.contingency()
else:
self.contingency(*contingency_args)
return
self.ret += [retval]
self.model_index += 1
if self.model_index == len(self.mean_model):
self.is_running = False
return
# break if we have called the sufficent number of times
if not self.max_calls is None:
self.max_calls -= 1
if self.max_calls == 0:
self.is_running = False
return
##
# stops the monitor
# @return the result of the monitor
def stop(self):
self.thread.cancel()
if not self.is_running:
return None
self.is_running = False
return self.ret
##
# If max_calls sets to automatically terminate, return the ret vals
def get_ret_vals(self):
if self.is_running:
return None
return self.ret
# TODO DOCS
def has_failed():
return self.failure
# TODO DOCS
def wait_for_completion(rate=0.01):
while self.is_running and not rospy.is_shutdown():
rospy.sleep(rate)
return not self.failure
| [
[
3,
0,
0.199,
0.3613,
0,
0.66,
0,
422,
0,
5,
0,
0,
0,
0,
11
],
[
2,
1,
0.0812,
0.0524,
1,
0.05,
0,
555,
0,
4,
0,
0,
0,
0,
0
],
[
14,
2,
0.0628,
0.0052,
2,
0.8,
... | [
"class PeriodicLogger():\n ##\n # initializes the logger but doesn't start it\n #\n # @param callback the function to be called each time\n # @param rate the rate in seconds at which to call the callback\n # @param args the function arguments to pass into the callback\n def __init__(self, callb... |
#! /usr/bin/python
import sys
from PyQt4 import QtCore, QtGui, uic
import roslib
roslib.load_manifest("rospy")
import rospy
from controller_gui import Ui_Frame as QTControllerGUIFrame
from subprocess import Popen
class ControllerGUIFrame(QtGui.QFrame):
def __init__(self):
super(ControllerGUIFrame, self).__init__()
self.init_ui()
def init_ui(self):
self.ui = QTControllerGUIFrame()
self.ui.setupUi(self)
self.ui.start_button.clicked.connect(self.start_button_clk)
self.ui.kill_button.clicked.connect(self.kill_button_clk)
self.ui.restart_button.clicked.connect(self.restart_button_clk)
self.ui.controller_combo.addItem("%s_arm_controller")
self.ui.controller_combo.addItem("%s_cart")
self.ui.controller_combo.addItem("%s_joint_controller_low")
def start_button_clk(self):
controller = str(self.ui.controller_combo.currentText())
arm = str(self.ui.arm_combo.currentText())
ctrl_filled = controller % arm[0]
Popen("rosrun pr2_controller_manager pr2_controller_manager spawn %s" % ctrl_filled,
shell=True)
def kill_button_clk(self):
controller = str(self.ui.controller_combo.currentText())
arm = str(self.ui.arm_combo.currentText())
ctrl_filled = controller % arm[0]
Popen("rosrun pr2_controller_manager pr2_controller_manager kill %s" % ctrl_filled,
shell=True)
def restart_button_clk(self):
controller = str(self.ui.controller_combo.currentText())
arm = str(self.ui.arm_combo.currentText())
ctrl_filled = controller % arm[0]
Popen("rosrun pr2_controller_manager pr2_controller_manager kill %s" % ctrl_filled,
shell=True)
rospy.sleep(0.1)
Popen("rosrun pr2_controller_manager pr2_controller_manager spawn %s" % ctrl_filled,
shell=True)
def main():
rospy.init_node("controller_gui")
app = QtGui.QApplication(sys.argv)
frame = ControllerGUIFrame()
frame.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main()
| [
[
1,
0,
0.0492,
0.0164,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0656,
0.0164,
0,
0.66,
0.1111,
154,
0,
3,
0,
0,
154,
0,
0
],
[
1,
0,
0.082,
0.0164,
0,
0... | [
"import sys",
"from PyQt4 import QtCore, QtGui, uic",
"import roslib",
"roslib.load_manifest(\"rospy\")",
"import rospy",
"from controller_gui import Ui_Frame as QTControllerGUIFrame",
"from subprocess import Popen",
"class ControllerGUIFrame(QtGui.QFrame):\n def __init__(self):\n super(Cont... |
#! /usr/bin/python
import roslib
roslib.load_manifest('tf')
roslib.load_manifest('rosparam')
roslib.load_manifest('sensor_msgs')
import rospy
import rosparam
import rosbag
from sensor_msgs.msg import PointCloud2
from hrl_generic_arms.pose_converter import PoseConverter
from kelsey_sandbox.msg import PHRIPointCloudCapture
class PCSaver:
def __init__(self, pc_topic, base_frame, frames, filename):
self.base_frame = base_frame
self.frames = frames
self.seq = 0
self.bag = rosbag.Bag(filename, 'w')
rospy.Subscriber(pc_topic, PointCloud2, self.store_pc)
def store_pc(self, msg):
pcc = PHRIPointCloudCapture()
pcc.pc_capture = msg
pcc.saved_frames.header.seq = self.seq
pcc.saved_frames.header.frame_id = self.base_frame
pcc.saved_frames.header.stamp = rospy.Time.now()
for frame in self.frames:
try:
pos, quat = self.tf_list.lookupTransform(self.base_frame,
frame, rospy.Time(0))
pcc.saved_frames.poses.append(PoseConverter.to_pose_msg(pos, quat))
except:
print "FAILED TO CAPTURE POINTCLOUD, MISSING FRAME: %s" % frame
return
self.pcc = pcc
def save_pc(self):
self.bag.write("/point_cloud_captures", self.pcc)
self.seq += 1
def main():
rospy.init_node('phri_setup_capture')
from optparse import OptionParser
p = OptionParser()
p.add_option('-l', '--load_file', dest="load_file", default="",
help="YAML file to load parameters from.")
p.add_option('-b', '--bagfile', dest="bagname", default="phri_output.bag",
help="Bag file to save to.")
opts, args = p.parse_args()
assert opts.load_file != ""
params = rosparam.load_file(opts.load_file, "phri_setup_capture")[0][0]
base_frame = params['base_frame']
frames = params['frames_to_save']
pc_topic = params['pc_topic']
pcs = PCSaver(pc_topic, base_frame, frames, opts.bagname)
while not rospy.is_shutdown():
raw_input("Type 'd' when done: ")
pcs.save_pc()
pcs.bag.close()
if __name__ == "__main__":
main()
| [
[
1,
0,
0.0435,
0.0145,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.058,
0.0145,
0,
0.66,
0.0833,
630,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.0725,
0.0145,
0,
0.6... | [
"import roslib",
"roslib.load_manifest('tf')",
"roslib.load_manifest('rosparam')",
"roslib.load_manifest('sensor_msgs')",
"import rospy",
"import rosparam",
"import rosbag",
"from sensor_msgs.msg import PointCloud2",
"from hrl_generic_arms.pose_converter import PoseConverter",
"from kelsey_sandbox... |
#! /usr/bin/python
import sys
import numpy as np
import copy
import roslib
roslib.load_manifest("hrl_pr2_arms")
roslib.load_manifest("kelsey_sandbox")
import rospy
from visualization_msgs.msg import Marker, MarkerArray
from geometry_msgs.msg import Point, Quaternion, Vector3, PoseStamped
from std_msgs.msg import ColorRGBA
from sensor_msgs.msg import JointState
import tf.transformations as tf_trans
from equilibrium_point_control.pose_converter import PoseConverter
import urdf_interface as urdf
import kdl_parser as kdlp
from hrl_pr2_arms.kdl_arm_kinematics import KDLArmKinematics
from equilibrium_point_control.pose_converter import PoseConverter
from hrl_pr2_arms.pr2_arm_kinematics import PR2ArmKinematics
from hrl_pr2_arms.pr2_arm import PR2ArmJointTrajectory, PR2ArmJTranspose
from spheroid_space import SpheroidSpace
JOINT_STATE_INDS_R = [17, 18, 16, 20, 19, 21, 22]
JOINT_STATE_INDS_L = [29, 30, 28, 32, 31, 33, 34]
class SpheroidViz:
def __init__(self):
rot = np.mat([[1, 0, 0], [0, 1./np.sqrt(2), -1./np.sqrt(2)], [0, 1./np.sqrt(2), 1./np.sqrt(2)]])
self.sspace = SpheroidSpace(0.2)#, np.mat([1.0, 0.5, 0.5]).T, rot)
self.colors = [ColorRGBA(1., 0., 0., 1.), ColorRGBA(0., 1., 0., 1.)]
self.vis_pub = rospy.Publisher("force_torque_markers_array", MarkerArray)
self.pose_pub = rospy.Publisher("spheroid_poses", PoseStamped)
m = Marker()
m.header.frame_id = "torso_lift_link"
m.header.stamp = rospy.Time()
m.ns = "force_torque"
m.id = 0
m.type = Marker.ARROW
m.action = Marker.ADD
#m.points.append(Point(0, 0, 0))
m.scale = Vector3(0.01, 0.01, 0.01)
m.color = self.colors[0]
#self.vis_pub.publish(m)
self.m = m
self.ma = MarkerArray()
def publish_vector(self, m_id):
new_m = copy.deepcopy(self.m)
new_m.id = m_id
u, v, p = 1, np.random.uniform(0, np.pi), np.random.uniform(0, 2 * np.pi)
pos = self.sspace.spheroidal_to_cart((u, v, p))
new_m.points.append(Point(*pos))
df_du = self.sspace.partial_u((u, v, p))
df_du *= 0.1 / np.linalg.norm(df_du)
new_m.points.append(Point(*(pos+df_du)))
self.ma.markers.append(new_m)
self.vis_pub.publish(self.ma)
rot_gripper = np.pi/4.
nx, ny, nz = df_du.T.A[0] / np.linalg.norm(df_du)
j = np.sqrt(1./(1.+ny*ny/(nz*nz)))
k = -ny*j/nz
norm_rot = np.mat([[-nx, ny*k - nz*j, 0],
[-ny, -nx*k, j],
[-nz, nx*j, k]])
_, norm_quat = PoseConverter.to_pos_quat(np.mat([0, 0, 0]).T, norm_rot)
rot_angle = np.arctan(-norm_rot[2,1] / norm_rot[2,2])
quat_ortho_rot = tf_trans.quaternion_from_euler(rot_angle + np.pi + rot_gripper, 0.0, 0.0)
norm_quat_ortho = tf_trans.quaternion_multiply(norm_quat, quat_ortho_rot)
ps_msg = PoseConverter.to_pose_stamped_msg("torso_lift_link", pos, norm_quat_ortho)
self.pose_pub.publish(ps_msg)
def fix_pr2_angs(q, min_lims, max_lims):
q_mod = np.mod(q, 2 * np.pi)
in_lims_a = np.clip(q_mod, min_lims, max_lims) == q_mod
in_lims_b = np.clip(q_mod - 2 * np.pi, min_lims, max_lims) == q_mod
if np.all(np.any([in_lims_a, in_lims_b])):
return np.where(in_lims_a, q_mod, q_mod - 2 * np.pi)
return None
def main():
rospy.init_node("ellipsoidal_ik")
sspace = SpheroidSpace(0.2, np.mat([0.78, -0.28, 0.3]).T)
kin = PR2ArmKinematics('r')
jarm = PR2ArmJointTrajectory('r', kin)
while not rospy.is_shutdown():
u, v, p = 1, np.random.uniform(0, np.pi), np.random.uniform(0, 2 * np.pi)
pos, rot = sspace.spheroidal_to_pose((u, v, p))
q = kin.IK(pos, rot)
if not q is None:
print q
#print np.mod(q, 2 * np.pi)
rospy.sleep(0.1)
#jarm.set_ep([0.1]*7, 15)
return
jfv = SpheroidViz()
i = 0
while not rospy.is_shutdown():
jfv.publish_vector(i)
i += 1
rospy.sleep(0.5)
return
if __name__ == "__main__":
main()
| [
[
1,
0,
0.0254,
0.0085,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0339,
0.0085,
0,
0.66,
0.04,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0424,
0.0085,
0,
0.... | [
"import sys",
"import numpy as np",
"import copy",
"import roslib",
"roslib.load_manifest(\"hrl_pr2_arms\")",
"roslib.load_manifest(\"kelsey_sandbox\")",
"import rospy",
"from visualization_msgs.msg import Marker, MarkerArray",
"from geometry_msgs.msg import Point, Quaternion, Vector3, PoseStamped",... |
import sys
import subprocess
import numpy as np
from collections import deque
import roslib
roslib.load_manifest("rospy")
roslib.load_manifest("tf")
roslib.load_manifest("hrl_pr2_arms")
roslib.load_manifest("smach_ros")
roslib.load_manifest("actionlib")
import tf
import tf.transformations as tf_trans
import rospy
from std_msgs.msg import *
from geometry_msgs.msg import *
import actionlib
import smach
import smach_ros
import rosparam
#from hrl_pr2_arms.pr2_arm import create_pr2_arm, PR2ArmJointTrajectory, PR2ArmJTranspose
from hrl_pr2_arms.pr2_arm import *
from hrl_pr2_arms.pr2_controller_switcher import ControllerSwitcher
from hrl_generic_arms.pose_converter import PoseConverter
| [
[
1,
0,
0.0417,
0.0417,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0833,
0.0417,
0,
0.66,
0.0476,
394,
0,
1,
0,
0,
394,
0,
0
],
[
1,
0,
0.125,
0.0417,
0,
0... | [
"import sys",
"import subprocess",
"import numpy as np",
"from collections import deque",
"import roslib",
"roslib.load_manifest(\"rospy\")",
"roslib.load_manifest(\"tf\")",
"roslib.load_manifest(\"hrl_pr2_arms\")",
"roslib.load_manifest(\"smach_ros\")",
"roslib.load_manifest(\"actionlib\")",
"i... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'arm_cart_control_gui.ui'
#
# Created: Sat Feb 11 08:02:57 2012
# by: PyQt4 UI code generator 4.7.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_Frame(object):
def setupUi(self, Frame):
Frame.setObjectName("Frame")
Frame.resize(702, 521)
Frame.setFrameShape(QtGui.QFrame.StyledPanel)
Frame.setFrameShadow(QtGui.QFrame.Raised)
self.frame = QtGui.QComboBox(Frame)
self.frame.setGeometry(QtCore.QRect(420, 430, 261, 31))
self.frame.setEditable(True)
self.frame.setObjectName("frame")
self.label_2 = QtGui.QLabel(Frame)
self.label_2.setGeometry(QtCore.QRect(330, 430, 71, 31))
self.label_2.setStyleSheet("font: 16pt;")
self.label_2.setObjectName("label_2")
self.layoutWidget = QtGui.QWidget(Frame)
self.layoutWidget.setGeometry(QtCore.QRect(360, 50, 321, 311))
self.layoutWidget.setObjectName("layoutWidget")
self.gridLayout = QtGui.QGridLayout(self.layoutWidget)
self.gridLayout.setObjectName("gridLayout")
self.rotate_x_pos = QtGui.QPushButton(self.layoutWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.rotate_x_pos.sizePolicy().hasHeightForWidth())
self.rotate_x_pos.setSizePolicy(sizePolicy)
self.rotate_x_pos.setBaseSize(QtCore.QSize(80, 80))
self.rotate_x_pos.setStyleSheet("image: url(:/resources/roate_x_neg.png);\n"
"background-image: url(:/resources/empty.png);")
self.rotate_x_pos.setText("")
self.rotate_x_pos.setObjectName("rotate_x_pos")
self.gridLayout.addWidget(self.rotate_x_pos, 0, 0, 1, 1)
self.rotate_y_pos = QtGui.QPushButton(self.layoutWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.rotate_y_pos.sizePolicy().hasHeightForWidth())
self.rotate_y_pos.setSizePolicy(sizePolicy)
self.rotate_y_pos.setBaseSize(QtCore.QSize(80, 80))
self.rotate_y_pos.setStyleSheet("image: url(:/resources/rotate_y_pos.png);\n"
"background-image: url(:/resources/empty.png);")
self.rotate_y_pos.setText("")
self.rotate_y_pos.setObjectName("rotate_y_pos")
self.gridLayout.addWidget(self.rotate_y_pos, 0, 1, 1, 1)
self.rotate_x_neg = QtGui.QPushButton(self.layoutWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.rotate_x_neg.sizePolicy().hasHeightForWidth())
self.rotate_x_neg.setSizePolicy(sizePolicy)
self.rotate_x_neg.setBaseSize(QtCore.QSize(80, 80))
self.rotate_x_neg.setStyleSheet("image: url(:/resources/roate_x_pos.png);\n"
"background-image: url(:/resources/empty.png);")
self.rotate_x_neg.setText("")
self.rotate_x_neg.setObjectName("rotate_x_neg")
self.gridLayout.addWidget(self.rotate_x_neg, 0, 2, 1, 1)
self.rotate_z_neg = QtGui.QPushButton(self.layoutWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.rotate_z_neg.sizePolicy().hasHeightForWidth())
self.rotate_z_neg.setSizePolicy(sizePolicy)
self.rotate_z_neg.setBaseSize(QtCore.QSize(80, 80))
self.rotate_z_neg.setStyleSheet("image: url(:/resources/rotate_z_neg.png);\n"
"background-image: url(:/resources/empty.png);")
self.rotate_z_neg.setText("")
self.rotate_z_neg.setObjectName("rotate_z_neg")
self.gridLayout.addWidget(self.rotate_z_neg, 1, 0, 1, 1)
self.rotate_z_pos = QtGui.QPushButton(self.layoutWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.rotate_z_pos.sizePolicy().hasHeightForWidth())
self.rotate_z_pos.setSizePolicy(sizePolicy)
self.rotate_z_pos.setBaseSize(QtCore.QSize(80, 80))
self.rotate_z_pos.setStyleSheet("image: url(:/resources/rotate_z_pos.png);\n"
"background-image: url(:/resources/empty.png);")
self.rotate_z_pos.setText("")
self.rotate_z_pos.setObjectName("rotate_z_pos")
self.gridLayout.addWidget(self.rotate_z_pos, 1, 2, 1, 1)
self.rotate_y_neg = QtGui.QPushButton(self.layoutWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.rotate_y_neg.sizePolicy().hasHeightForWidth())
self.rotate_y_neg.setSizePolicy(sizePolicy)
self.rotate_y_neg.setBaseSize(QtCore.QSize(80, 80))
self.rotate_y_neg.setStyleSheet("image: url(:/resources/rotate_y_neg.png);\n"
"background-image: url(:/resources/empty.png);")
self.rotate_y_neg.setText("")
self.rotate_y_neg.setObjectName("rotate_y_neg")
self.gridLayout.addWidget(self.rotate_y_neg, 2, 1, 1, 1)
self.label_3 = QtGui.QLabel(self.layoutWidget)
self.label_3.setStyleSheet("background-image: url(:/resources/empty.png);\n"
"image: url(:/resources/arm_gripper.png);")
self.label_3.setText("")
self.label_3.setObjectName("label_3")
self.gridLayout.addWidget(self.label_3, 1, 1, 1, 1)
self.layoutWidget1 = QtGui.QWidget(Frame)
self.layoutWidget1.setGeometry(QtCore.QRect(20, 390, 271, 111))
self.layoutWidget1.setObjectName("layoutWidget1")
self.horizontalLayout = QtGui.QHBoxLayout(self.layoutWidget1)
self.horizontalLayout.setObjectName("horizontalLayout")
self.label = QtGui.QLabel(self.layoutWidget1)
self.label.setStyleSheet("font: 20pt;")
self.label.setObjectName("label")
self.horizontalLayout.addWidget(self.label)
self.arm_left = QtGui.QPushButton(self.layoutWidget1)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.arm_left.sizePolicy().hasHeightForWidth())
self.arm_left.setSizePolicy(sizePolicy)
self.arm_left.setBaseSize(QtCore.QSize(80, 80))
self.arm_left.setStyleSheet("image: url(:/resources/arm_left_off.png);\n"
"background-image: url(:/resources/empty.png);")
self.arm_left.setObjectName("arm_left")
self.horizontalLayout.addWidget(self.arm_left)
self.arm_right = QtGui.QPushButton(self.layoutWidget1)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.arm_right.sizePolicy().hasHeightForWidth())
self.arm_right.setSizePolicy(sizePolicy)
self.arm_right.setBaseSize(QtCore.QSize(80, 80))
self.arm_right.setStyleSheet("image: url(:/resources/arm_right_off.png);\n"
"background-image: url(:/resources/empty.png);")
self.arm_right.setObjectName("arm_right")
self.horizontalLayout.addWidget(self.arm_right)
self.label_5 = QtGui.QLabel(Frame)
self.label_5.setGeometry(QtCore.QRect(470, 10, 151, 31))
self.label_5.setStyleSheet("font: 20pt;")
self.label_5.setObjectName("label_5")
self.label_4 = QtGui.QLabel(Frame)
self.label_4.setGeometry(QtCore.QRect(110, 10, 151, 31))
self.label_4.setStyleSheet("font: 20pt;")
self.label_4.setObjectName("label_4")
self.layoutWidget_2 = QtGui.QWidget(Frame)
self.layoutWidget_2.setGeometry(QtCore.QRect(20, 50, 321, 311))
self.layoutWidget_2.setObjectName("layoutWidget_2")
self.gridLayout_2 = QtGui.QGridLayout(self.layoutWidget_2)
self.gridLayout_2.setObjectName("gridLayout_2")
self.translate_out = QtGui.QPushButton(self.layoutWidget_2)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.translate_out.sizePolicy().hasHeightForWidth())
self.translate_out.setSizePolicy(sizePolicy)
self.translate_out.setBaseSize(QtCore.QSize(80, 80))
self.translate_out.setStyleSheet("image: url(:/resources/translate_out.png);\n"
"background-image: url(:/resources/empty.png);")
self.translate_out.setText("")
self.translate_out.setObjectName("translate_out")
self.gridLayout_2.addWidget(self.translate_out, 0, 0, 1, 1)
self.translate_up = QtGui.QPushButton(self.layoutWidget_2)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.translate_up.sizePolicy().hasHeightForWidth())
self.translate_up.setSizePolicy(sizePolicy)
self.translate_up.setBaseSize(QtCore.QSize(80, 80))
self.translate_up.setStyleSheet("image: url(:/resources/translate_up.png);\n"
"background-image: url(:/resources/empty.png);")
self.translate_up.setText("")
self.translate_up.setObjectName("translate_up")
self.gridLayout_2.addWidget(self.translate_up, 0, 1, 1, 1)
self.translate_in = QtGui.QPushButton(self.layoutWidget_2)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.translate_in.sizePolicy().hasHeightForWidth())
self.translate_in.setSizePolicy(sizePolicy)
self.translate_in.setBaseSize(QtCore.QSize(80, 80))
self.translate_in.setStyleSheet("image: url(:/resources/translate_in.png);\n"
"background-image: url(:/resources/empty.png);")
self.translate_in.setText("")
self.translate_in.setObjectName("translate_in")
self.gridLayout_2.addWidget(self.translate_in, 0, 2, 1, 1)
self.translate_left = QtGui.QPushButton(self.layoutWidget_2)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.translate_left.sizePolicy().hasHeightForWidth())
self.translate_left.setSizePolicy(sizePolicy)
self.translate_left.setBaseSize(QtCore.QSize(80, 80))
self.translate_left.setStyleSheet("image: url(:/resources/translate_left.png);\n"
"background-image: url(:/resources/empty.png);")
self.translate_left.setText("")
self.translate_left.setObjectName("translate_left")
self.gridLayout_2.addWidget(self.translate_left, 1, 0, 1, 1)
self.translate_right = QtGui.QPushButton(self.layoutWidget_2)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.translate_right.sizePolicy().hasHeightForWidth())
self.translate_right.setSizePolicy(sizePolicy)
self.translate_right.setBaseSize(QtCore.QSize(80, 80))
self.translate_right.setStyleSheet("image: url(:/resources/translate_right.png);\n"
"background-image: url(:/resources/empty.png);")
self.translate_right.setText("")
self.translate_right.setObjectName("translate_right")
self.gridLayout_2.addWidget(self.translate_right, 1, 2, 1, 1)
self.translate_down = QtGui.QPushButton(self.layoutWidget_2)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.translate_down.sizePolicy().hasHeightForWidth())
self.translate_down.setSizePolicy(sizePolicy)
self.translate_down.setBaseSize(QtCore.QSize(80, 80))
self.translate_down.setStyleSheet("image: url(:/resources/translate_down.png);\n"
"background-image: url(:/resources/empty.png);")
self.translate_down.setText("")
self.translate_down.setObjectName("translate_down")
self.gridLayout_2.addWidget(self.translate_down, 2, 1, 1, 1)
self.retranslateUi(Frame)
QtCore.QMetaObject.connectSlotsByName(Frame)
def retranslateUi(self, Frame):
Frame.setWindowTitle(QtGui.QApplication.translate("Frame", "Frame", None, QtGui.QApplication.UnicodeUTF8))
self.label_2.setText(QtGui.QApplication.translate("Frame", "Frame", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("Frame", "Arm", None, QtGui.QApplication.UnicodeUTF8))
self.arm_left.setText(QtGui.QApplication.translate("Frame", "Left Arm", None, QtGui.QApplication.UnicodeUTF8))
self.arm_right.setText(QtGui.QApplication.translate("Frame", "Right Arm", None, QtGui.QApplication.UnicodeUTF8))
self.label_5.setText(QtGui.QApplication.translate("Frame", "Rotation", None, QtGui.QApplication.UnicodeUTF8))
self.label_4.setText(QtGui.QApplication.translate("Frame", "Translation", None, QtGui.QApplication.UnicodeUTF8))
import icons_rc
| [
[
1,
0,
0.042,
0.0042,
0,
0.66,
0,
154,
0,
2,
0,
0,
154,
0,
0
],
[
3,
0,
0.521,
0.9454,
0,
0.66,
0.5,
206,
0,
2,
0,
0,
186,
0,
99
],
[
2,
1,
0.5042,
0.9034,
1,
0.34... | [
"from PyQt4 import QtCore, QtGui",
"class Ui_Frame(object):\n def setupUi(self, Frame):\n Frame.setObjectName(\"Frame\")\n Frame.resize(702, 521)\n Frame.setFrameShape(QtGui.QFrame.StyledPanel)\n Frame.setFrameShadow(QtGui.QFrame.Raised)\n self.frame = QtGui.QComboBox(Frame)\... |
#! /usr/bin/python
import roslib; roslib.load_manifest('kelsey_sandbox')
import rospy
import roslib.message
import rosbag
import sys
import rosservice
from datetime import datetime
from hrl_lib.util import save_pickle
import yaml
#from hrl_lib import *
#from tabletop_object_detector.srv import TabletopDetection
if __name__ == "__main__":
service_args = []
for arg in sys.argv[2:]:
if arg == '':
arg = "''"
service_args.append(yaml.load(arg))
req, resp = rosservice.call_service(sys.argv[1], service_args)
a = datetime.now().isoformat('-')
name = '-'.join(a.split(':')).split('.')[0]
save_pickle(resp, sys.argv[1].split('/')[-1] + name + ".pickle")
| [
[
1,
0,
0.1154,
0.0385,
0,
0.66,
0,
796,
0,
1,
0,
0,
796,
0,
0
],
[
8,
0,
0.1154,
0.0385,
0,
0.66,
0.1,
630,
3,
1,
0,
0,
0,
0,
1
],
[
1,
0,
0.1538,
0.0385,
0,
0.66,... | [
"import roslib; roslib.load_manifest('kelsey_sandbox')",
"import roslib; roslib.load_manifest('kelsey_sandbox')",
"import rospy",
"import roslib.message",
"import rosbag",
"import sys",
"import rosservice",
"from datetime import datetime",
"from hrl_lib.util import save_pickle",
"import yaml",
"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.