Skip to content

Commit

Permalink
PID Panel (#491)
Browse files Browse the repository at this point in the history
Closes #443.

Co-authored-by: Nathanael Ren <[email protected]>
Co-authored-by: Mathew Chu <[email protected]>
Co-authored-by: Maxwell Lin <[email protected]>
Co-authored-by: Raul Galvez <[email protected]>
Co-authored-by: nathan <[email protected]>
Co-authored-by: viethungle-vt1401 <[email protected]>
  • Loading branch information
7 people authored Jan 13, 2024
1 parent 918466d commit 1364135
Show file tree
Hide file tree
Showing 11 changed files with 439 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/catkin_ws/src/custom_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ add_message_files(
SimObjectArray.msg
RemoteLaunchInfo.msg
RunningNode.msg
PIDGain.msg
PIDGains.msg
)

add_service_files(
Expand All @@ -33,6 +35,7 @@ add_service_files(
StartLaunch.srv
StopLaunch.srv
GetRunningNodes.srv
SetPIDGains.srv
)

add_action_files(
Expand Down
19 changes: 19 additions & 0 deletions core/catkin_ws/src/custom_msgs/msg/PIDGain.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
uint8 LOOP_POSITION = 0
uint8 LOOP_VELOCITY = 1
uint8 loop

uint8 AXIS_X = 0
uint8 AXIS_Y = 1
uint8 AXIS_Z = 2
uint8 AXIS_ROLL = 3
uint8 AXIS_PITCH = 4
uint8 AXIS_YAW = 5
uint8 axis

uint8 GAIN_KP = 0
uint8 GAIN_KI = 1
uint8 GAIN_KD = 2
uint8 GAIN_FF = 3
uint8 gain

float64 value
1 change: 1 addition & 0 deletions core/catkin_ws/src/custom_msgs/msg/PIDGains.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
custom_msgs/PIDGain[] pid_gains
4 changes: 4 additions & 0 deletions core/catkin_ws/src/custom_msgs/srv/SetPIDGains.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
custom_msgs/PIDGain[] pid_gains
---
bool success
string message
1 change: 1 addition & 0 deletions foxglove/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ ws://<hostname or IP of onboard container>:8765
- `sensors-status-panel`: Panel that displays the connected/disconnected status of Oogway's sensors
- `thruster-speeds-panel`: Panel that displays the current thruster speeds and publishes desired thruster speeds
- `toggle-joystick-panel`: Panel to toggle joystick control on/off, as well as publish transformed joystick inputs as a desired power
- `pid-panel`: Panel to read/set PID gains

### Layouts
- `controls-monitor.json`: 6 graphs for each control axis (x, y, z, roll, pitch, yaw) plotting setpoint and control effort against time. Used to test responsiveness of robot during PID tuning.
Expand Down
16 changes: 16 additions & 0 deletions foxglove/extensions/pid-panel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# PID Panel
This is a panel to read/set PID gains.

## Usage
Use the tabs to switch between the two PID loop types (Position/Velocity).
Each field in the table corresponds to a PID gain that is classified by the row (axis) and column (gain type).

By default, each field displays its current PID value. If a field is clicked on, the value stops updating and the field becomes highlighted in red, indicating that it has been edited, and users may enter a new desired value.
Users may propose new values for multiple gains before clicking "Submit" which then updates all of the edited PID gains.

If users would like to cancel their changes, they can click "Reset" to revert all edited fields back to their read state.

## Configuration
The following constants can be modified:
- `PID_TOPIC`: The topic where the current PID gains are published.
- `PID_SERVICE`: The service which handles setting new PID gains.
19 changes: 19 additions & 0 deletions foxglove/extensions/pid-panel/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@duke-robotics/pid-panel",
"publisher": "Duke Robotics",
"version": "0.0.0",
"main": "./dist/extension.js",
"scripts": {
"build": "foxglove-extension build",
"foxglove:prepublish": "foxglove-extension build --mode production",
"lint:ci": "eslint --report-unused-disable-directives .",
"lint": "eslint --report-unused-disable-directives --fix .",
"local-install": "foxglove-extension install",
"watch:local-install": "nodemon --watch './src/**' -e ts,tsx --exec 'npm run local-install'",
"package": "foxglove-extension package",
"pretest": "foxglove-extension pretest"
},
"dependencies": {
"@textea/json-viewer": "^3.2.2"
}
}
Loading

0 comments on commit 1364135

Please sign in to comment.