Axis error work again now, fixed top level .gitignore

This commit is contained in:
PAJohnson
2020-09-26 23:04:05 -04:00
parent 082453b05c
commit 0ec763bdb4
6 changed files with 40 additions and 15 deletions

6
.gitignore vendored
View File

@@ -61,3 +61,9 @@ ODrive\.files
ODrive\.includes
Firmware/Tests/bin/
# Electron-builder output
GUI/dist_electron
# Node Modules
GUI/node_modules

View File

@@ -1,6 +1,6 @@
# odrive_gui
Python requirements: `pip install python-socketio eventlet odrive`
Python requirements: `pip install flask flask_socketio flask_cors odrive`
If the default odrive python package is not desired, the path to the modules can be passed as command line arguments.

View File

@@ -20,7 +20,7 @@ app.config.update(
SESSION_COOKIE_SAMESITE='None'
)
CORS(app, support_credentials=True)
socketio = SocketIO(app, cors_allowed_origins="*")
socketio = SocketIO(app, cors_allowed_origins="*", async_mode = "threading")
def get_all_odrives():
globals()['odrives'] = []
@@ -98,6 +98,8 @@ def set_property(message):
globals()['inUse'] = True
print("From setProperty event handler: " + str(message))
postVal(globals()['odrives'], message["path"].split('.'), message["val"], message["type"])
val = getVal(globals()['odrives'], message["path"].split('.'))
emit('ODriveProperty', json.dumps({"path": message["path"], "val": val}))
globals()['inUse'] = False
@socketio.on('callFunction')

View File

@@ -61,7 +61,7 @@
<Axis
v-for="axis in axes"
:key="axis.name"
:axis="axis"
:axis="axis.name"
:odrives="odrives"
></Axis>
</div>

View File

@@ -4,9 +4,9 @@
@click.self="showError = !showError;"
:class="{ noError: !error, error: error}"
>
{{ axis.name }}
{{ axis }}
<div v-show="showError" class="error-popup card" @click.self="showError = !showError">
<clear-errors :data="{axis: axis.name.split('.')[1]}"/>
<clear-errors :data="{axis: axis.split('.')[1]}"/>
axis:
<span :class="{ noError: !axisError, error: axisError}">{{axisErrorMsg}}</span>
<br />motor:
@@ -26,6 +26,7 @@
<script>
import odriveEnums from "../assets/odriveEnums.json";
import clearErrors from "./clearErrors.vue";
import { getVal } from "../odrive_utils.js";
const axisErrors = {
0x00000000: "AXIS_ERROR_NONE",
@@ -102,12 +103,16 @@ export default {
data() {
return {
showError: false,
axisErr: undefined,
motorErr: undefined,
controllerErr: undefined,
encoderErr: undefined,
};
},
computed: {
axisErrorMsg() {
let retMsg = "none";
let errCode = parseInt(this.axis.ref.error.val);
let errCode = this.axisErr;
if (this.$store.state.currentDash == "Wizard") {
errCode &= ~odriveEnums.AXIS_ERROR_MOTOR_FAILED;
@@ -133,7 +138,7 @@ export default {
},
motorErrorMsg() {
let retMsg = "none";
let errCode = parseInt(this.axis.ref.motor.error.val);
let errCode = this.motorErr;
if (this.$store.state.currentDash == "Wizard") {
errCode &= ~odriveEnums.MOTOR_ERROR_PHASE_RESISTANCE_OUT_OF_RANGE;
@@ -158,7 +163,7 @@ export default {
},
encoderErrorMsg() {
let retMsg = "none";
let errCode = parseInt(this.axis.ref.encoder.error.val);
let errCode = this.encoderErr;
if (this.$store.state.currentDash == "Wizard") {
errCode &= ~odriveEnums.ENCODER_ERROR_CPR_POLEPAIRS_MISMATCH;
@@ -183,7 +188,7 @@ export default {
},
controllerErrorMsg() {
let retMsg = "none";
let errCode = parseInt(this.axis.ref.controller.error.val);
let errCode = this.controllerErr;
if (errCode != 0) {
// we got an error!
@@ -202,7 +207,7 @@ export default {
return retMsg;
},
axisError() {
let errCode = parseInt(this.axis.ref.error.val)
let errCode = this.axisErr;
if (this.$store.state.currentDash == "Wizard") {
errCode &= ~odriveEnums.AXIS_ERROR_MOTOR_FAILED;
errCode &= ~odriveEnums.AXIS_ERROR_ENCODER_FAILED;
@@ -210,7 +215,7 @@ export default {
return errCode != 0;
},
motorError() {
let errCode = parseInt(this.axis.ref.motor.error.val);
let errCode = this.motorErr;
if (this.$store.state.currentDash == "Wizard") {
errCode &= ~odriveEnums.MOTOR_ERROR_PHASE_RESISTANCE_OUT_OF_RANGE;
errCode &= ~odriveEnums.MOTOR_ERROR_PHASE_INDUCTANCE_OUT_OF_RANGE;
@@ -218,7 +223,7 @@ export default {
return errCode != 0;
},
encoderError() {
let errCode = parseInt(this.axis.ref.encoder.error.val);
let errCode = this.encoderErr;
if (this.$store.state.currentDash == "Wizard") {
errCode &= ~odriveEnums.ENCODER_ERROR_CPR_POLEPAIRS_MISMATCH;
errCode &= ~odriveEnums.ENCODER_ERROR_NO_RESPONSE;
@@ -226,13 +231,27 @@ export default {
return errCode != 0;
},
controllerError() {
let errCode = parseInt(this.axis.ref.controller.error.val);
let errCode = this.controllerErr;
return errCode != 0;
},
error() {
return this.axisError || this.motorError || this.encoderError || this.controllerError;
},
},
created() {
// set up timeout loop for grabbing axis error values
let update = () => {
this.axisErr = getVal(this.axis + '.error');
this.motorErr = getVal(this.axis + '.motor.error');
this.controllerErr = getVal(this.axis + '.controller.error');
this.encoderErr = getVal(this.axis + '.encoder.error');
setTimeout(update, 1000);
}
update();
console.log(this.axis);
console.log(this.axisErr);
console.log(this.motorErr);
}
};
</script>

View File

@@ -272,13 +272,11 @@ export default new Vuex.Store({
if ('axis0' in context.state.odrives[odrive]) {
axes.push({
name: `${odrive}.axis0`,
ref: context.state.odrives[odrive]['axis0']
});
}
if ('axis1' in context.state.odrives[odrive]) {
axes.push({
name: `${odrive}.axis1`,
ref: context.state.odrives[odrive]['axis1']
});
}
}