Skip to content

Conversation

@8ohamed
Copy link
Collaborator

@8ohamed 8ohamed commented Apr 21, 2025

No description provided.

@8ohamed
Copy link
Collaborator Author

8ohamed commented Apr 21, 2025

Hi @prasadtalasila I have pushed the sysid. I made experiment 3 with 2 options.
1- to just run oma and print the results
2- runs oma and publish the oma results and the timestamp it got from the aligner to the topic under config "sysid"

The implementation assumes that topic index 1 under "MQTT" config is the metadata, it uses it to extract the Fs.

@prasadtalasila
Copy link
Contributor

@8ohamed the experiment-3 program never terminates. Please have a look. Thanks.

@8ohamed
Copy link
Collaborator Author

8ohamed commented Apr 27, 2025

@prasadtalasila I have updated exp-3-plot so it terminates after getting OMA results once, and it shows the plot.

@prasadtalasila
Copy link
Contributor

@8ohamed The experiment_3_plot is not terminating even after 30 minutes. Even the experiment_3_print does not terminate. Please have a look. Thanks.

@8ohamed
Copy link
Collaborator Author

8ohamed commented Apr 30, 2025

Hi @prasadtalasila The experiment_3_plot and experiment_3_print are both terminating for me,.
But I have added disconnect to make sure of it.
If the experiment isn't running sys-id and keeps priniting "Not enough aligned data" then something might be wrong with the topics or the mqtt client id, which makes it keep running until it has enough data.

@prasadtalasila
Copy link
Contributor

@8ohamed please paste (in your comment) the template MQTT json file. Do remember to remove the MQTT credentials. Thanks.

@8ohamed
Copy link
Collaborator Author

8ohamed commented Apr 30, 2025

@prasadtalasila

TopicIndex 3 and 4 are for debug
{
"MQTT": {
"host": "dtl-server-2.st.lab.au.dk",
"port": 8090,
"userId": "",
"password": "",
"ClientID": "",
"QoS": 1,
"TopicsToSubscribe": [
"cpsens/d8-3a-dd-37-d2-7e/3160-A-042_sn_999998/1/acc/raw/data",
"cpsens/d8-3a-dd-37-d2-7e/3160-A-042_sn_999998/1/acc/raw/metadata",
"cpsens/d8-3a-dd-37-d2-7e/3160-A-042_sn_999998/2/acc/raw/data",
"cpsens/+/+/1/acc/raw/data",
"cpsens/+/+/2/acc/raw/data"

    ]
},

"sysID": {
  "host": "test.mosquitto.org",
  "port": 1883,
  "userId": "",
  "password": "",
  "ClientID": "sub.232.sds.213s",
  "QoS": 1,
  "TopicsToSubscribe": ["cpsens/1/acc/oma_results/data"]
}

}

@prasadtalasila
Copy link
Contributor

@8ohamed It is working for me now with the configuration file you have given. Please update config/production.json.template or add a new template. Is there a way to catch the kind of problems I have been experiencing? Do remember to update the documentation, especially in experiments/ directory.

In addition, please do the following.

  1. Improve / update the tests for better code coverage
  2. Resolve pylint issues
  3. Make the terminal log of experiment_3 less verbose.

Thanks.

@8ohamed
Copy link
Collaborator Author

8ohamed commented May 1, 2025

Hi @prasadtalasila I have resolved the issues and added more tests.

Copy link
Contributor

@prasadtalasila prasadtalasila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@8ohamed I've pushed small changes. Please see the comments.

break
for ch_idx, channel_data in enumerate(entries):
if channel_data is not None:
if channel_data is not None and i < len(channel_data):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this line do? The logic in this function looks convoluted. Is it possible to simplify it?

return obj


def _on_metadata(client: MQTTClient, userdata: Dict[str, str], message) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function relies heavily on metadata. Perhaps this can be moved to src/data/accel/metadata.py?
In general, any knowledge of data and metadata should be in one or two python modules so that any updates to either data or metadata formats can be easily integrated into the code base.
If we take the context of your mock_pt and hbk accelerometers, they use the same data format, right? If so, should the src/data/accel/hbk/Accelerometer.process_message() function be pushed to the IAccelerometer?

return FS


def setup_client(mqtt_config: Dict[str, Any]) -> MQTTClient:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are directly importing from paho-mqtt. We already have a src/data/comm/mqtt.py. Can it be used here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The config format seems to be changing with each new feature. Perhaps having a src/util/config.py will help. This module implements the logic of config parsing while other parts of the code calls methods of this class to get the required config.

@8ohamed
Copy link
Collaborator Author

8ohamed commented May 2, 2025

HI @prasadtalasila I have moved the functions out from sys_id, and resolved the issues with the tests and experiment-2.

@prasadtalasila prasadtalasila merged commit 4e68150 into main May 4, 2025
@prasadtalasila prasadtalasila mentioned this pull request May 4, 2025
@prasadtalasila prasadtalasila deleted the sys_id branch May 31, 2025 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants