> For the complete documentation index, see [llms.txt](https://docs.influxtechnology.com/support_guides/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.influxtechnology.com/support_guides/rexgen_xml_examples/imu_to_can_sd.md).

# IMU Data Recording & Transmission Over CAN Bus.

This example shows how to configure a ReXgen data logger to transmit IMU data over the CAN Bus and record the same in eMMC storage.

### Following IMU Data will be transmitted via CAN 0 Bus:

Accelerometer X Accelerometer Y Accelerometer Z

Gyroscope X Gyroscope Y Gyroscope Z

## Documentation

The below image shows how each element is linked in the XML file.

![image](https://user-images.githubusercontent.com/122855530/223625001-1c16ef37-eca8-4cf8-b37e-145a38985860.png)

They are connected using Unique IDs (UID).

### Default Settings

* CAN Baud Rate: 500 Kbps
* ADC Sampling Rate: 100ms
* CAN ID For various signals:
* 0x128 – Accelerometer
* 0x129 – Gyroscope
* Example DBC provided with XML.

#### The following parameters can be modified by editing the XML as required.

**Modifying CAN Bus Channel:**

Edit the value of the PhysicalNumber element in the XML file under the CAN interface block. 0 for CAN 0, 1 for CAN 1, 2 for CAN 2 and 3 for CAN 3

```xml
<CANINTERFACE UID="4">
        <Type>CAN</Type>
        <PhysicalNumber>0</PhysicalNumber>
        <CANBusSpeed>500000</CANBusSpeed>
        <CANFDBusSpeed>8000000</CANFDBusSpeed>
        <CANFDNonISO>false</CANFDNonISO>
```

**Modifying CAN Baud Rate:**

Edit the value of the CANBusSpeed element in the XML file under the CAN interface block.

Value has to be specified in bps

```xml
<CANINTERFACE UID="4">
        <Type>CAN</Type>
        <PhysicalNumber>0</PhysicalNumber>
        <CANBusSpeed>500000</CANBusSpeed>
        <CANFDBusSpeed>8000000</CANFDBusSpeed>
        <CANFDNonISO>false</CANFDNonISO>
```

**Modifying Accelerometer Sampling Rate:**

Edit the value of the SamplingRate element under the ACCELEROMETER list Block.

Value has to be specified in milliseconds

```xml
<ACCELEROMETER UID="4">
        <PhysicalNumber>0</PhysicalNumber>
        <Axis>X</Axis>
        <SamplingRate>10</SamplingRate>
```

**Modifying Gyroscope Sampling Rate:**

Edit the value of the SamplingRate element under the GYRO LIST Block

Value has to be specified in milliseconds

```xml
<GYRO UID="7">
        <PhysicalNumber>0</PhysicalNumber>
        <Axis>X</Axis>
        <SamplingRate>10</SamplingRate>
```

**Modifying Accelerometer High Low Range:**

Edit the value of the SamplingRate element under the ACCELEROMETER LIST Block

Value has to be specified in milliseconds

```xml
<ACCELEROMETER UID="6">
        <PhysicalNumber>0</PhysicalNumber>
        <Axis>Z</Axis>
        <SamplingRate>10</SamplingRate>
        <RangeHi>16</RangeHi>
        <RangeLow>-16</RangeLow>
      </ACCELEROMETER>
```

**Modifying Gyroscope Sampling Rate:**

Edit the value of the SamplingRate element under the GYRO LIST Block

Value has to be specified in milliseconds

```xml
<GYRO UID="7">
        <PhysicalNumber>0</PhysicalNumber>
        <Axis>X</Axis>
        <SamplingRate>10</SamplingRate>
        <RangeHi>500</RangeHi>
        <RangeLow>-500</RangeLow>
      </GYRO>
```

**Modifying the CAN Identifier for the messages:**

Edit the values of MessageIdentStart and MessageIdentEnd Elements under the CANMESSAGE block for the message you wish to edit. Please note that the example DBC will be invalid after this change.

Value has to be entered in Decimal

```xml
<CANMESSAGE_LIST>
      <CANMESSAGE UID="36">
        <MessageIdentStart>299</MessageIdentStart>
        <MessageIdentEnd>299</MessageIdentEnd>
        <Direction>OutputPeriodic</Direction>
        <DLC>8</DLC>
        <IsExtended>false</IsExtended>
```

**Modifying the CAN Message transmission period:**

Edit the values of Period Elements under the CANMESSAGE block for the message you wish to edit.

Value has to be entered in milliseconds

```xml
<CANMESSAGE_LIST>
      <CANMESSAGE UID="36">
        <MessageIdentStart>299</MessageIdentStart>
        <MessageIdentEnd>299</MessageIdentEnd>
        <Direction>OutputPeriodic</Direction>
        <DLC>8</DLC>
        <IsExtended>false</IsExtended>
        <InterfaceUID>4</InterfaceUID>
        <Period>100</Period>
```

#### Users can load the XML file into the ReXgen logger using the ReXdesk application/ReXdesk Convert application or the Rxlibrary DLL.

The process to send XML to logger using ReXdesk. Click on Config Menu > Run > Run Config Using External File > Browse the XML file and click Open.

<table data-view="cards"><thead><tr><th></th><th data-hidden></th><th data-hidden></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><mark style="color:blue;">GitHub link</mark></td><td></td><td></td><td><a href="https://github.com/InfluxTechnology/Rexgen_XML_Examples/tree/main/IMU_to_CAN_SD">https://github.com/InfluxTechnology/Rexgen_XML_Examples/tree/main/IMU_to_CAN_SD</a></td></tr><tr><td><mark style="color:blue;">XML file</mark></td><td></td><td></td><td><a href="https://github.com/InfluxTechnology/Rexgen_XML_Examples/blob/main/IMU_to_CAN_SD/IMU_out_SD.xml">https://github.com/InfluxTechnology/Rexgen_XML_Examples/blob/main/IMU_to_CAN_SD/IMU_out_SD.xml</a></td></tr><tr><td><mark style="color:blue;">DBC file</mark></td><td></td><td></td><td><a href="https://github.com/InfluxTechnology/Rexgen_XML_Examples/blob/main/IMU_to_CAN_SD/ReXgen_IMU_Out_V3.dbc">https://github.com/InfluxTechnology/Rexgen_XML_Examples/blob/main/IMU_to_CAN_SD/ReXgen_IMU_Out_V3.dbc</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.influxtechnology.com/support_guides/rexgen_xml_examples/imu_to_can_sd.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
