mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-02-06 07:01:52 +08:00
[GUI] More fixes to use libfibre with the GUI
This commit is contained in:
6
GUI/package-lock.json
generated
6
GUI/package-lock.json
generated
@@ -3810,9 +3810,9 @@
|
||||
}
|
||||
},
|
||||
"caniuse-lite": {
|
||||
"version": "1.0.30001094",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001094.tgz",
|
||||
"integrity": "sha512-ufHZNtMaDEuRBpTbqD93tIQnngmJ+oBknjvr0IbFympSdtFpAUFmNv4mVKbb53qltxFx0nK3iy32S9AqkLzUNA==",
|
||||
"version": "1.0.30001178",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001178.tgz",
|
||||
"integrity": "sha512-VtdZLC0vsXykKni8Uztx45xynytOi71Ufx9T8kHptSw9AL4dpqailUJJHavttuzUe1KYuBYtChiWv+BAb7mPmQ==",
|
||||
"dev": true
|
||||
},
|
||||
"case-sensitive-paths-webpack-plugin": {
|
||||
|
||||
@@ -194,8 +194,9 @@ def dictFromRO(RO):
|
||||
returnDict[key[1:-9]] = {"val": val,
|
||||
"readonly": not hasattr(v, 'exchange'),
|
||||
"type": _type}
|
||||
elif not key.startswith('_') and isinstance(v, fibre.libfibre.RemoteFunction):
|
||||
elif not key.startswith('_') and hasattr(v, '__call__'):
|
||||
# this is a function - do nothing for now.
|
||||
print('found a function!',key)
|
||||
returnDict[key] = "function"
|
||||
|
||||
return returnDict
|
||||
@@ -205,7 +206,6 @@ def postVal(odrives, keyList, value, argType):
|
||||
# "key1" will be "odriveN"
|
||||
# like this: postVal(odrives, ["odrive0","axis0","config","calibration_lockin","accel"], 17.0)
|
||||
try:
|
||||
#index = int(''.join([char for char in keyList.pop(0) if char.isnumeric()]))
|
||||
odrv = keyList.pop(0)
|
||||
RO = odrives[odrv]
|
||||
keyList[-1] = '_' + keyList[-1] + '_property'
|
||||
@@ -229,21 +229,17 @@ def postVal(odrives, keyList, value, argType):
|
||||
|
||||
def getVal(odrives, keyList):
|
||||
try:
|
||||
#index = int(''.join([char for char in keyList.pop(0) if char.isnumeric()]))
|
||||
odrv = keyList.pop(0)
|
||||
RO = odrives[odrv]
|
||||
keyList[-1] = '_' + keyList[-1] + '_property'
|
||||
for key in keyList:
|
||||
RO = getattr(RO, key)
|
||||
if isinstance(RO, fibre.libfibre.RemoteObject):
|
||||
return dictFromRO(RO)
|
||||
else:
|
||||
retVal = RO.read()
|
||||
if retVal == math.inf:
|
||||
retVal = "Infinity"
|
||||
elif retVal == -math.inf:
|
||||
retVal = "-Infinity"
|
||||
return retVal
|
||||
retVal = RO.read()
|
||||
if retVal == math.inf:
|
||||
retVal = "Infinity"
|
||||
elif retVal == -math.inf:
|
||||
retVal = "-Infinity"
|
||||
return retVal
|
||||
except fibre.ObjectLostError:
|
||||
handle_disconnect(odrv)
|
||||
except Exception as ex:
|
||||
@@ -266,10 +262,10 @@ def callFunc(odrives, keyList):
|
||||
odrv = keyList.pop(0)
|
||||
RO = odrives[odrv]
|
||||
for key in keyList:
|
||||
RO = RO._remote_attributes[key]
|
||||
if isinstance(RO, fibre.remote_object.RemoteFunction):
|
||||
RO = getattr(RO, key)
|
||||
if hasattr(RO, '__call__'):
|
||||
RO.__call__()
|
||||
except fibre.protocol.ChannelBrokenException:
|
||||
except fibre.ObjectLostError:
|
||||
handle_disconnect(odrv)
|
||||
except:
|
||||
print("fcn call failed")
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
"GPIO_MODE_ENC2": 13,
|
||||
"GPIO_MODE_MECH_BRAKE": 14,
|
||||
"GPIO_MODE_STATUS": 15,
|
||||
"STREAM_PROTOCOL_TYPE_FIBRE": 0,
|
||||
"STREAM_PROTOCOL_TYPE_ASCII": 1,
|
||||
"STREAM_PROTOCOL_TYPE_STDOUT": 2,
|
||||
"STREAM_PROTOCOL_TYPE_ASCII_AND_STDOUT": 3,
|
||||
"PROTOCOL_SIMPLE": 1,
|
||||
"AXIS_STATE_UNDEFINED": 0,
|
||||
"AXIS_STATE_IDLE": 1,
|
||||
@@ -49,6 +53,7 @@
|
||||
"INPUT_MODE_TRAP_TRAJ": 5,
|
||||
"INPUT_MODE_TORQUE_RAMP": 6,
|
||||
"INPUT_MODE_MIRROR": 7,
|
||||
"INPUT_MODE_TUNING": 8,
|
||||
"MOTOR_TYPE_HIGH_CURRENT": 0,
|
||||
"MOTOR_TYPE_GIMBAL": 2,
|
||||
"MOTOR_TYPE_ACIM": 3,
|
||||
|
||||
@@ -27,7 +27,6 @@ export default {
|
||||
let keys = this.path.split('.');
|
||||
keys.shift();
|
||||
let val = getVal(keys.join('.'));
|
||||
console.log(val + ' ' + typeof val);
|
||||
return numberDisplay(val);
|
||||
},
|
||||
name: function () {
|
||||
|
||||
Reference in New Issue
Block a user