<jupyter_start><jupyter_text>Bicycle kinematic model simulator Simulation of bicycle motion using kinematic model and 4th order Runge-Kutta discretizationCreated by:     <NAME> 2017    Technische Universität Kaiserslautern<jupyter_code># Import dependencies
from __future__ import division, print_function
%matplotlib inline

from BicycleTrajectory2D import *
from BicycleUtils import *
from FormatUtils import *
from PlotUtils import *
[N, dt, wheel_distance] = [300, 0.05, 1.1]  # simulation parameters
add_noise = True  # Enable/disable gaussian noise
fileName = ""  # File name prefix for final SVG images

# Define initial state --------------------------------------------------------
delta = math.radians(6)
phi = math.radians(0)
X_init = np.array([1.0, 3.0, 0.0, np.tan(delta)/wheel_distance, 0.0, phi]) # [x, y, z, sigma, psi, phi]

# Define constant inputs ------------------------------------------------------
U_init = np.array([1.0, 0.01, 0.01]) # [v, phi_dot, delta_dot]

# Define standard deviation for gaussian noise model --------------------------
# [xf, xr, yf, yr, zf, zr, za, delta, psi, phi]
noise = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

if add_noise:
    noise = [0.5, 0.5, 0.5, 0.5, 0.1, 0.1, 0.1, 0.01, 0.01, 0.01]
    fileName += "noise"
else:
    fileName += "no_noise"

# Create object simulator ------------------------------------------------------
bike = BicycleTrajectory2D(X_init=X_init, U_init=U_init, noise=noise)

# Simulate path ----------------------------------------------------------------
(gt_sim, zs_sim, time) = bike.simulate_path(N=N, dt=dt)

pathOutputSimulation = 'simulations/math_model/' + fileName + '/'

# Convert from Pandas Dataframe into numpy array
(gt, zs) = convert_object_to_array(gt_sim, zs_sim)

# Plot state variables
plot_simulate_state_variables(gt=gt, sim=zs, time=time, file_name=pathOutputSimulation)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2424083769633508, 'fraction_numerical': 0.039790575916230364, 'mean_word_length': 2.5193370165745854, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '305392', 'license': 'Apache-2.0', 'n_tokens_mistral': 689, 'n_tokens_neox': 638, 'n_words': 175, 'path': 'docs/python_notebooks/Bicycle_simulator.ipynb', 'repo_name': 'turnwald/autonomous_bicycle', 'size': '1933'}