-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RSDK-6164] Mimo pid updates #4290
Merged
Merged
Changes from 7 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
358fe3e
MIMO on PID Block done, need to clean up code
mariapatni 252a42a
added some comments and cleaned up some code
mariapatni 21c3e33
ran linter
mariapatni 31e3453
tune signals one at a time
JohnN193 1cbb1a1
feedback from john review
JohnN193 00644c8
test MIMO PID works for single signal case
JohnN193 b7900ee
disable mimo single case
JohnN193 63eeb2a
small test cleanup
JohnN193 8e60a2d
add back old test
JohnN193 9b2916a
tweak pid struct comments
JohnN193 9f80288
lint
JohnN193 311e05c
fix pid test
JohnN193 8bf5301
fix other tests and remove dupe test
JohnN193 343544f
tweak comment
JohnN193 5b86ac8
only confirm pid values are set when not using multi and add error lo…
JohnN193 c2506d6
Merge branch 'main' of github.com:viamrobotics/rdk into mimoPIDUpdates
JohnN193 598e704
Merge branch 'main' of github.com:viamrobotics/rdk into mimoPIDUpdates
JohnN193 22be53f
Merge branch 'main' of github.com:viamrobotics/rdk into mimoPIDUpdates
JohnN193 0ca4594
add string method to pidconfig
JohnN193 d2cba49
lint
JohnN193 756e5b8
write string differently
JohnN193 372f540
fix test
JohnN193 12303b2
remove single input output pid
JohnN193 4528d58
address comments
JohnN193 a983cfa
lint
JohnN193 87b1283
check for in progress tuning
JohnN193 7956825
tweak string
JohnN193 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,6 +1,8 @@ | ||||||
package control | ||||||
|
||||||
import "sync" | ||||||
import ( | ||||||
"sync" | ||||||
) | ||||||
|
||||||
// Signal holds any data passed between blocks. | ||||||
type Signal struct { | ||||||
|
@@ -23,11 +25,23 @@ func makeSignal(name string, blockType controlBlockType) *Signal { | |||||
return &s | ||||||
} | ||||||
|
||||||
// Make Signals returns a Signal object where the length of its signal[] array is dependent | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
// on the number of PIDSets from the config. | ||||||
func makeSignals(name string, blockType controlBlockType, dimension int) *Signal { | ||||||
var s Signal | ||||||
s.dimension = dimension | ||||||
s.signal = make([]float64, dimension) | ||||||
s.time = make([]int, dimension) | ||||||
s.name = name | ||||||
s.blockType = blockType | ||||||
return &s | ||||||
} | ||||||
|
||||||
// GetSignalValueAt returns the value of the signal at an index, threadsafe. | ||||||
func (s *Signal) GetSignalValueAt(i int) float64 { | ||||||
s.mu.Lock() | ||||||
defer s.mu.Unlock() | ||||||
if i > len(s.signal)-1 { | ||||||
if !(i < len(s.signal)) { | ||||||
return 0.0 | ||||||
} | ||||||
return s.signal[i] | ||||||
|
@@ -37,7 +51,7 @@ func (s *Signal) GetSignalValueAt(i int) float64 { | |||||
func (s *Signal) SetSignalValueAt(i int, val float64) { | ||||||
s.mu.Lock() | ||||||
defer s.mu.Unlock() | ||||||
if i > len(s.signal)-1 { | ||||||
if !(i < len(s.signal)) { | ||||||
return | ||||||
} | ||||||
s.signal[i] = val | ||||||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can try to remove these if ya want. Was worried that calling GetTuning was affecting things at the time when I added this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is fine and probably safer. happy with leaving it.