├── .gitignore
├── LICENSE
├── README.md
└── cart
├── Inc
└── main.h
└── Src
└── main.c
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled source #
2 | ###################
3 | *.com
4 | *.class
5 | *.dll
6 | *.exe
7 | *.o
8 | *.so
9 | *.pyc
10 |
11 | # Packages #
12 | ############
13 | # it's better to unpack these files and commit the raw source
14 | # git has its own built in compression methods
15 | *.7z
16 | *.dmg
17 | *.gz
18 | *.iso
19 | *.rar
20 | #*.tar
21 | *.zip
22 |
23 | # Logs and databases #
24 | ######################
25 | *.log
26 | *.sqlite
27 | *.xml
28 | _windows/
29 |
30 | # OS generated files #
31 | ######################
32 | .DS_Store
33 | ehthumbs.db
34 | Icon
35 | Thumbs.db
36 | .tmtags
37 | .idea/
38 | mydjangosite/.idea/
39 | tags
40 | vendor.tags
41 | tmtagsHistory
42 | *.sublime-project
43 | *.sublime-workspace
44 | .bundle
45 |
46 | # AVR studio files #
47 | ####################
48 | default/
49 | *.aps
50 | *.aws
51 |
52 | # TrueSTUDIO files #
53 | ####################
54 | .metadata/*
55 | cart/*.*
56 | cart/.setting/*
57 | cart/Drivers/*
58 | cart/Middlewares/*
59 | cart/startup/*
60 | cart/Inc/*
61 | !cart/Inc/main.h
62 | cart/Src/*
63 | !cart/Src/main.c
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2019, Intelligent-distributed Cloud and Security Laboratory (ICNS Lab.)
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | 3. Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # STM-based Self-Driving Cart Controller
2 | [](https://opensource.org/licenses/BSD-3-Clause)
3 |
4 | ## Introduction
5 | **'stm-cartcontroller' is essential to edge cloud based indoor self-driving cart.**
6 | The controller is running on stm32f4discovery board.
7 | The cart can sense surroundings by ultrasonic sensors, psd sensors and usb camera.
8 | A Moving Edge Cloud in the cart and Fixed Edge Clouds communicate. The cart can drive autonomously.
9 |
10 | ## Getting started with stm-cartcontroller
11 | ### 1. Development project setup
12 | * Step 1. Share a CubeMX file
13 | * Step 2. Create "stm-cartcontroller" folder
14 | * Step 3. Execute the shared CubeMX file
15 | * Step 4. Save as CubeMX project (Project name: cart) in "stm-cartcontroller" folder
16 | * Step 5. Click "Generate code" button
17 | * Step 6. Delete main.h file in "cart/Inc/" and main.c file "cart/Src/"
18 | * Step 7. Create/init local git repository in "stm-cartcontroller" folder
19 | * Step 8. Set git origin "https://github.com/icns-distributed-cloud/stm-cartcontroller.git"
20 | * Step 9. Git pull origin master
21 |
22 | ### 2. Project development
23 | * Step 1. Rasie an issue and create a branch
24 | * Step 2. Pull the branch to local repository
25 | * Step 3. Checkout the branch
26 | * Step 4. Develop functions, modules, or etc.
27 | * Step 5. Git commit
28 | * Step 6. Push the branch
29 | * Step 7. Make "Pull request"
30 |
31 | ## Result demo
32 | ### Obstacle avoidance demo
33 | When a object is suddenly dropped in front of the cart, cart avoid the obtacle and drive safely to the destination. :smile:
34 |
35 |
36 |
37 | ### Indoor self-driving demo
38 | The cart drives automonusly and safely by the self-controll system and communication between edge clouds. :thumbsup:
39 |
40 |
41 |
--------------------------------------------------------------------------------
/cart/Inc/main.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file : main.h
4 | * @brief : Header for main.c file.
5 | * This file contains the common defines of the application.
6 | ******************************************************************************
7 | * This notice applies to any and all portions of this file
8 | * that are not between comment pairs USER CODE BEGIN and
9 | * USER CODE END. Other portions of this file, whether
10 | * inserted by the user or by software development tools
11 | * are owned by their respective copyright owners.
12 | *
13 | * Copyright (c) 2019 STMicroelectronics International N.V.
14 | * All rights reserved.
15 | *
16 | * Redistribution and use in source and binary forms, with or without
17 | * modification, are permitted, provided that the following conditions are met:
18 | *
19 | * 1. Redistribution of source code must retain the above copyright notice,
20 | * this list of conditions and the following disclaimer.
21 | * 2. Redistributions in binary form must reproduce the above copyright notice,
22 | * this list of conditions and the following disclaimer in the documentation
23 | * and/or other materials provided with the distribution.
24 | * 3. Neither the name of STMicroelectronics nor the names of other
25 | * contributors to this software may be used to endorse or promote products
26 | * derived from this software without specific written permission.
27 | * 4. This software, including modifications and/or derivative works of this
28 | * software, must execute solely and exclusively on microcontroller or
29 | * microprocessor devices manufactured by or for STMicroelectronics.
30 | * 5. Redistribution and use of this software other than as permitted under
31 | * this license is void and will automatically terminate your rights under
32 | * this license.
33 | *
34 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
35 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
36 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
37 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
38 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
39 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
40 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
42 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
43 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
44 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
45 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46 | *
47 | ******************************************************************************
48 | */
49 |
50 | /* Define to prevent recursive inclusion -------------------------------------*/
51 | #ifndef __MAIN_H__
52 | #define __MAIN_H__
53 |
54 | /* Includes ------------------------------------------------------------------*/
55 |
56 | /* USER CODE BEGIN Includes */
57 |
58 | /* USER CODE END Includes */
59 |
60 | /* Private define ------------------------------------------------------------*/
61 |
62 | #define CS_I2C_SPI_Pin GPIO_PIN_3
63 | #define CS_I2C_SPI_GPIO_Port GPIOE
64 | #define PC14_OSC32_IN_Pin GPIO_PIN_14
65 | #define PC14_OSC32_IN_GPIO_Port GPIOC
66 | #define PC15_OSC32_OUT_Pin GPIO_PIN_15
67 | #define PC15_OSC32_OUT_GPIO_Port GPIOC
68 | #define PH0_OSC_IN_Pin GPIO_PIN_0
69 | #define PH0_OSC_IN_GPIO_Port GPIOH
70 | #define PH1_OSC_OUT_Pin GPIO_PIN_1
71 | #define PH1_OSC_OUT_GPIO_Port GPIOH
72 | #define OTG_FS_PowerSwitchOn_Pin GPIO_PIN_0
73 | #define OTG_FS_PowerSwitchOn_GPIO_Port GPIOC
74 | #define PDM_OUT_Pin GPIO_PIN_3
75 | #define PDM_OUT_GPIO_Port GPIOC
76 | #define B1_Pin GPIO_PIN_0
77 | #define B1_GPIO_Port GPIOA
78 | #define Encoder_L_Pin GPIO_PIN_1
79 | #define Encoder_L_GPIO_Port GPIOA
80 | #define I2S3_WS_Pin GPIO_PIN_4
81 | #define I2S3_WS_GPIO_Port GPIOA
82 | #define SPI1_SCK_Pin GPIO_PIN_5
83 | #define SPI1_SCK_GPIO_Port GPIOA
84 | #define SPI1_MISO_Pin GPIO_PIN_6
85 | #define SPI1_MISO_GPIO_Port GPIOA
86 | #define SPI1_MOSI_Pin GPIO_PIN_7
87 | #define SPI1_MOSI_GPIO_Port GPIOA
88 | #define BOOT1_Pin GPIO_PIN_2
89 | #define BOOT1_GPIO_Port GPIOB
90 | #define CLK_IN_Pin GPIO_PIN_10
91 | #define CLK_IN_GPIO_Port GPIOB
92 | #define I2S3_MCK_Pin GPIO_PIN_7
93 | #define I2S3_MCK_GPIO_Port GPIOC
94 | #define VBUS_FS_Pin GPIO_PIN_9
95 | #define VBUS_FS_GPIO_Port GPIOA
96 | #define OTG_FS_ID_Pin GPIO_PIN_10
97 | #define OTG_FS_ID_GPIO_Port GPIOA
98 | #define OTG_FS_DM_Pin GPIO_PIN_11
99 | #define OTG_FS_DM_GPIO_Port GPIOA
100 | #define OTG_FS_DP_Pin GPIO_PIN_12
101 | #define OTG_FS_DP_GPIO_Port GPIOA
102 | #define SWDIO_Pin GPIO_PIN_13
103 | #define SWDIO_GPIO_Port GPIOA
104 | #define SWCLK_Pin GPIO_PIN_14
105 | #define SWCLK_GPIO_Port GPIOA
106 | #define Encoder_LA15_Pin GPIO_PIN_15
107 | #define Encoder_LA15_GPIO_Port GPIOA
108 | #define I2S3_SCK_Pin GPIO_PIN_10
109 | #define I2S3_SCK_GPIO_Port GPIOC
110 | #define I2S3_SD_Pin GPIO_PIN_12
111 | #define I2S3_SD_GPIO_Port GPIOC
112 | #define Audio_RST_Pin GPIO_PIN_4
113 | #define Audio_RST_GPIO_Port GPIOD
114 | #define OTG_FS_OverCurrent_Pin GPIO_PIN_5
115 | #define OTG_FS_OverCurrent_GPIO_Port GPIOD
116 | #define SWO_Pin GPIO_PIN_3
117 | #define SWO_GPIO_Port GPIOB
118 | #define Encoder_R_Pin GPIO_PIN_6
119 | #define Encoder_R_GPIO_Port GPIOB
120 | #define Encoder_RB7_Pin GPIO_PIN_7
121 | #define Encoder_RB7_GPIO_Port GPIOB
122 | #define MEMS_INT2_Pin GPIO_PIN_1
123 | #define MEMS_INT2_GPIO_Port GPIOE
124 |
125 | /* ########################## Assert Selection ############################## */
126 | /**
127 | * @brief Uncomment the line below to expanse the "assert_param" macro in the
128 | * HAL drivers code
129 | */
130 | /* #define USE_FULL_ASSERT 1U */
131 |
132 | /* USER CODE BEGIN Private defines */
133 |
134 | /* USER CODE END Private defines */
135 |
136 | #ifdef __cplusplus
137 | extern "C" {
138 | #endif
139 | void _Error_Handler(char *, int);
140 |
141 | #define Error_Handler() _Error_Handler(__FILE__, __LINE__)
142 | #ifdef __cplusplus
143 | }
144 | #endif
145 |
146 | #endif /* __MAIN_H__ */
147 |
148 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
149 |
--------------------------------------------------------------------------------
/cart/Src/main.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/icns-distributed-cloud/stm-cartcontroller/9a4de880d66f3a35deae255c716e0098377f065b/cart/Src/main.c
--------------------------------------------------------------------------------