-
Couldn't load subscription status.
- Fork 654
Description
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_periodicmethod withincan/bus.pyto include an optional argument ofperiod_intra - Implement a
VariableRateCyclicTaskABCclass withincan/broadcastmanager.pyto be inherited byThreadBasedCyclicSendTask - Implement a method
_check_and_apply_period_intra()withinVariableRateCycleTaskABCto 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_idto be a list ofarbitration_ids - Add
msg_indexandmsgs_lenas attributes ofCyclicSendTaskABC - Modify
CyclicSendTaskABC._check_and_convert_messagesandModifiableCyclicTaskABC._check_modified_messagesto check for specificarbitration_idof the modified message depending on themsg_indexrather than just checkingmessage[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.