Skip to content

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

Open
@sschueth

Description

@sschueth

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions