---
# System prepended metadata

title: Electrical System Structure
tags: [NTURT, electrical_system]

---

# Electrical System Structure
###### tags: `electrical_system` `NTURT`

## Electrical system

```graphviz

digraph electrical_system {
    graph[fontname=Times]
    node[shape=ellipse style=filled fontname=Times]
    edge[fontname=Times]
    compound=true
    
    subgraph controller {
        node[color="#ea9999" fillcolor="#f4cccc"]
        
        subgraph cluster_front_box {
            style=dashed
            label=front_box

            subgraph cluster_front_box_stm32 {
                style=filled
                color="#ea9999"
                fillcolor="#f4cccc"
                label=stm32
                
                node[color="#b4a7d6" fillcolor="#d9d2e9"]
                {rank=same dashboard_control front_sensor vcu}
                dashboard_control
                front_sensor
                vcu
            }

            subgraph cluster_front_box_rpi {
                style=filled
                color="#ea9999"
                fillcolor="#f4cccc"
                label=rpi
                
                node[color="#b4a7d6" fillcolor="#d9d2e9"]
                {rank=same data_logger remote_control}
                data_logger
                remote_control
            }
        }

        subgraph cluster_rear_box {
            style=dashed
            label=rear_box

            subgraph cluster_rear_box_stm32 {
                style=filled
                color="#ea9999"
                fillcolor="#f4cccc"
                label=stm32

                node[color="#b4a7d6" fillcolor="#d9d2e9"]
                {rank=same rear_control rear_sensor}
                rear_control[label=rear_control]
                rear_sensor[label=rear_sensor]
            }
        }
        
        bms[label=bms]
        inverter[label=inverter]
        server[label=server]
    }
    
    subgraph sensor {
        node[color="#6d9eeb" fillcolor="#a4c2f4"]
        accelerator[label=accelerator]
        brake[label=brake]
        brake_pressure[label=brake_pressure]
        button[label=button]
        gps[label=gps]
        imu[label=imu]
        steering_wheel[label=steering_wheel]
        tire_temperature[label=tire_temperature]
        wheel_speed[label=wheel_speed]
    }
    
    subgraph utility {
        node[color="#93c47d" fillcolor="#b6d7a8"]
        alarm[label=alarm]
        brake_light[label=brake_light]
        indicator_light[label=indicator_light]
    }
    
    // communication
    // can
    edge[arrowhead=none]
    edge[color=blue]
    imu->remote_control[lhead=cluster_front_box_rpi]
    remote_control->dashboard_control[lhead=cluster_front_box_stm32 ltail=cluster_front_box_rpi]
    vcu->rear_control[lhead=cluster_rear_box_stm32 ltail=cluster_front_box_stm32]
    rear_sensor->bms[ltail=cluster_rear_box_stm32]
    bms->inverter
    edge[arrowhead=normal]
    
    // i2c
    edge[color=yellow]
    tire_temperature->front_sensor
    tire_temperature->rear_sensor
    
    // spi
    edge[color=green]
    steering_wheel->front_sensor
    
    // usb
    edge[color=red]
    gps->data_logger
    
    // wireless
    edge[color=black]
    edge[style=dashed]
    data_logger->server
    server->remote_control
    edge[style=solid]
    
    // other/none
    edge[color=brown]
    accelerator->front_sensor
    accelerator->vcu
    brake->front_sensor
    brake->vcu
    brake_pressure->front_sensor
    brake_pressure->rear_sensor
    button->dashboard_control
    dashboard_control->indicator_light
    rear_control->brake_light
    vcu->alarm
    wheel_speed->front_sensor
    wheel_speed->rear_sensor
    
    subgraph cluster_legend {
		style=filled
		color="#ffe599"
        fillcolor="#fff2cc"
		label =legend
        can_node[color="#b4a7d6" fillcolor="#d9d2e9" label=can_node]
        controller[color="#ea9999" fillcolor="#f4cccc" label=controller]
        sensor[color="#6d9eeb" fillcolor="#a4c2f4" label=sensor]
        utility[color="#93c47d" fillcolor="#b6d7a8" label=utility]
        
        subgraph cluster_communication_protocol {
            color=black
            style=dashed
            label="communication protocol"
            {rank=same n0 n1 n2 n3 n4 n5}
            {rank=sink n6 n7 n8 n9 n10 n11}
            n0[label="" shape=none height=0 width=0]
            n1[label="" shape=none height=0 width=0]
            n2[label="" shape=none height=0 width=0]
            n3[label="" shape=none height=0 width=0]
            n4[label="" shape=none height=0 width=0]
            n5[label="" shape=none height=0 width=0]
            n6[label="" shape=none height=0 width=0]
            n7[label="" shape=none height=0 width=0]
            n8[label="" shape=none height=0 width=0]
            n9[label="" shape=none height=0 width=0]
            n10[label="" shape=none height=0 width=0]
            n11[label="" shape=none height=0 width=0]
            n0->n1[label=can arrowhead=none color=blue]
            n2->n3[label=i2c color=yellow]
            n4->n5[label=spi color=green]
            n6->n7[label=usb color=red]
            n8->n9[label=wireless style=dashed color=black]
            n10->n11[label="other/none" color=brown]
        }
	}
}

```

## STM32

```graphviz

```

## Raspberry

```graphviz

digraph program_structure {
    graph [fontname="Times"];
    node [shape=ellipse style=filled fontname="Times" color="#ea9999" fillcolor="#f4cccc"];
    edge [fontname="Times" color=blue];
    
    nturt_bag_recorder_node [label=nturt_bag_recorder_node]
    nturt_can_parser_node [label=nturt_can_parser_node]
    nturt_gps_node [label=nturt_gps_node]
    nturt_led_controller_node [label=nturt_led_controller_node]
    nturt_push_to_control_tower_node [label=nturt_push_to_control_tower_node]
    nturt_state_controller_node [label=nturt_state_controller_node]
    nturt_torque_controller_node [label=nturt_torque_controller_node]
    rosmaster [label=rosmaster]
    socket_can_bridge_node [label=socket_can_bridge_node]
    
    nturt_can_parser_node->nturt_bag_recorder_node [label="/sent_messages"]
    nturt_can_parser_node->nturt_push_to_control_tower_node [label="/can_notification"]
    nturt_can_parser_node->nturt_state_controller_node [label="/can_notification"]
    nturt_can_parser_node->nturt_torque_controller_node [label="/can_notification"]
    nturt_can_parser_node->socket_can_bridge_node [label="/sent_messages"]
    nturt_gps_node->nturt_bag_recorder_node [label="/GPS_fix"]
    nturt_gps_node->nturt_push_to_control_tower_node [label="/GPS_fix"]
    nturt_state_controller_node->nturt_torque_controller_node [label="/node_state"]
    nturt_torque_controller_node->nturt_push_to_control_tower_node [label="/torque_controller_data"]
    rosmaster->nturt_led_controller_node [label="/rosout"]
    socket_can_bridge_node->nturt_bag_recorder_node [label="/received_messages"]
    socket_can_bridge_node->nturt_can_parser_node [label="/received_messages"]
    socket_can_bridge_node->nturt_led_controller_node [label="/received_messages"]
    
    edge [color=green]
    
    nturt_state_controller_node->nturt_can_parser_node [label="/update_can_data"]
    nturt_torque_controller_node->nturt_can_parser_node [label="/update_can_data"]
    
    
    subgraph cluster_legend {
		style=filled
		color="#ffe599"
        fillcolor="#fff2cc"
		label = legend
        {rank=same n0 n1 n2 n3}
        nodes[label="node"]
        n0 [label= "" shape=none height=0 width=.0]
        n1 [label= "" shape=none height=.0 width=.0]
        n2 [label= "" shape=none height=.0 width=.0]
        n3 [label= "" shape=none height=.0 width=.0]
        n0->n1 [label=topic color=blue]
        n2->n3 [label=service color=lawngreen]
	}
}


```
