{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Driving Events - Extract and Visualization" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from matplotlib import gridspec\n", "import math\n", "import datetime " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The experiments were carried out by a single and experienced driver in three trips (i.e., trip #1, #2, #3) of approximately 25, 16, and 27 minutes. \n", "\n", "The driving events were performed using a single vehicle, 2010 Volkswagen Fox 1.0, under conditions of partly cloudy weather, dry track, and regular asphalts. \n", "\n", "The data were sampled with a smartphone model Xiaomi Redmi Note 8 Pro with Android version 10. The smartphone was affixed to the instrument panel of the vehicle in landscape orientation, maintained no movement or operation during the trips. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We obtained 169 events, subdivided into 26 non-aggressive events, 25 aggressive right-turn events, 23 aggressive left-turn events, 29 aggressive lane change events to the right, 23 aggressive lane change events to the left, 22 aggressive braking events, and 21 aggressive acceleration events. \n", "\n", "The non-aggressive events replicate the events of accelerating, braking, lane changing, and turning; however, with less intensity and greater caution during movements. These events were labeled by the driver, recording the start and end of the events with an audio recorder app running in the background on Android throughout the trip period. With this arrangement, someone listening to the recorded audio later could exactly mark what driving event was conducted and when the event started and ended. " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# Extract raw data from trip #1.\n", "data_acel1 = pd.read_csv('Linear_Acceleration_1.csv')\n", "data_velang1 = pd.read_csv('Gyroscope_1.csv')\n", "data_target1 = pd.read_csv('Labeled_events_1.csv')\n", "\n", "# Extract raw data from trip #2.\n", "data_acel2 = pd.read_csv('Linear_Acceleration_2.csv')\n", "data_velang2 = pd.read_csv('Gyroscope_2.csv')\n", "data_target2 = pd.read_csv('Labeled_events_2.csv')\n", "\n", "# Extract raw data from trip #3.\n", "data_acel3= pd.read_csv('Linear_Acceleration_3.csv')\n", "data_velang3 = pd.read_csv('Gyroscope_3.csv')\n", "data_target3 = pd.read_csv('Labeled_events_3.csv')" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | start | \n", "end | \n", "event | \n", "target | \n", "timesync | \n", "sample | \n", "
---|---|---|---|---|---|---|
0 | \n", "34.657 | \n", "39.616 | \n", "aggressive right-turn | \n", "1 | \n", "11.123 | \n", "0 | \n", "
1 | \n", "83.092 | \n", "87.225 | \n", "aggressive left-turn | \n", "2 | \n", "11.123 | \n", "1 | \n", "
2 | \n", "99.449 | \n", "105.010 | \n", "non-aggressive event | \n", "0 | \n", "11.123 | \n", "2 | \n", "
3 | \n", "108.936 | \n", "111.000 | \n", "aggressive braking | \n", "4 | \n", "11.123 | \n", "3 | \n", "
4 | \n", "286.000 | \n", "288.534 | \n", "aggressive braking | \n", "4 | \n", "11.123 | \n", "4 | \n", "