Skip to content

Commit

Permalink
motor data reading out and fixed sa part
Browse files Browse the repository at this point in the history
  • Loading branch information
neuenfeldttj committed Feb 18, 2024
1 parent b66415b commit edddf01
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 43 deletions.
6 changes: 3 additions & 3 deletions src/teleoperation/backend/consumers.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ def handle_sa_arm_message(self, msg):
sa_throttle_cmd.names = SA_NAMES

sa_throttle_cmd.throttles = [
self.sa_config[name]["multiplier"] * self.filter_xbox_axis(msg["axes"][info["xbox_index"]], 0.15, True)
for name, info in self.sa_config.items()
if name.startswith("sa")
self.sa_config[name]["multiplier"] * self.filter_xbox_axis(msg["axes"][self.sa_config["sa_x"]["xbox_index"]], 0.15, True),
self.sa_config[name]["multiplier"] * self.filter_xbox_axis(msg["axes"][self.sa_config["sa_y"]["xbox_index"]], 0.15, True),
self.sa_config[name]["multiplier"] * self.filter_xbox_axis(msg["axes"][self.sa_config["sa_z"]["xbox_index"]], 0.15, True),
]
sa_throttle_cmd.throttles.extend(
[
Expand Down
1 change: 0 additions & 1 deletion src/teleoperation/frontend/src/components/AutonTask.vue
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,3 @@ h2 {
grid-area: data;
}
</style>
>>>>>>> 9720704e91b679513a528bf4bb0e7521bcdaec68
20 changes: 15 additions & 5 deletions src/teleoperation/frontend/src/components/DMESTask.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import MotorsStatusTable from './MotorsStatusTable.vue'
import OdometryReading from './OdometryReading.vue'
import DriveControls from './DriveControls.vue'
import MastGimbalControls from './MastGimbalControls.vue'
import type ArmMoteusStateTableVue from './ArmMoteusStateTable.vue'
export default defineComponent({
components: {
Expand All @@ -82,8 +83,8 @@ export default defineComponent({
MotorsStatusTable,
OdometryReading,
DriveControls,
MastGimbalControls
},
MastGimbalControls,
},
props: {
type: {
Expand Down Expand Up @@ -113,7 +114,9 @@ export default defineComponent({
name: [] as string[],
position: [] as number[],
velocity: [] as number[],
effort: [] as number[]
effort: [] as number[],
state: [] as string[],
error: [] as string[]
}
}
},
Expand All @@ -124,12 +127,19 @@ export default defineComponent({
watch: {
message(msg) {
if (msg.type == 'joint_state') {
if (msg.type == 'drive_status') {
this.motorData.name = msg.name
this.motorData.position = msg.position
this.motorData.velocity = msg.velocity
this.motorData.effort = msg.effort
}
this.motorData.state = msg.state
this.motorData.error = msg.error
} else if (msg.type == 'drive_moteus') {
this.moteusDrive.name = msg.name
this.moteusDrive.state = msg.state
this.moteusDrive.error = msg.error
this.moteusDrive.limit_hit = msg.limit_hit
}
else if (msg.type == "center_map") {
this.odom.latitude_deg = msg.latitude
this.odom.longitude_deg = msg.longitude
Expand Down
61 changes: 27 additions & 34 deletions src/teleoperation/frontend/src/components/SATask.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ import SoilData from './SoilData.vue'
import BasicWaypointEditor from './BasicWaypointEditor.vue'
import DriveControls from './DriveControls.vue'
import MastGimbalControls from './MastGimbalControls.vue'
// import SAArmControls from "./SAArmControls.vue";
import PDBFuse from './PDBFuse.vue'
import Cameras from './Cameras.vue'
import DriveMoteusStateTable from './DriveMoteusStateTable.vue'
Expand All @@ -114,6 +113,7 @@ import MotorAdjust from './MotorAdjust.vue'
import OdometryReading from './OdometryReading.vue'
import SAArmControls from './SAArmControls.vue'
import { disableAutonLED, quaternionToMapAngle } from '../utils.js'
import { mapState } from 'vuex'
export default {
components: {
Expand Down Expand Up @@ -148,7 +148,9 @@ export default {
name: [] as string[],
position: [] as number[],
velocity: [] as number[],
effort: [] as number[]
effort: [] as number[],
state: [] as string[],
error: [] as string[]
},
// Moteus state table is set up to look for specific keys in moteusState so it can't be empty
moteusState: {
Expand All @@ -161,39 +163,30 @@ export default {
}
},
computed: {
...mapState('websocket', ['message']),
},
watch: {
message(msg) {
if (msg.type == 'drive_status') {
this.motorData.name = msg.name
this.motorData.position = msg.position
this.motorData.velocity = msg.velocity
this.motorData.effort = msg.effort
this.motorData.state = msg.state
this.motorData.error = msg.error
} else if (msg.type == 'drive_moteus') {
this.moteusState.name = msg.name
this.moteusState.state = msg.state
this.moteusState.error = msg.error
this.moteusState.limit_hit = msg.limit_hit
}
}
},
created: function () {
// disableAutonLED(this.$ros);
// this.odom_sub = new ROSLIB.Topic({
// ros: this.$ros,
// name: "/gps/fix",
// messageType: "sensor_msgs/NavSatFix"
// });
// this.odom_sub.subscribe((msg) => {
// // Callback for latLng to be set
// this.odom.latitude_deg = msg.latitude;
// this.odom.longitude_deg = msg.longitude;
// });
// this.tfClient = new ROSLIB.TFClient({
// ros: this.$ros,
// fixedFrame: "odom",
// // Thresholds to trigger subscription callback
// angularThres: 0.0001,
// transThres: 0.01
// });
// // Subscriber for odom to base_link transform
// this.tfClient.subscribe("base_link", (tf) => {
// // Callback for IMU quaternion that describes bearing
// this.odom.bearing_deg = quaternionToMapAngle(tf.rotation);
// });
// this.brushless_motors_sub = new ROSLIB.Topic({
// ros: this.$ros,
// name: "drive_status",
// messageType: "mrover/MotorsStatus"
// });
// this.brushless_motors_sub.subscribe((msg) => {
// this.motorData = msg.joint_states;
// this.moteusState = msg.moteus_states;
// });
}
}
</script>
Expand Down

0 comments on commit edddf01

Please sign in to comment.