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.
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 uniformperiod
seconds. There are scenarios where the larger group of messages needs to have a period ofperiod
seconds but between each message within the group a non-uniform period ofperiod_intra
seconds is desired. For example, if I have a group of messages,msg_group = [msg1, msg2]
, that needs to have a groupperiod
of 500 ms, however the period betweenmsg1
andmsg2
must be less than 100 ms then this is not possible with the current methods. I'm suggesting adding an optionalperiod_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.
send_periodic
method withincan/bus.py
to include an optional argument ofperiod_intra
VariableRateCyclicTaskABC
class withincan/broadcastmanager.py
to be inherited byThreadBasedCyclicSendTask
_check_and_apply_period_intra()
withinVariableRateCycleTaskABC
to set variable rate attributesThreadBasedCyclicSendTask._run()
with variable rate attributes2. Transmit a group of messages with different
arbitration_ids
Modify
CyclicSendTaskABC
andModifiableCyclicTaskABC
to support a group of messages with different arbitration ids.CyclicSendTaskABC.arbitration_id
to be a list ofarbitration_ids
msg_index
andmsgs_len
as attributes ofCyclicSendTaskABC
CyclicSendTaskABC._check_and_convert_messages
andModifiableCyclicTaskABC._check_modified_messages
to check for specificarbitration_id
of the modified message depending on themsg_index
rather 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 theperiod_intra
set as the SRVT period allowing for compliance with J1939-76 timing.