Skip to content
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

Ability to send_periodic() a group of messages with different arbitration ids and a variable rate period #1732

Open
sschueth opened this issue Jan 19, 2024 · 1 comment

Comments

@sschueth
Copy link

Problem Description:

1. Transmit a group of messages with a Group Period and intra-Message Period

When transmitting a group of messages with send_periodic(), the only option is to transmit each message at a uniform period seconds. There are scenarios where the larger group of messages needs to have a period of period seconds but between each message within the group a non-uniform period of period_intra seconds is desired. For example, if I have a group of messages, msg_group = [msg1, msg2], that needs to have a group period of 500 ms, however the period between msg1 and msg2 must be less than 100 ms then this is not possible with the current methods. I'm suggesting adding an optional period_intra attribute.

2. Transmit a group of messages with different arbitration ids

Unable to explicitly group messages with different arbitration ids to the same task. In some scenarios, it is desired to explicitly guarantee order of transmission on the bus and a defined period between messages within a group. The current implementation seems to be aimed at supporting mux'd messages only.

Proposed Solution:

1. Transmit a group of messages with a Group Period and intra-Message Period

Create a child class to provide the methods to run variable rate messaging for a group of messages.

  • Modify send_periodic method within can/bus.py to include an optional argument of period_intra
  • Implement a VariableRateCyclicTaskABC class within can/broadcastmanager.py to be inherited by ThreadBasedCyclicSendTask
  • Implement a method _check_and_apply_period_intra() within VariableRateCycleTaskABC to set variable rate attributes
  • Update ThreadBasedCyclicSendTask._run() with variable rate attributes

2. Transmit a group of messages with different arbitration_ids

Modify CyclicSendTaskABC and ModifiableCyclicTaskABC to support a group of messages with different arbitration ids.

  • Change CyclicSendTaskABC.arbitration_id to be a list of arbitration_ids
  • Add msg_index and msgs_len as attributes of CyclicSendTaskABC
  • Modify CyclicSendTaskABC._check_and_convert_messages and ModifiableCyclicTaskABC._check_modified_messages to check for specific arbitration_id of the modified message depending on the msg_index rather than just checking message[0].arbitration_id

Additional context

This issue and proposed solution came from implementing updates to meet J1939-76 transmission. The ability to pass the SHM and SDM as a group into a single task is important because it explicitly links the two messages and guarantees the SHM will transmit prior to the SDM. In addition, these proposed changes allow for period to be set as the SDG period and the period_intra set as the SRVT period allowing for compliance with J1939-76 timing.

@sschueth
Copy link
Author

Related Pull Request:

#1733

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant