-
Notifications
You must be signed in to change notification settings - Fork 14
Fix the resource_retriever usage. #299
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
Merged
MaximilienNaveau
merged 3 commits into
agimus-project:humble-devel
from
MaximilienNaveau:bugfix/mnaveau/resource_retriver_and_bag_reading
Feb 19, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 hidden or 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 hidden or 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
35 changes: 35 additions & 0 deletions
35
agimus_controller/agimus_controller/plots/PLOT_DATA_FORMAT.md
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Plot Data Dump Format | ||
|
|
||
| The plotting utilities now automatically dump plot data and metadata to a JSON file for each plot. This allows you to reproduce and beautify plots later. | ||
|
|
||
| ## File Naming | ||
| - Each plot creates a file named `<title>_plotdata.json` (spaces replaced by underscores). | ||
|
|
||
| ## JSON Structure | ||
| ``` | ||
| { | ||
| "title": "Plot Title", | ||
| "time": [ ... ], // List of time values (x-axis) | ||
| "values": [ [...], ... ], // 2D list of y-values (one list per series) | ||
| "labels": [ ... ], // Series labels (if any) | ||
| "ylabels": [ ... ], // Y-axis labels (if any) | ||
| "semilogs": [ ... ], // List of booleans for semilog axes (if any) | ||
| "ylimits": [ [...], ... ], // List of [min, max] for y-limits (if any) | ||
| "colors": [ ... ] // List of color codes for each series | ||
| } | ||
| ``` | ||
|
|
||
| ## Usage | ||
| - You can load this JSON in Python and use the data to recreate or beautify the plot with any plotting library. | ||
| - Example: | ||
| ```python | ||
| import json | ||
| with open('my_plot_plotdata.json') as f: | ||
| data = json.load(f) | ||
| # data['time'], data['values'], data['labels'], ... | ||
| ``` | ||
|
|
||
| ## Notes | ||
| - All arrays are saved as lists for compatibility. | ||
| - Colors are Matplotlib color codes. | ||
| - Not all fields are always present; empty lists are used if not specified. |
29 changes: 29 additions & 0 deletions
29
agimus_controller/agimus_controller/plots/dump_mpc_plot_utils.py
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import json | ||
| import numpy as np | ||
|
|
||
|
|
||
| def dump_mpc_plot_data(filename, plot_data_dict): | ||
| """ | ||
| Dump all plot data and metadata for MPC plots to a JSON file. | ||
| plot_data_dict: dict of dicts, one per figure, with keys: | ||
| - title | ||
| - x (time or index) | ||
| - y (data series, possibly 2D) | ||
| - labels | ||
| - ylabels | ||
| - colors | ||
| - etc. | ||
| """ | ||
|
|
||
| # Convert all numpy arrays to lists for JSON serialization | ||
| def convert(obj): | ||
| if isinstance(obj, np.ndarray): | ||
| return obj.tolist() | ||
| if isinstance(obj, dict): | ||
| return {k: convert(v) for k, v in obj.items()} | ||
| if isinstance(obj, list): | ||
| return [convert(v) for v in obj] | ||
| return obj | ||
|
|
||
| with open(filename, "w") as f: | ||
| json.dump(convert(plot_data_dict), f, indent=2) |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import json | ||
| import numpy as np | ||
|
|
||
|
|
||
| def dump_plot_data( | ||
| filename: str, | ||
| title: str, | ||
| time: np.ndarray, | ||
| values: np.ndarray, | ||
| labels=None, | ||
| ylabels=None, | ||
| semilogs=None, | ||
| ylimits=None, | ||
| colors=None, | ||
| ): | ||
| """Dump plot data and metadata to a JSON file.""" | ||
| data = { | ||
| "title": title, | ||
| "time": time.tolist(), | ||
| "values": values.tolist(), | ||
| "labels": labels if labels is not None else [], | ||
| "ylabels": ylabels if ylabels is not None else [], | ||
| "semilogs": semilogs if semilogs is not None else [], | ||
| "ylimits": ylimits if ylimits is not None else [], | ||
| "colors": colors if colors is not None else [], | ||
| } | ||
| with open(filename, "w") as f: | ||
| json.dump(data, f, indent=2) |
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.
Uh oh!
There was an error while loading. Please reload this page.