Namespaces | |
namespace | py |
This module contains functions utilized by the MTConnect to ROS bridge nodes. | |
Functions | |
def | action_cb |
action_cb Function documentation | |
def | add_event |
add_event Function documentation | |
def | check_connectivity |
check_connectivity Function documentation | |
def | obtain_dataMap |
obtain_dataMap Function documentation. | |
def | set_goal |
set_goal Function documentation | |
def | split_event |
split_event Function documentation | |
def | type_check |
type_check Function documentation | |
def | xml_components |
xml_components Function documentation | |
def | xml_get_response |
xml_get_response Function documentation |
def bridge_library.action_cb | ( | data | ) |
action_cb Function documentation
This function sets the value of an Adapter Event. It is used to port XML tag changes back to machine tool.
This function takes the following arguments:
data,: | data is a tuple containing the following parameters: |
adapter,: | Adapter class object |
di_dict,: | dictionary {string:string}, stored Adapter Event class instances for each XML tag |
data_item,: | string, data item used to locate the Adapter Event |
state,: | string, Event will be changed to this value |
Definition at line 294 of file bridge_library.py.
def bridge_library.add_event | ( | data | ) |
add_event Function documentation
This function creates instances of the Adapter Event class for each of the XML tags provided to the function.
This function takes the following arguments:
data,: | data is a tuple containing the following parameters: |
adapter,: | Adapter class object |
tag_list,: | list of XML tags culled from node configuration file |
di_dict,: | dictionary {string:string}, stored Adapter Event class instances for each XML tag |
init,: | boolean, user specified boolean to determine if the Adapter Events must be initialized |
Definition at line 243 of file bridge_library.py.
def bridge_library.check_connectivity | ( | data | ) |
check_connectivity Function documentation
The purpose of this function is to determine if an HTTP connection is available. It will continue to try to make a connection up to a user specified time.
This function takes the following arguments:
data,: | data is a tuple containing the following parameters: |
tout,: | int, allowable time in seconds before the open request times out |
url,: | string, url that will be opened |
url_port,: | int, url port that will be concatenated to the url string |
Definition at line 97 of file bridge_library.py.
def bridge_library.obtain_dataMap | ( | ) |
obtain_dataMap Function documentation.
This function utilizes python option parser to determine the option filename. Once the file name is obtained, the .yaml file contents are stored in a dictionary. Program terminates if the option file is not available, or if it is in an incorrect YAML format.
This function does not take any arguments.
Definition at line 53 of file bridge_library.py.
def bridge_library.set_goal | ( | tag, | |
goals, | |||
root, | |||
ns, | |||
action_goals | |||
) |
set_goal Function documentation
This function extracts the machine tool request goal from the Event tag specified in the configuration file. For example, during MaterialLoad the request goal tag is Material which is an Event that stores the material specifications: material type, material length, material diameter.
The function takes the following arguments:
tag,: | string of the Event tag, i.e. 'MaterialLoad' |
goals,: | dictionary of the goal (str):goal attributes (list of strings) |
root,: | XML ElementTree object that converted the XML chunk in string format to an ElementTree object |
ns,: | dictionary, XML namespace dictionary |
action_goals,: | dictionary, stored action goals by XML tag key |
The function returns:
Definition at line 211 of file bridge_library.py.
def bridge_library.split_event | ( | xml_tag | ) |
split_event Function documentation
This function converts a data item Event string from CamelCase to camel_case
This function takes and returns the following arguments:
xml_tag,: | string, Event data item in CamelCase format |
Definition at line 276 of file bridge_library.py.
def bridge_library.type_check | ( | goal_type, | |
request | |||
) |
type_check Function documentation
This function checks the goal types and converts them to Python standard types. It then verifies if the goal type matches the type specified in the goal message.
This function takes the following arguments:
goal_type,: | string, goal_type from goal msg.__slot_types |
request,: | varies, actual goal value that is a float, int, string, etc. |
Definition at line 315 of file bridge_library.py.
def bridge_library.xml_components | ( | xml, | |
ns, | |||
tag_list, | |||
get_goal = False , |
|||
action_goals = None |
|||
) |
xml_components Function documentation
This function finds all elements in the updated XML. If an action goal is required, the string acquired from the XML is parsed and returned with the appropriate type. For example, if the goal is "'ALUMINUM 6061-T6', 5.00, 2.50", the function will convert this string into the following list ['ALUMINUM 6061-T6', 5.00, 2.50] which contains the following types: [str, float, float]
This function takes the following arguments:
xml,: | XML data, read from response.read() |
ns,: | dictionary, xml namespace dictionary |
tag_list,: | dictionary, xml tag stored as tag:goal or tag:tag pairs |
get_goal,: | boolean, optional parameter, used when a action goal is required |
action_goals,: | dictionary, optional parameter, stored action goals by XML tag key |
Function returns:
Definition at line 168 of file bridge_library.py.
def bridge_library.xml_get_response | ( | data | ) |
xml_get_response Function documentation
This function determines if an HTTP connection can be made. If so, it returns a response to a user specified "GET" request.
This function takes the following arguments:
data,: | data is a tuple containing the following parameters: |
url,: | string, url that will be opened |
url_port,: | int, url port that will be concatenated to the url string |
port,: | int, Adapter port used by MTConnect adapter.py module |
conn,: | Python httplib.HTTPConnection |
req,: | string, user specified selector url |
Definition at line 133 of file bridge_library.py.