########################################################################### # # Copyright (c) 2021-2024 Diality Inc. - All Rights Reserved. # # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # @file test_temperature_sensors.py # # @author (last) Peter Lucia # @date (last) 21-May-2021 # @author (original) Peter Lucia # @date (original) 29-Apr-2021 # ############################################################################ import numpy as np import sys from time import sleep sys.path.append("../../") from dialin import HDSimulator from dialin.protocols.CAN import DenaliMessage, DenaliChannels from dialin.common import MsgIds from dialin.utils.conversions import integer_to_bytearray, float_to_bytearray def run(): hd_sim = HDSimulator(log_level="DEBUG") while True: vals = [np.random.uniform(0, 100) for _ in range(18)] payload = bytearray() for val in vals: payload += float_to_bytearray(val) message = DenaliMessage.build_message(channel_id=DenaliChannels.dg_sync_broadcast_ch_id, message_id=MsgIds.MSG_ID_DG_TEMPERATURE_DATA.value, payload=payload) hd_sim.can_interface.send(message, 0) sleep(1) if __name__ == '__main__': run()