mirror of
https://gitlab.ewi.tudelft.nl/ee2l1/2025-2026/A.K.03.git
synced 2025-12-12 15:30:57 +01:00
Made some measurements while braking
This commit is contained in:
parent
0c4774d23f
commit
d30d4c0ac4
@ -21,8 +21,8 @@
|
||||
"cell_type": "code",
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-11-21T08:01:53.138045Z",
|
||||
"start_time": "2025-11-21T08:01:44.644007Z"
|
||||
"end_time": "2025-11-21T11:04:31.990503Z",
|
||||
"start_time": "2025-11-21T11:04:30.600496Z"
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
@ -429,8 +429,8 @@
|
||||
"cell_type": "code",
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-11-21T10:51:42.241019Z",
|
||||
"start_time": "2025-11-21T10:51:37.333443Z"
|
||||
"end_time": "2025-11-21T11:13:56.871532Z",
|
||||
"start_time": "2025-11-21T11:13:52.882260Z"
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
@ -438,9 +438,9 @@
|
||||
"from pathlib import Path\n",
|
||||
"\n",
|
||||
"# TODO: Open the serial connection to KITT, set the motor speed\n",
|
||||
"serial = Serial('COM4', 115200)\n",
|
||||
"serial = Serial('/dev/rfcomm3', 115200)\n",
|
||||
"serial.write(b'D150\\n')\n",
|
||||
"serial.write(b'M160\\n')\n",
|
||||
"serial.write(b'M165\\n')\n",
|
||||
"\n",
|
||||
"# Initialize a list to store recorded data\n",
|
||||
"data = []\n",
|
||||
@ -479,9 +479,9 @@
|
||||
" data.append([current_time, dist_L, dist_R])\n",
|
||||
" \n",
|
||||
" # Check if KITT is too close to the wall and stop if necessary\n",
|
||||
" if dist_L < 100 or dist_R < 100:\n",
|
||||
" serial.write(b'M145\\n')\n",
|
||||
" time.sleep(0.5)\n",
|
||||
" if dist_L < 130 or dist_R < 130:\n",
|
||||
" serial.write(b'M135\\n')\n",
|
||||
" time.sleep(0.75)\n",
|
||||
" serial.write(b'M150\\n') # Stop the car\n",
|
||||
" print(\"Stopping KITT to avoid collision.\")\n",
|
||||
" break # Exit the loop\n",
|
||||
@ -493,9 +493,10 @@
|
||||
"serial.close()\n",
|
||||
"\n",
|
||||
"# TODO: Write the recorded data to a CSV file\n",
|
||||
"filepath = Path('kitt_wall_data_160.csv')\n",
|
||||
"filepath = Path('./kitt_wall_data_165.csv')\n",
|
||||
"df = pd.DataFrame(data,columns = [\"Time\",\"Distance_L\",\"Distance_R\"])\n",
|
||||
"df.to_csv(filepath,index=False)\n",
|
||||
"!pwd\n",
|
||||
"# Recommeded file output: Files/Recordings/kitt_distance_data_{speed}.csv"
|
||||
],
|
||||
"outputs": [
|
||||
@ -503,11 +504,24 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Stopping KITT to avoid collision.\n"
|
||||
"Stopping KITT to avoid collision.\n",
|
||||
"/home/nano/Documents/EE/Y2/IP3/A.K.03/Manual\r\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"execution_count": 74
|
||||
"execution_count": 17
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-11-21T11:12:41.634004Z",
|
||||
"start_time": "2025-11-21T11:12:41.624576Z"
|
||||
}
|
||||
},
|
||||
"cell_type": "code",
|
||||
"source": "df.to_csv(Path(\"./kitt_wall_data_165.csv\"))",
|
||||
"outputs": [],
|
||||
"execution_count": 16
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
|
||||
21
Manual/kitt_wall_data_160.csv
Normal file
21
Manual/kitt_wall_data_160.csv
Normal file
@ -0,0 +1,21 @@
|
||||
Time,Distance_L,Distance_R
|
||||
0.18527626991271973,293,293
|
||||
0.4374089241027832,293,293
|
||||
0.6661174297332764,293,291
|
||||
0.8378303050994873,291,288
|
||||
1.0300233364105225,287,283
|
||||
1.2077486515045166,281,276
|
||||
1.3909521102905273,273,267
|
||||
1.5912683010101318,263,257
|
||||
1.7906908988952637,253,257
|
||||
1.9916656017303467,240,245
|
||||
2.179856777191162,226,232
|
||||
2.338029146194458,213,220
|
||||
2.5159542560577393,198,206
|
||||
2.7149744033813477,198,190
|
||||
2.9028022289276123,182,174
|
||||
3.0969913005828857,166,157
|
||||
3.2479021549224854,148,140
|
||||
3.4600577354431152,130,122
|
||||
3.6272897720336914,112,103
|
||||
3.8329083919525146,93,84
|
||||
|
14
Manual/kitt_wall_data_165.csv
Normal file
14
Manual/kitt_wall_data_165.csv
Normal file
@ -0,0 +1,14 @@
|
||||
Time,Distance_L,Distance_R
|
||||
0.14345836639404297,345,345
|
||||
0.34053707122802734,345,345
|
||||
0.5649638175964355,344,345
|
||||
0.8061964511871338,337,341
|
||||
1.0228962898254395,327,333
|
||||
1.2599327564239502,314,306
|
||||
1.526465654373169,297,288
|
||||
1.7780358791351318,257,268
|
||||
1.948960781097412,233,246
|
||||
2.1302239894866943,207,221
|
||||
2.321249485015869,179,194
|
||||
2.565399646759033,151,167
|
||||
2.794302463531494,120,136
|
||||
|
Loading…
x
Reference in New Issue
Block a user