def trigger_infrared_light_detect():
    can_msg = vci_can()
    can_msg.ID = can_id_build()
    can_msg.DataLen = 2
    can_msg.Data = [0x10, 0xFF]
    #rospy.loginfo(can_msg.Data)
    infrared_light_pub.publish(can_msg)
def trigger_pressure_laser_detect():
    can_msg = vci_can()
    can_msg.ID = can_id_build()
    can_msg.DataLen = 2
    can_msg.Data = [0x10, 0xFF]
    #rospy.loginfo(can_msg.Data)
    pressure_laser_pub.publish(can_msg)
Ejemplo n.º 3
0
def trigger_supersonic_detect():
    can_msg = vci_can()
    can_msg.ID = can_id_build()
    can_msg.DataLen = 2
    can_msg.Data = [0x10,0xFF]
    #rospy.loginfo(can_msg.Data)
    supersonic_pub.publish(can_msg)
Ejemplo n.º 4
0
def trigger_powerboard_m_detect():
    can_msg = vci_can()
    can_msg.ID = 0x00260180  #can_id_build()
    can_msg.DataLen = 7
    can_msg.Data = [0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
    rospy.loginfo(can_msg.Data)
    power_m_pub.publish(can_msg)
Ejemplo n.º 5
0
def trigger_test():
    can_msg = vci_can()
    can_msg.ID = can_id_build()#0x012a0103
    can_msg.DataLen = 4

    can_msg.Data = [0x00,0x00,0x00,0x00]
    print 'sent:' + repr(can_msg.Data)
    test_pub.publish(can_msg)
Ejemplo n.º 6
0
def trigger_supersonic_detect():
    global supersonic_id
    supersonic_id += 1
    if supersonic_id > 8:
        supersonic_id = 1
    can_msg = vci_can()
    can_msg.ID = can_id_build(supersonic_id)
    can_msg.DataLen = 3
    can_msg.Data = [0x00, 0x10, 0xFF]
    #rospy.loginfo(can_msg.Data)
    supersonic_pub.publish(can_msg)
Ejemplo n.º 7
0
def get_mcu_rfid_version():
    can_msg = vci_can()
    can_msg.ID = can_id_build(sourceID=0x01, ack=0, funcID=1)
    can_msg.DataLen = 1

    can_msg.Data = '\x00'

    print 'sent:' + repr(can_msg.Data)
    rfid_pub.publish(can_msg)
    a = canMsg(can_msg)
    a.print_info()
    flag = 0
    print 'total sent: %d' % g_tx_total
Ejemplo n.º 8
0
def trigger_test():
    global g_tx_total
    global test_data
    global flag
    if not flag:
        return
    can_msg = vci_can()
    can_msg.ID = can_id_build()#0x012a0103
    can_msg.DataLen = 5

    can_msg.Data = '\x00' + struct.pack(">i", test_data)
    #can_msg.Data = [0x00,0x01,0x02,0x03,0x04,0x05]
    print 'sent:' + repr(can_msg.Data)
    test_pub.publish(can_msg)
    flag = 0
    g_tx_total += 1
    print 'total sent: %d'%g_tx_total
Ejemplo n.º 9
0
def trigger_test():
    global g_tx_total
    global test_data
    global flag
    if not flag:
        return
    can_msg = vci_can()
    can_msg.ID = can_id_build(sourceID=0x03, ack=0x00,
                              funcID=0x01)  #0x012a0103
    can_msg.DataLen = 1

    #can_msg.Data = '\x00' + struct.pack(">i", test_data)
    can_msg.Data = [0x00]
    print 'sent:' + repr(can_msg.Data)
    rfid_pub.publish(can_msg)
    a = canMsg(can_msg)
    a.print_info()
    flag = 0
    g_tx_total += 1
    print 'total sent: %d' % g_tx_total
Ejemplo n.º 10
0
    def get_sourceID(self):
        return self.sourceID

    def get_data_length(self):
        return self.data_length

    def get_data(self):
        return self.data

    def print_info(self):
        print 'can_id = 0x%08x' % self.get_can_id()
        print 'srcMacID = 0x%02x, dstMacID = 0x%02x, ack = 0x%01x, funcID = 0x%01x, sourceID = 0x%02x' % (self.get_srcMacID(),self.get_dstMacID(),self.get_ack(),self.get_funcID(),self.get_sourceID())
#        print 'dstMacID = 0x%02x' % self.get_dstMacID()
#        print 'ack = 0x%01x' % self.get_ack()
#        print 'funcID = 0x%01x' % self.get_funcID()
#        print 'sourceID = 0x%02x' % self.get_sourceID()
        print 'data_length = %d' % self.get_data_length()
#        print 'data:',struct.unpack("<I", self.get_data())
        print 'data:',[hex(c) for c in self.get_data()]

if __name__ == '__main__':

    can_msg = vci_can()
    can_msg.ID = 0xa201281
    can_msg.DataLen = 3
    can_msg.Data = b'\x01\x10\xff\x91'# (0x01,0x10,0xff,0x01)#

    a = canMsg(can_msg)
    a.print_info()