Skip to content

Commit f7e7b07

Browse files
Update to new version : 0.3.0.0
1 parent 8877b49 commit f7e7b07

File tree

112 files changed

+2651
-669
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+2651
-669
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import clr
2+
import os
3+
4+
_dll_path = os.path.realpath(os.path.join(os.path.dirname(__file__), 'lib', 'UnderAutomation.Staubli.dll'))
5+
clr.AddReference(_dll_path)
6+
7+
__author__ = 'UnderAutomation'
Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,37 @@
11
import typing
22
from underautomation.staubli.soap.internal.soap_connect_parameters_base import SoapConnectParametersBase
3-
import clr
4-
import os
5-
clr.AddReference(os.path.realpath(os.path.join(os.path.dirname(__file__), "..", 'lib', 'UnderAutomation.Staubli.dll')))
63
from UnderAutomation.Staubli.Common import SoapConnectParameters as soap_connect_parameters
74

85
class SoapConnectParameters(SoapConnectParametersBase):
6+
'''SOAP connection parameters for communicating with the Staubli robot controller.'''
97
def __init__(self, _internal = 0):
108
if(_internal == 0):
119
self._instance = soap_connect_parameters()
1210
else:
1311
self._instance = _internal
12+
1413
@property
1514
def enable(self) -> bool:
15+
'''Should use this service (default: true)'''
1616
return self._instance.Enable
17+
1718
@enable.setter
1819
def enable(self, value: bool):
1920
self._instance.Enable = value
2021

21-
SoapConnectParameters.defaul_t__port = SoapConnectParameters(soap_connect_parameters.DEFAULT_PORT)
22+
def __str__(self):
23+
return self._instance.ToString() if self._instance is not None else ""
24+
25+
def __repr__(self):
26+
return self.__str__()
27+
28+
def __eq__(self, other) -> bool:
29+
if not isinstance(other, SoapConnectParameters):
30+
NotImplemented
31+
return self._instance.Equals(other._instance)
32+
33+
def __hash__(self) -> int:
34+
return self._instance.GetHashCode() if self._instance is not None else 0
35+
36+
# Default port for SOAP service
37+
SoapConnectParameters.DEFAULT_PORT = soap_connect_parameters.DEFAULT_PORT
Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,59 @@
11
import typing
22
from underautomation.staubli.common.soap_connect_parameters import SoapConnectParameters
3-
import clr
4-
import os
5-
clr.AddReference(os.path.realpath(os.path.join(os.path.dirname(__file__), 'lib', 'UnderAutomation.Staubli.dll')))
63
from UnderAutomation.Staubli import ConnectionParameters as connection_parameters
74

85
class ConnectionParameters:
6+
'''Connection parameters'''
97
def __init__(self, address: str, _internal = 0):
8+
'''Instanciate a new connection parameters with a specified address'''
109
if(_internal == 0):
1110
self._instance = connection_parameters(address)
1211
else:
1312
self._instance = _internal
13+
14+
def equals(self, obj: typing.Any) -> bool:
15+
return self._instance.Equals(obj)
16+
17+
def get_hash_code(self) -> int:
18+
return self._instance.GetHashCode()
19+
1420
@property
1521
def address(self) -> str:
22+
'''Address of the robot (IP or host name)'''
1623
return self._instance.Address
24+
1725
@address.setter
1826
def address(self, value: str):
1927
self._instance.Address = value
28+
2029
@property
2130
def ping_before_connect(self) -> bool:
31+
'''Send a ping command before initializing any connections'''
2232
return self._instance.PingBeforeConnect
33+
2334
@ping_before_connect.setter
2435
def ping_before_connect(self, value: bool):
2536
self._instance.PingBeforeConnect = value
37+
2638
@property
2739
def soap(self) -> SoapConnectParameters:
40+
'''Soap connection parameters'''
2841
return SoapConnectParameters(self._instance.Soap)
42+
2943
@soap.setter
3044
def soap(self, value: SoapConnectParameters):
3145
self._instance.Soap = value._instance if value else None
46+
47+
def __str__(self):
48+
return self._instance.ToString() if self._instance is not None else ""
49+
50+
def __repr__(self):
51+
return self.__str__()
52+
53+
def __eq__(self, other) -> bool:
54+
if not isinstance(other, ConnectionParameters):
55+
NotImplemented
56+
return self._instance.Equals(other._instance)
57+
58+
def __hash__(self) -> int:
59+
return self._instance.GetHashCode() if self._instance is not None else 0
7.5 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.1.1
1+
0.3.0.0
Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
11
import typing
22
from underautomation.staubli.license.license_info import LicenseInfo
3-
import clr
4-
import os
5-
clr.AddReference(os.path.realpath(os.path.join(os.path.dirname(__file__), "..", 'lib', 'UnderAutomation.Staubli.dll')))
63
from UnderAutomation.Staubli.License import InvalidLicenseException as invalid_license_exception
74

85
class InvalidLicenseException:
6+
'''Exception thrown while using the product if the license is not valid.'''
97
def __init__(self, _internal = 0):
108
if(_internal == 0):
119
self._instance = invalid_license_exception()
1210
else:
1311
self._instance = _internal
12+
1413
@property
1514
def license_info(self) -> LicenseInfo:
15+
'''The license that causes this exception'''
1616
return LicenseInfo(None, None, self._instance.LicenseInfo)
17+
18+
def __str__(self):
19+
return self._instance.ToString() if self._instance is not None else ""
20+
21+
def __repr__(self):
22+
return self.__str__()
23+
24+
def __eq__(self, other) -> bool:
25+
if not isinstance(other, InvalidLicenseException):
26+
NotImplemented
27+
return self._instance.Equals(other._instance)
28+
29+
def __hash__(self) -> int:
30+
return self._instance.GetHashCode() if self._instance is not None else 0
Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,92 @@
11
import typing
22
from datetime import datetime, timedelta
33
from underautomation.staubli.license.license_state import LicenseState
4-
import clr
5-
import os
6-
clr.AddReference(os.path.realpath(os.path.join(os.path.dirname(__file__), "..", 'lib', 'UnderAutomation.Staubli.dll')))
74
from UnderAutomation.Staubli.License import LicenseInfo as license_info
85
from UnderAutomation.Staubli.License import LicenseState as license_state
96

107
class LicenseInfo:
8+
'''Information about a license key'''
119
def __init__(self, licenseIdentifier: str, licenseKey: str, _internal = 0):
10+
'''Create a new LicenseInfo instance to retrieve informations about a pair of identifier/key This class should not be used to register your product. Please use static function RegisterLicense to specify your license.
11+
12+
:param licenseIdentifier: The name of your organization (null for trial version)
13+
:param licenseKey: The key, associated to the identifier, supplied by UnderAutomation (null for trial version)
14+
'''
1215
if(_internal == 0):
1316
self._instance = license_info(licenseIdentifier, licenseKey)
1417
else:
1518
self._instance = _internal
16-
def __repr__(self):
17-
return self._instance.ToString() if self._instance is not None else ""
19+
1820
@property
1921
def is_licensed(self) -> bool:
22+
'''True if the license state is Licensed, Trial or ExtraTrial ; false otherwise'''
2023
return self._instance.IsLicensed
24+
2125
@property
2226
def license_key(self) -> str:
27+
'''The license key supplied by UnderAutomation (null for trial period)'''
2328
return self._instance.LicenseKey
29+
2430
@property
2531
def product(self) -> str:
32+
'''Commercial name of this .NET Software library'''
2633
return self._instance.Product
34+
2735
@property
2836
def evaluation_days_left(self) -> int | None:
37+
'''Remaining days of the trial period. Null if the product is licensed. It could be negative if the trial period is ended since several days.'''
2938
return self._instance.EvaluationDaysLeft
39+
3040
@property
3141
def evaluation_start_date(self) -> datetime:
42+
'''The date the trial period starts. If the product is licensed, the date of the library first use.'''
3243
return datetime(1, 1, 1) + timedelta(microseconds=self._instance.EvaluationStartDate.Ticks // 10)
44+
3345
@property
3446
def licensee(self) -> str:
47+
'''Name of your organisation'''
3548
return self._instance.Licensee
49+
3650
@property
3751
def trial_period_expiration_date(self) -> datetime | None:
52+
'''The date the product will expire. Null if the product is licensed.'''
3853
return None if self._instance.TrialPeriodExpirationDate is None else datetime(1, 1, 1) + timedelta(microseconds=self._instance.TrialPeriodExpirationDate.Ticks // 10)
54+
3955
@property
4056
def state(self) -> LicenseState:
41-
return LicenseState(self._instance.State)
57+
'''The current license state'''
58+
return LicenseState(int(self._instance.State))
59+
4260
@property
4361
def product_release_date(self) -> datetime:
62+
'''The date this version of the product was released.'''
4463
return datetime(1, 1, 1) + timedelta(microseconds=self._instance.ProductReleaseDate.Ticks // 10)
64+
4565
@property
4666
def maintenance_years(self) -> int:
67+
'''Number of maintenance years included in your license'''
4768
return self._instance.MaintenanceYears
69+
4870
@property
4971
def license_issued_date(self) -> datetime | None:
72+
'''The date you get the license'''
5073
return None if self._instance.LicenseIssuedDate is None else datetime(1, 1, 1) + timedelta(microseconds=self._instance.LicenseIssuedDate.Ticks // 10)
74+
5175
@property
5276
def maintenance_expiration_date(self) -> datetime | None:
77+
'''The date your maintenance contract end and you no longer can use this license with newer versions.'''
5378
return None if self._instance.MaintenanceExpirationDate is None else datetime(1, 1, 1) + timedelta(microseconds=self._instance.MaintenanceExpirationDate.Ticks // 10)
79+
80+
def __str__(self):
81+
return self._instance.ToString() if self._instance is not None else ""
82+
83+
def __repr__(self):
84+
return self.__str__()
85+
86+
def __eq__(self, other) -> bool:
87+
if not isinstance(other, LicenseInfo):
88+
NotImplemented
89+
return self._instance.Equals(other._instance)
90+
91+
def __hash__(self) -> int:
92+
return self._instance.GetHashCode() if self._instance is not None else 0
Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
1-
import clr
2-
import os
3-
clr.AddReference(os.path.realpath(os.path.join(os.path.dirname(__file__), "..", 'lib', 'UnderAutomation.Staubli.dll')))
4-
from UnderAutomation.Staubli.License import LicenseState as license_state
1+
from enum import IntEnum
52

6-
class LicenseState(int):
7-
Invalid = int(license_state.Invalid)
8-
Trial = int(license_state.Trial)
9-
ExtraTrial = int(license_state.ExtraTrial)
10-
Expired = int(license_state.Expired)
11-
MaintenanceNeeded = int(license_state.MaintenanceNeeded)
12-
Licensed = int(license_state.Licensed)
13-
14-
def __repr__(self):
15-
for name, value in vars(LicenseState).items():
16-
if not name.startswith('_') and isinstance(value, int) and value == self:
17-
return name
18-
return str(int(self))
3+
class LicenseState(IntEnum):
4+
'''States that can take a license'''
5+
Invalid = 0 # The pair License Identifier and License Key are incompatible, you cannot use the library
6+
Trial = 1 # The library is in a trial period, you can use the library
7+
ExtraTrial = 2 # The library is in an extra trial period, you can use the library
8+
Expired = 3 # The trial period as expired, you no more can use the library
9+
MaintenanceNeeded = 4 # Your license does not allow you to use such a recent release. Please buy maintenance to use this version
10+
Licensed = 5 # Congratulations, the library is licensed.
Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
import clr
2-
import os
3-
clr.AddReference(os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..", 'lib', 'UnderAutomation.Staubli.dll')))
4-
from UnderAutomation.Staubli.Soap.Data import AboveBelowConfig as above_below_config
1+
from enum import IntEnum
52

6-
class AboveBelowConfig(int):
7-
Same = int(above_below_config.Same)
8-
Above = int(above_below_config.Above)
9-
Below = int(above_below_config.Below)
10-
Free = int(above_below_config.Free)
11-
12-
def __repr__(self):
13-
for name, value in vars(AboveBelowConfig).items():
14-
if not name.startswith('_') and isinstance(value, int) and value == self:
15-
return name
16-
return str(int(self))
3+
class AboveBelowConfig(IntEnum):
4+
'''Configuration for above/below joint orientation.'''
5+
Same = 0 # Keep the same configuration as the current one.
6+
Above = 1 # Above configuration.
7+
Below = 2 # Below configuration.
8+
Free = 3 # Free configuration (no constraint).
Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,62 @@
11
import typing
22
from underautomation.staubli.soap.data.shoulder_config import ShoulderConfig
33
from underautomation.staubli.soap.data.positive_negative_config import PositiveNegativeConfig
4-
import clr
5-
import os
6-
clr.AddReference(os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..", 'lib', 'UnderAutomation.Staubli.dll')))
74
from UnderAutomation.Staubli.Soap.Data import AnthroConfig as anthro_config
85
from UnderAutomation.Staubli.Soap.Data import ShoulderConfig as shoulder_config
96
from UnderAutomation.Staubli.Soap.Data import PositiveNegativeConfig as positive_negative_config
107

118
class AnthroConfig:
9+
'''Configuration for an anthropomorphic robot (shoulder, elbow, wrist).'''
1210
def __init__(self, _internal = 0):
11+
'''Initializes a new instance of the AnthroConfig class.'''
1312
if(_internal == 0):
1413
self._instance = anthro_config()
1514
else:
1615
self._instance = _internal
17-
def __repr__(self):
18-
return self._instance.ToString() if self._instance is not None else ""
16+
17+
def equals(self, obj: typing.Any) -> bool:
18+
return self._instance.Equals(obj)
19+
20+
def get_hash_code(self) -> int:
21+
return self._instance.GetHashCode()
22+
1923
@property
2024
def shoulder(self) -> ShoulderConfig:
21-
return ShoulderConfig(self._instance.Shoulder)
25+
'''Shoulder configuration.'''
26+
return ShoulderConfig(int(self._instance.Shoulder))
27+
2228
@shoulder.setter
2329
def shoulder(self, value: ShoulderConfig):
2430
self._instance.Shoulder = shoulder_config(int(value))
31+
2532
@property
2633
def elbow(self) -> PositiveNegativeConfig:
27-
return PositiveNegativeConfig(self._instance.Elbow)
34+
'''Elbow configuration.'''
35+
return PositiveNegativeConfig(int(self._instance.Elbow))
36+
2837
@elbow.setter
2938
def elbow(self, value: PositiveNegativeConfig):
3039
self._instance.Elbow = positive_negative_config(int(value))
40+
3141
@property
3242
def wrist(self) -> PositiveNegativeConfig:
33-
return PositiveNegativeConfig(self._instance.Wrist)
43+
'''Wrist configuration.'''
44+
return PositiveNegativeConfig(int(self._instance.Wrist))
45+
3446
@wrist.setter
3547
def wrist(self, value: PositiveNegativeConfig):
3648
self._instance.Wrist = positive_negative_config(int(value))
49+
50+
def __str__(self):
51+
return self._instance.ToString() if self._instance is not None else ""
52+
53+
def __repr__(self):
54+
return self.__str__()
55+
56+
def __eq__(self, other) -> bool:
57+
if not isinstance(other, AnthroConfig):
58+
NotImplemented
59+
return self._instance.Equals(other._instance)
60+
61+
def __hash__(self) -> int:
62+
return self._instance.GetHashCode() if self._instance is not None else 0

0 commit comments

Comments
 (0)