diff --git a/wheeled_vehicle_models/11dof-gpu/README.md b/wheeled_vehicle_models/11dof-gpu/README.md index 31fd5dc..3bed7fa 100644 --- a/wheeled_vehicle_models/11dof-gpu/README.md +++ b/wheeled_vehicle_models/11dof-gpu/README.md @@ -32,10 +32,10 @@ Once you launch the curses-based GUI for CMake, you will see an `Empty Cache`, h - `CUDA_USE_STATIC_CUDA_RUNTIME` - Boolean for whether CUDA runtime is statically linked. Leave as is. Default: `ON` - `CUDA_rt_LIBRARY` - Path to CUDA runtime library. Should be automatically filled in. Default: `path_to_runtime_library_on_your_machine` - Once the options are set, hit `c` to configure and `g` to generate. This will then populate your `build` directory with the necessary `makefile` with which you can build the 11dof-gpu model along with its demos by running + Once the options are set, hit `c` to configure and `g` to generate. This will then populate your `build` directory with the necessary `makefile` with which you can build the 11 DOF GPU model along with its demos by running ```bash make -j4 ``` -We recommend to not run `make install` to ensure path consistencies for the demos (as they call upon certain data files relative to the build directory +We recommend to not run `make install` to ensure path consistencies for the demos (as they call upon certain data files relative to the build directory). diff --git a/wheeled_vehicle_models/11dof-gpu/demos/HMMWV/demo_hmmwv.cu b/wheeled_vehicle_models/11dof-gpu/demos/HMMWV/demo_hmmwv.cu index 6216ed2..2cf2919 100644 --- a/wheeled_vehicle_models/11dof-gpu/demos/HMMWV/demo_hmmwv.cu +++ b/wheeled_vehicle_models/11dof-gpu/demos/HMMWV/demo_hmmwv.cu @@ -41,7 +41,7 @@ int main(int argc, char** argv) { d11SolverHalfImplicitGPU solver(num_vehicles); // The number of vehicles here sets these parameters and inputs for all these vehicles // If there is a need to set different parameters for different vehicles, then the solver - // needs to be constructed for each vehicle separately (using the same sovler object) + // needs to be constructed for each vehicle separately (using the same solver object) solver.Construct(vehParamsJSON, tireParamsJSON, num_vehicles, driver_file); // Set the threads per block diff --git a/wheeled_vehicle_models/11dof-gpu/demos/HMMWV/demo_hmmwv_step.cu b/wheeled_vehicle_models/11dof-gpu/demos/HMMWV/demo_hmmwv_step.cu index e391395..905b07b 100644 --- a/wheeled_vehicle_models/11dof-gpu/demos/HMMWV/demo_hmmwv_step.cu +++ b/wheeled_vehicle_models/11dof-gpu/demos/HMMWV/demo_hmmwv_step.cu @@ -41,7 +41,7 @@ int main(int argc, char** argv) { d11SolverHalfImplicitGPU solver(num_vehicles); // The number of vehicles here sets these parameters and inputs for all these vehicles // If there is a need to set different parameters for different vehicles, then the solver - // needs to be constructed for each vehicle separately (using the same sovler object) + // needs to be constructed for each vehicle separately (using the same solver object) // No driver file solver.Construct(vehParamsJSON, tireParamsJSON, num_vehicles); diff --git a/wheeled_vehicle_models/11dof-gpu/demos/HMMWV/demo_hmmwv_varControls.cu b/wheeled_vehicle_models/11dof-gpu/demos/HMMWV/demo_hmmwv_varControls.cu index a416d2f..f60dae5 100644 --- a/wheeled_vehicle_models/11dof-gpu/demos/HMMWV/demo_hmmwv_varControls.cu +++ b/wheeled_vehicle_models/11dof-gpu/demos/HMMWV/demo_hmmwv_varControls.cu @@ -79,7 +79,7 @@ int main(int argc, char** argv) { cudaEventElapsedTime(&milliseconds, start, stop); std::cout << "Solve time (ms): " << milliseconds << "\n"; - // Extract terminal state of choosen vehicles and print the position + // Extract terminal state of chosen vehicles and print the position SimState sim_state_1 = solver.GetSimState(499); SimState sim_state_2 = solver.GetSimState(999); diff --git a/wheeled_vehicle_models/11dof-gpu/dof11_gpu.cu b/wheeled_vehicle_models/11dof-gpu/dof11_gpu.cu index 3d937db..10b9e20 100644 --- a/wheeled_vehicle_models/11dof-gpu/dof11_gpu.cu +++ b/wheeled_vehicle_models/11dof-gpu/dof11_gpu.cu @@ -154,7 +154,7 @@ __device__ void d11GPU::tireToVehTransform(TMeasyNrState* tiref_st, /// Tire Functions //////////////////////////////////////////////////////////// -// Code for the TM easy tire model implemented with the 8DOF model +// Code for the TM easy tire model implemented with the 11 DOF model __device__ __host__ void d11GPU::tireInit(TMeasyParam* t_params) { // calculates some critical values that are needed t_params->_fzRdynco = (t_params->_pn * (t_params->_rdyncoP2n - 2.0 * t_params->_rdyncoPn + 1.)) / @@ -446,7 +446,7 @@ __device__ void d11GPU::computeTireRHS(TMeasyState* t_states, // Also compute the tire forces that need to be applied on the vehicle // Note here that these tire forces are computed using the current pre - // integreated xe, unline in the semi-implicit solver + // integrated xe, unlike in the semi-implicit solver double fxdyn = t_params->_dx * (-vtxs * t_params->_cx * t_states->_xe - fos * vsx) / (vtxs * t_params->_dx + fos) + t_params->_cx * t_states->_xe; @@ -550,7 +550,7 @@ __device__ void d11GPU::computeTireRHS(TMeasyNrState* t_states, double sxs = InterpL(fz, t_params->_sxsPn, t_params->_sxsP2n, t_params->_pn); double sys = InterpL(fz, t_params->_sysPn, t_params->_sysP2n, t_params->_pn); - // Compute the coefficient to "blend" the columb force with the slip force + // Compute the coefficient to "blend" the coulomb force with the slip force double frblend = sineStep(abs(t_states->_vsx), t_params->_frblend_begin, 0., t_params->_frblend_end, 1.); // Now standard TMeasy tire forces // For now, not using any normalization of the slips - similar to Chrono implementation @@ -585,7 +585,7 @@ __device__ void d11GPU::computeTireRHS(TMeasyNrState* t_states, Fy = 0.; } - // Now that we have both the columb force and the slip force, we can combine them with the sine blend to prevent + // Now that we have both the coulomb force and the slip force, we can combine them with the sine blend to prevent // force jumping Fx = (1.0 - frblend) * Fx0 + frblend * Fx; @@ -701,7 +701,7 @@ __device__ void d11GPU::computePowertrainRHS(VehicleState* v_states, v_states->_crankOmega = 0.5 * (tiref_st->_omega + tirer_st->_omega) / v_params->_gearRatios[v_states->_current_gr]; - // The torque after tranny will then just become as there is no torque + // The torque after transmission will then just become as there is no torque // converter torque_t = driveTorque(v_params, controls->m_throttle, v_states->_crankOmega) / v_params->_gearRatios[v_states->_current_gr]; @@ -847,7 +847,7 @@ __device__ void d11GPU::computePowertrainRHS(VehicleState* v_states, v_states->_crankOmega = 0.5 * (tiref_st->_omega + tirer_st->_omega) / v_params->_gearRatios[v_states->_current_gr]; - // The torque after tranny will then just become as there is no torque + // The torque after transmission will then just become as there is no torque // converter torque_t = driveTorque(v_params, controls->m_throttle, v_states->_crankOmega) / v_params->_gearRatios[v_states->_current_gr]; @@ -1119,7 +1119,7 @@ __host__ void d11GPU::setTireParamsJSON(TMeasyNrParam& t_params, const char* fil // level parameters if (d.HasMember("highLevelParams")) { if (d["highLevelParams"].GetBool()) { - // Set basic desing parameters + // Set basic design parameters t_params._jw = d["jw"].GetDouble() * 2.; t_params._rr = d["rr"].GetDouble() * 2.; t_params._mu = d["mu"].GetDouble() * 2.; @@ -1287,7 +1287,7 @@ __host__ void d11GPU::setTireParamsJSON(TMeasyNrParam& t_params, const char* fil } // Utility functions that guess the tire parameters for a TMeasy tire based on standard tire specifications that user -// can get from a spec sheet These functions are directly copy pasted from Chrono with minor modifications +// can get from a spec sheet. These functions are directly copy pasted from Chrono with minor modifications // Function to compute the max tire load from the load index specified by the user __host__ double d11GPU::GetTireMaxLoad(unsigned int li) { diff --git a/wheeled_vehicle_models/11dof-gpu/dof11_gpu.cuh b/wheeled_vehicle_models/11dof-gpu/dof11_gpu.cuh index 8ecf515..e2d3cfe 100644 --- a/wheeled_vehicle_models/11dof-gpu/dof11_gpu.cuh +++ b/wheeled_vehicle_models/11dof-gpu/dof11_gpu.cuh @@ -129,8 +129,8 @@ struct TMeasyParam { // Longitudinal double _dfx0Pn; //!< Initial longitudinal slopes dFx/dsx [N] at Nominal load double _dfx0P2n; //!< Intial longitudinal slopes dFx/dsx [N] at max load - double _fxmPn; //!< Maximum longituidnal force [N] at nominal load - double _fxmP2n; //!< Maximum longituidnal force [N] at max load + double _fxmPn; //!< Maximum longitudinal force [N] at nominal load + double _fxmP2n; //!< Maximum longitudinal force [N] at max load double _fxsPn; //!< Longitudinal load at sliding [N] at nominal load double _fxsP2n; //!< Longitudinal load at sliding [N] at max load double _sxmPn; //!< Slip sx at maximum longitudinal load Fx at nominal load @@ -366,8 +366,8 @@ struct TMeasyNrParam { // Longitudinal double _dfx0Pn; //!< Initial longitudinal slopes dFx/dsx [N] at Nominal load double _dfx0P2n; //!< Intial longitudinal slopes dFx/dsx [N] at max load - double _fxmPn; //!< Maximum longituidnal force [N] at nominal load - double _fxmP2n; //!< Maximum longituidnal force [N] at max load + double _fxmPn; //!< Maximum longitudinal force [N] at nominal load + double _fxmP2n; //!< Maximum longitudinal force [N] at max load double _fxsPn; //!< Longitudinal load at sliding [N] at nominal load double _fxsP2n; //!< Longitudinal load at sliding [N] at max load double _sxmPn; //!< Slip sx at maximum longitudinal load Fx at nominal load @@ -489,9 +489,9 @@ struct TMeasyNrState { // ----------------------------------------------------------------------------- /// @brief Defined here are chassis, engine/motor, powertrain, driveline and steering parameters required for the -/// simualtion of a 11 DOF model. +/// simulation of a 11 DOF model. -/// The single-track vehicle model, also known as the ’bicycle model’ and here the 11DOF model, is commonly used in +/// The single-track vehicle model, also known as the ’bicycle model’ and here the 11 DOF model, is commonly used in /// controller design and serves as the entry point in our library of vehicle models. The Chassis includes 3 DOF at the /// vehicle lumped C.M, representing the vehicle’s yaw, lateral, and longitudinal motions. This model assumes the same /// engine, torque converter, and powertrain as the 18 DOF and 24 DOF models. However, as it is a single-track model, it @@ -677,11 +677,11 @@ struct VehicleParam { }; /// @brief The VehicleState struct holds the chassis, engine/motor, powertrain, driveline and steering states required -/// for the simualtion. +/// for the simulation. /// Apart from the states that are updated by time integration, this struct also holds "non-states" /// such as accelerations, forces and torques that are not updated by time integration. See here for more details -/// https://uwmadison.box.com/s/2tsvr4adbrzklle30z0twpu2nlzvlayc. important to note that this implementation within the +/// https://uwmadison.box.com/s/2tsvr4adbrzklle30z0twpu2nlzvlayc. Important to note that this implementation within the /// d11GPU namespace is exactly the same as the implementation in the d11 namespace. The only difference is that the /// d11GPU namespace is meant to be used on the GPU where standard library functions are not available. struct VehicleState { @@ -765,14 +765,14 @@ struct VehicleState { }; // ----------------------------------------------------------------------------- -// Data structures that help handing multiple vehicles as needed in GPU version +// Data structures that help handling multiple vehicles as needed in GPU version // ----------------------------------------------------------------------------- -/// @brief The SimData struct holds the parameters of the vehicle and tire needed in kernel along with the +/// @brief The SimData struct holds the parameters of the vehicle and tire needed in kernel along with the /// driver inputs (steering, throttle, brake) in case specified at the beginning of the simulation. /// In essence, this /// stores all the "data" required to simulate 1 vehicle on the GPU. This is something largely the user does not have to -/// worrry about. +/// worry about. struct SimData { SimData() : _driver_data(nullptr), _driver_data_len(0) {} @@ -913,7 +913,7 @@ __device__ void tireToVehTransform(TMeasyNrState* tiref_st, /// input parameters __device__ void tmxy_combined(double* f, double* fos, double s, double df0, double sm, double fm, double ss, double fs); -/// @brief Computes the combined columnb force for the TMeasyNr tire model +/// @brief Computes the combined coulomb force for the TMeasyNr tire model /// This force provides the stability at low speeds and is belnded with the slip force provided by the tmxy_combined /// function. diff --git a/wheeled_vehicle_models/11dof-gpu/dof11_halfImplicit_gpu.cu b/wheeled_vehicle_models/11dof-gpu/dof11_halfImplicit_gpu.cu index 3460a75..ae77d34 100644 --- a/wheeled_vehicle_models/11dof-gpu/dof11_halfImplicit_gpu.cu +++ b/wheeled_vehicle_models/11dof-gpu/dof11_halfImplicit_gpu.cu @@ -291,7 +291,7 @@ void d11SolverHalfImplicitGPU::Initialize(d11GPU::VehicleState& vehicle_states, d11GPU::TMeasyState& tire_states_F, d11GPU::TMeasyState& tire_states_R, unsigned int num_vehicles) { - // Esnure that construct was called with TMeasy tire type + // Ensure that construct was called with TMeasy tire type assert((m_tire_type == TireType::TMeasy) && "Construct function called with TMeasyNr tire type, but Initialize called with TMeasy tire type"); assert((num_vehicles + m_vehicle_count_tracker_states <= m_total_num_vehicles) && @@ -312,7 +312,7 @@ void d11SolverHalfImplicitGPU::Initialize(d11GPU::VehicleState& vehicle_states, d11GPU::TMeasyNrState& tire_states_F, d11GPU::TMeasyNrState& tire_states_R, unsigned int num_vehicles) { - // Esnure that construct was called with TMeasyNr tire type + // Ensure that construct was called with TMeasyNr tire type assert((m_tire_type == TireType::TMeasyNr) && "Construct function called with TMeasy tire type, but Initialize called with TMeasyNR tire type"); assert((num_vehicles + m_vehicle_count_tracker_states <= m_total_num_vehicles) && @@ -338,7 +338,7 @@ __host__ void d11SolverHalfImplicitGPU::SetOutput(const std::string& output_file m_store_all = store_all; if (!m_store_all) { // Check if number of outputs asked is greater than the total number of vehicles, if this is the case, raise - // awarning and set to m_total_num_vehicles + // a warning and set to m_total_num_vehicles if (no_outs > m_total_num_vehicles) { std::cout << "Number of outputs asked is greater than the total number of vehicles, setting number of " "outputs to total number of vehicles" @@ -456,7 +456,7 @@ __host__ void d11SolverHalfImplicitGPU::Solve() { // If we have to save output, copy over the device into the response if (m_output) { - // Amount of respoonse already filled + // Amount of response already filled unsigned int filled_response = m_total_num_vehicles * m_collection_states * m_device_collection_timeSteps * kernel_launches_since_last_dump; @@ -625,7 +625,7 @@ __host__ void d11SolverHalfImplicitGPU::WriteToFile() { } for (unsigned int sim_no = 0; sim_no < loop_limit; sim_no++) { unsigned int index_by = 0; - // If we are no storing all, we will have to index by random numbers + // If we are not storing all, we will have to index by random numbers if (m_store_all) { index_by = sim_no; } else { diff --git a/wheeled_vehicle_models/11dof-gpu/dof11_halfImplicit_gpu.cuh b/wheeled_vehicle_models/11dof-gpu/dof11_halfImplicit_gpu.cuh index d7a54bc..e2e9c07 100644 --- a/wheeled_vehicle_models/11dof-gpu/dof11_halfImplicit_gpu.cuh +++ b/wheeled_vehicle_models/11dof-gpu/dof11_halfImplicit_gpu.cuh @@ -26,7 +26,7 @@ class d11SolverHalfImplicitGPU { /// Each of these vehicles will have the specified parameters and driver inputs. To add /// more vehicles (ensuring they are still lesser than the total number of vehicles initally specified in the class /// constructor) with different parameters, call the Construct function again. The tire type defaults to TMEasy and - /// is set for all the vehilces. It is also important to note thet the TireType has to be consistent across all the + /// is set for all the vehilces. It is also important to note that the TireType has to be consistent across all the /// vehicles currently. For examples of use, see demos. /// @param vehicle_params_file Path to the vehicle parameter json file /// @param tire_params_file Path to the tire parameter json file @@ -42,7 +42,7 @@ class d11SolverHalfImplicitGPU { /// Each of these vehicles will have the /// specified parameters and driver inputs. To add more vehicles with different parameters, call the Construct - /// function again. It is also important to note thet the TireType has to be consistent across all the + /// function again. It is also important to note that the TireType has to be consistent across all the /// vehicles currently. For examples of use, see demos. /// @param vehicle_params_file Path to the vehicle parameter json file /// @param tire_params_file Path to the tire parameter json file @@ -60,8 +60,8 @@ class d11SolverHalfImplicitGPU { /// Each of these vehicles will have the specified parameters. This function signature /// is mainly provided for cases where the driver inputs are not available at the start of the simulation but rather - /// come from a controller during the simualtion. TireType defualts to TMEasy tires. To add more vehicles with - /// different parameters, call the Construct function again. It is also important to note thet the TireType has to + /// come from a controller during the simulation. TireType defaults to TMEasy tires. To add more vehicles with + /// different parameters, call the Construct function again. It is also important to note that the TireType has to /// be consistent across all the vehicles currently. For examples of use, see demos. /// @param vehicle_params_file Path to the vehicle parameter json file /// @param tire_params_file Path to the tire parameter json file @@ -75,9 +75,9 @@ class d11SolverHalfImplicitGPU { /// Each of these vehicles will have the specified /// parameters. This is mainly provided for cases where the driver inputs are not available at the start of the - /// simulation but rather come from a controller during the simualtion and the user wants to specify a TireType. To + /// simulation but rather come from a controller during the simulation and the user wants to specify a TireType. To /// add more vehicles with different parameters, call the Construct function again. It is also important to note - /// thet the TireType has to be consistent across all the vehicles currently. For examples of use, see demos. + /// that the TireType has to be consistent across all the vehicles currently. For examples of use, see demos. /// @param vehicle_params_file Path to the vehicle parameter json file /// @param tire_params_file Path to the tire parameter json file /// @param num_vehicles Number of vehicles to be simulated with the specified parameters and driver inputs @@ -330,7 +330,7 @@ class d11SolverHalfImplicitGPU { // Need a bunch of csv writers for each of the vehicles. We will store a pointer to this list std::unique_ptr m_csv_writers_ptr; }; -// Cannout have global function as class member function +// Cannot have global function as class member function /// @brief Integrate the system of equations using the half implicit method - Calls the RHS function at each time step /// Used internally within Solve @@ -393,7 +393,7 @@ __global__ void Integrate(double current_time, d11GPU::SimData* sim_data, d11GPU::SimState* sim_states); //=================================================================================================================== -// Integrate calss rhsFun so this also cannot be a class member function +// Integrate calls rhsFun so this also cannot be a class member function /// @brief Computes the RHS of all the ODEs (tire velocities, chassis accelerations) using the computeRHS functions /// within the vehicle model diff --git a/wheeled_vehicle_models/11dof/README.md b/wheeled_vehicle_models/11dof/README.md index f417906..fdce405 100644 --- a/wheeled_vehicle_models/11dof/README.md +++ b/wheeled_vehicle_models/11dof/README.md @@ -25,7 +25,7 @@ It's important to highlight that there are several methods to set the CMake opti Once you launch the curses-based GUI for CMake, you will see an `Empty Cache`, hit `c` on your keyboard to see the CMake options. Here is the description of the CMake options - `BUILD_PYTHON_MODULE` - Bool to switch on the building of the Python wrapper. Default: `OFF` - `CMAKE_BUILD_TYPE` - Set the Build type (`Release` or `Debug`). Press `t` on your keyboard to toggle to `advanced mode` and see what Flags these build types use. Default: `Debug` -- `CMAKE_INSTALL_PREFIX` - Define's the root directory for installation when using the install target. Default (on Linux): `/usr/local` +- `CMAKE_INSTALL_PREFIX` - Defines the root directory for installation when using the install target. Default (on Linux): `/usr/local` - `USE_OPENMP` - Option to switch `ON` OpenMP for calculation of system RHS Jacobians. Leads to about 2X speed up. Default: `OFF` - `USE_SUNDIALS` - Option to link against [Sundials](https://sundials.readthedocs.io/en/latest/) and use the [CVODES](https://sundials.readthedocs.io/en/latest/cvodes/index.html) integrator to solve the system ODE's - Default: `OFF` @@ -40,7 +40,7 @@ Once Sundials is built successfully, `USE_SUNDIALS` is set to `ON` and `c` is hi - `SUNDIALS_DIR` - Here, set the absolute path to the sundials build directory. This is the directory in which the `SUNDIALSConfig.cmake` file is found. Once this path is correctly set, hit `c` to configure. -Once all the required options are set hit `c` to configure and `g` to generate. This will then populate your `build` directory with the necessary `makefile` with which you can build the 11DOF model along with its demos by running +Once all the required options are set hit `c` to configure and `g` to generate. This will then populate your `build` directory with the necessary `makefile` with which you can build the 11 DOF model along with its demos by running ```bash make -j4 ``` @@ -48,7 +48,7 @@ We recommend to not run `make install` to ensure path consistencies for the demo Once this is run, the `build` folder will be populated with the executables of the [demos](./demos) and the Python library (if `BUILD_PYTHON_MODULE` is set to `ON`). ### Python Wrapper -Since the Python module is built using SWIG, the path to the Python wrapper library needs to be appened to `PYTHON_PATH`. This library can be found in the build directory mentioned above and its path can be set (on Linux) permanently using the following instructions +Since the Python module is built using SWIG, the path to the Python wrapper library needs to be appended to `PYTHON_PATH`. This library can be found in the build directory mentioned above and its path can be set (on Linux) permanently using the following instructions 1) First, open your `bashrc` or `zshrc` file in a text-editor. 2) To this file add the following line ```bash diff --git a/wheeled_vehicle_models/11dof/dof11.cpp b/wheeled_vehicle_models/11dof/dof11.cpp index 97fea90..0f46c85 100644 --- a/wheeled_vehicle_models/11dof/dof11.cpp +++ b/wheeled_vehicle_models/11dof/dof11.cpp @@ -28,7 +28,7 @@ double d11::driveTorque(const VehicleParam& v_params, const double throttle, con powertrain_map[i]._y = v_params._powertrainMap[i]._y * throttle; } - // interpolate in the torque map to get the torque at this paticular + // interpolate in the torque map to get the torque at this particular // speed motor_torque = getMapY(powertrain_map, motor_speed); double motor_losses = getMapY(v_params._lossesMap, motor_speed); @@ -218,7 +218,7 @@ void d11::computeCombinedColumbForce(double& fx, fx = tanh(-2.0 * vsx / vcoulomb) * fz * mu; fy = tanh(-2.0 * vsy / vcoulomb) * fz * mu; - // Nromalize F to the circle + // Normalize F to the circle if (std::hypot(fx, fy) > fz * mu) { double f = fz * mu / std::hypot(fx, fy); fx *= f; @@ -449,7 +449,7 @@ void d11::computeTireRHS(TMeasyState& t_states, // Also compute the tire forces that need to be applied on the vehicle // Note here that these tire forces are computed using the current pre - // integreated xe, unline in the semi-implicit solver + // integrated xe, unline in the semi-implicit solver double fxdyn = t_params._dx * (-vtxs * t_params._cx * t_states._xe - fos * vsx) / (vtxs * t_params._dx + fos) + t_params._cx * t_states._xe; @@ -587,7 +587,7 @@ void d11::computeTireRHS(TMeasyNrState& t_states, Fy = 0.; } - // Now that we have both the columb force and the slip force, we can combine them with the sine blend to prevent + // Now that we have both the coulomb force and the slip force, we can combine them with the sine blend to prevent // force jumping Fx = (1.0 - frblend) * Fx0 + frblend * Fx; @@ -847,7 +847,7 @@ void d11::computePowertrainRHS(VehicleState& v_states, // have a state so we directly updated the crankOmega to be used v_states._crankOmega = 0.5 * (tiref_st._omega + tirer_st._omega) / v_params._gearRatios[v_states._current_gr]; - // The torque after tranny will then just become as there is no torque + // The torque after transmission will then just become wheel torque as there is no torque // converter torque_t = driveTorque(v_params, controls.m_throttle, v_states._crankOmega) / v_params._gearRatios[v_states._current_gr]; @@ -1108,7 +1108,7 @@ void d11::setTireParamsJSON(TMeasyNrParam& t_params, const char* fileName) { // level parameters if (d.HasMember("highLevelParams")) { if (d["highLevelParams"].GetBool()) { - // Set basic desing parameters + // Set basic design parameters t_params._jw = d["jw"].GetDouble() * 2.; t_params._rr = d["rr"].GetDouble() * 2.; t_params._mu = d["mu"].GetDouble() * 2.; @@ -1276,7 +1276,7 @@ void d11::setTireParamsJSON(TMeasyNrParam& t_params, const char* fileName) { } // Utility functions that guess the tire parameters for a TMeasy tire based on standard tire specifications that user -// can get from a spec sheet These functions are directly copy pasted from Chrono with minor modifications +// can get from a spec sheet. These functions are directly copy pasted from Chrono with minor modifications // Function to compute the max tire load from the load index specified by the user double d11::GetTireMaxLoad(unsigned int li) { diff --git a/wheeled_vehicle_models/11dof/dof11.h b/wheeled_vehicle_models/11dof/dof11.h index 535c789..ec5ce41 100644 --- a/wheeled_vehicle_models/11dof/dof11.h +++ b/wheeled_vehicle_models/11dof/dof11.h @@ -226,7 +226,7 @@ struct TMeasyState { _My(other._My), _engTor(other._engTor) {} - // the actual state that are intgrated + // the actual state that are integrated double _xe; //!< Longitudinal tire deflection double _ye; //!< Lateral tire deflection double _xedot; //!< Longitudinal tire deflection velocity @@ -485,7 +485,7 @@ struct TMeasyNrState { /// @brief Defined here are chassis, engine/motor, powertrain, driveline and steering parameters required for the /// simualtion of a 11 DOF model. -/// The single-track vehicle model, also known as the ’bicycle model’ and here the 11DOF model, is commonly used in +/// The single-track vehicle model, also known as the ’bicycle model’ and here the 11 DOF model, is commonly used in /// controller design and serves as the entry point in our library of vehicle models. The Chassis includes 3 DOF at the /// vehicle lumped C.M, representing the vehicle’s yaw, lateral, and longitudinal motions. This model assumes the same /// engine, torque converter, and powertrain as the 18 DOF and 24 DOF models. However, as it is a single-track model, it @@ -834,9 +834,9 @@ void tireToVehTransform(TMeasyNrState& tiref_st, /// input parameters void tmxy_combined(double& f, double& fos, double s, double df0, double sm, double fm, double ss, double fs); -/// @brief Computes the combined columnb force for the TMeasyNr tire model +/// @brief Computes the combined coulomb force for the TMeasyNr tire model -/// This force provides the stability at low speeds and is belnded with the slip force provided by the tmxy_combined +/// This force provides the stability at low speeds and is blended with the slip force provided by the tmxy_combined /// function. void computeCombinedColumbForce(double& fx, double& fy, double mu, double vsx, double vsy, double fz, double vcoulomb); @@ -875,7 +875,7 @@ void computeTireRHS(TMeasyState& t_states, const TMeasyParam& t_params, const Ve /// @brief Computes the tire forces for the TMeasyNr tire model in the tire contact patch frame (T-RF) /// For the TMeasyNr tire model, since there is no relaxation, the tire forces from slip are blended with the tire -/// forces from columb friction. The blend coefficient depends on the longitudinal slip velocity of the tire. This model +/// forces from coulomb friction. The blend coefficient depends on the longitudinal slip velocity of the tire. This model /// is an approximation of the original TMeasy tire model and is inspired by the Project Chrono implementation (see code /// at https://github.com/projectchrono/chrono/blob/main/src/chrono_vehicle/wheeled_vehicle/tire/ChTMeasyTire.h). /// @param t_states TMeasyNr tire states diff --git a/wheeled_vehicle_models/11dof/dof11_halfImplicit.cpp b/wheeled_vehicle_models/11dof/dof11_halfImplicit.cpp index 4c49c2b..51386aa 100644 --- a/wheeled_vehicle_models/11dof/dof11_halfImplicit.cpp +++ b/wheeled_vehicle_models/11dof/dof11_halfImplicit.cpp @@ -362,12 +362,12 @@ double d11SolverHalfImplicit::IntegrateStepWithJacobian(double t, // Set a vector of del Ys - for now set this to some scale of y std::vector delY(y.begin(), y.end()); - // In a loop pertub each state and get the corresponding perturbed ydot + // In a loop perturb each state and get the corresponding perturbed ydot int ySize = y.size(); #pragma omp parallel for simd for (int i = 0; i < ySize; i++) { - // Perterbation is 1e-3 * y (since some states are really small values wile some are huge) + // Perturbation is 1e-3 * y (since some states are really small values wile some are huge) delY[i] = std::abs(delY[i] * 1e-3); if (delY[i] < 1e-8) { // This means that the particular state is 0. In this case set dels to 1e-3 @@ -402,7 +402,7 @@ double d11SolverHalfImplicit::IntegrateStepWithJacobian(double t, // Set a vector of del controls - for now we ingnore braking std::vector delControls = {1e-3, 1e-3}; - // In a loop pertub each control and get the corresponding perturbed ydot + // In a loop perturb each control and get the corresponding perturbed ydot int controlSize = delControls.size(); for (int i = 0; i < controlSize; i++) { diff --git a/wheeled_vehicle_models/11dof/dof11_sundials.h b/wheeled_vehicle_models/11dof/dof11_sundials.h index 09ee2f1..f433bea 100644 --- a/wheeled_vehicle_models/11dof/dof11_sundials.h +++ b/wheeled_vehicle_models/11dof/dof11_sundials.h @@ -370,5 +370,5 @@ static int check_retval(void* returnvalue, const char* funcname, int opt) { void printSUNMatrix(SUNMatrix A, sunindextype matrows, sunindextype matcols); } // namespace d11 -#endif // SWIG -#endif // DOF18_SUNDIALS_H +#endif +#endif diff --git a/wheeled_vehicle_models/18dof-gpu/README.md b/wheeled_vehicle_models/18dof-gpu/README.md index 73db9df..1e9ed56 100644 --- a/wheeled_vehicle_models/18dof-gpu/README.md +++ b/wheeled_vehicle_models/18dof-gpu/README.md @@ -32,10 +32,10 @@ Once you launch the curses-based GUI for CMake, you will see an `Empty Cache`, h - `CUDA_USE_STATIC_CUDA_RUNTIME` - Boolean for whether CUDA runtime is statically linked. Leave as is. Default: `ON` - `CUDA_rt_LIBRARY` - Path to CUDA runtime library. Should be automatically filled in. Default: `path_to_runtime_library_on_your_machine` - Once the options are set, hit `c` to configure and `g` to generate. This will then populate your `build` directory with the necessary `makefile` with which you can build the 18dof-gpu model along with its demos by running + Once the options are set, hit `c` to configure and `g` to generate. This will then populate your `build` directory with the necessary `makefile` with which you can build the 18 DOF GPU model along with its demos by running ```bash make -j4 ``` -We recommend to not run `make install` to ensure path consistencies for the demos (as they call upon certain data files relative to the build directory +We recommend to not run `make install` to ensure path consistencies for the demos (as they call upon certain data files relative to the build directory). diff --git a/wheeled_vehicle_models/18dof-gpu/dof18_gpu.cu b/wheeled_vehicle_models/18dof-gpu/dof18_gpu.cu index 9361358..5644261 100644 --- a/wheeled_vehicle_models/18dof-gpu/dof18_gpu.cu +++ b/wheeled_vehicle_models/18dof-gpu/dof18_gpu.cu @@ -24,7 +24,7 @@ __device__ double d18GPU::driveTorque(const VehicleParam* v_params, const double powertrain_map[i]._y = v_params->_powertrainMap[i]._y * throttle; } - // interpolate in the torque map to get the torque at this paticular + // interpolate in the torque map to get the torque at this particular // speed motor_torque = getMapY(powertrain_map, motor_speed, v_params->_powertrainMapSize); double motor_losses = getMapY(v_params->_lossesMap, motor_speed, v_params->_lossesMapSize); @@ -38,7 +38,7 @@ __device__ double d18GPU::driveTorque(const VehicleParam* v_params, const double } // Function that calculates the torque split to each tire based on the -// differential max bias Exactly the same as Chrono implementation +// differential max bias exactly the same as Chrono implementation __device__ void d18GPU::differentialSplit(double torque, double max_bias, double speed_left, @@ -223,7 +223,7 @@ __device__ void d18GPU::tireToVehTransform(TMeasyNrState* tirelf_st, /// Tire Functions // ----------------------------------------------------------- -// Code for the TM easy tire model implemented with the 8DOF model +// Code for the TM easy tire model implemented with the 18 DOF model __device__ __host__ void d18GPU::tireInit(TMeasyParam* t_params) { // calculates some critical values that are needed t_params->_fzRdynco = (t_params->_pn * (t_params->_rdyncoP2n - 2.0 * t_params->_rdyncoPn + 1.)) / @@ -284,7 +284,7 @@ d18GPU::tmxy_combined(double* f, double* fos, double s, double df0, double sm, d } } -__device__ void d18GPU::computeCombinedColumbForce(double* fx, +__device__ void d18GPU::computeCombinedcoulombForce(double* fx, double* fy, double mu, double vsx, @@ -508,7 +508,7 @@ __device__ void d18GPU::computeTireRHS(TMeasyState* t_states, // Also compute the tire forces that need to be applied on the vehicle // Note here that these tire forces are computed using the current pre - // integreated xe, unline in the semi-implicit solver + // integrated xe, unline in the semi-implicit solver double fxdyn = t_params->_dx * (-vtxs * t_params->_cx * t_states->_xe - fos * vsx) / (vtxs * t_params->_dx + fos) + t_params->_cx * t_states->_xe; @@ -582,7 +582,7 @@ __device__ void d18GPU::computeTireRHS(TMeasyNrState* t_states, // Compute the combined column force (used for low speed stability) double Fx0 = 0; double Fy0 = 0; - computeCombinedColumbForce(&Fx0, &Fy0, t_params->_mu, vsx, vsy, fz, t_params->_vcoulomb); + computeCombinedcoulombForce(&Fx0, &Fy0, t_params->_mu, vsx, vsy, fz, t_params->_vcoulomb); // evaluate the slips double sx = -vsx / vta; @@ -612,7 +612,7 @@ __device__ void d18GPU::computeTireRHS(TMeasyNrState* t_states, double sxs = InterpL(fz, t_params->_sxsPn, t_params->_sxsP2n, t_params->_pn); double sys = InterpL(fz, t_params->_sysPn, t_params->_sysP2n, t_params->_pn); - // Compute the coefficient to "blend" the columb force with the slip force + // Compute the coefficient to "blend" the coulomb force with the slip force double frblend = sineStep(abs(t_states->_vsx), t_params->_frblend_begin, 0., t_params->_frblend_end, 1.); // Now standard TMeasy tire forces // For now, not using any normalization of the slips - similar to Chrono implementation @@ -647,7 +647,7 @@ __device__ void d18GPU::computeTireRHS(TMeasyNrState* t_states, Fy = 0.; } - // Now that we have both the columb force and the slip force, we can combine them with the sine blend to prevent + // Now that we have both the coulomb force and the slip force, we can combine them with the sine blend to prevent // force jumping Fx = (1.0 - frblend) * Fx0 + frblend * Fx; @@ -767,7 +767,7 @@ __device__ void d18GPU::computePowertrainRHS(VehicleState* v_states, v_states->_crankOmega = 0.25 * (tirelf_st->_omega + tirerf_st->_omega + tirelr_st->_omega + tirerr_st->_omega) / v_params->_gearRatios[v_states->_current_gr]; - // The torque after tranny will then just become as there is no torque + // The torque after transmission will then just become as there is no torque // converter torque_t = driveTorque(v_params, controls->m_throttle, v_states->_crankOmega) / v_params->_gearRatios[v_states->_current_gr]; @@ -943,7 +943,7 @@ __device__ void d18GPU::computePowertrainRHS(VehicleState* v_states, v_states->_crankOmega = 0.25 * (tirelf_st->_omega + tirerf_st->_omega + tirelr_st->_omega + tirerr_st->_omega) / v_params->_gearRatios[v_states->_current_gr]; - // The torque after tranny will then just become as there is no torque + // The torque after transmission will then just become as there is no torque // converter torque_t = driveTorque(v_params, controls->m_throttle, v_states->_crankOmega) / v_params->_gearRatios[v_states->_current_gr]; @@ -1235,8 +1235,7 @@ __host__ void d18GPU::setTireParamsJSON(TMeasyParam& t_params, const char* fileN std::cout << "Error with rapidjson:" << std::endl << d.GetParseError() << std::endl; } - // pray to what ever you believe in and hope that the json file has all - // these + t_params._jw = d["jw"].GetDouble(); t_params._rr = d["rr"].GetDouble(); t_params._r0 = d["r0"].GetDouble(); diff --git a/wheeled_vehicle_models/18dof-gpu/dof18_gpu.cuh b/wheeled_vehicle_models/18dof-gpu/dof18_gpu.cuh index d74138e..2354e92 100644 --- a/wheeled_vehicle_models/18dof-gpu/dof18_gpu.cuh +++ b/wheeled_vehicle_models/18dof-gpu/dof18_gpu.cuh @@ -131,8 +131,8 @@ struct TMeasyParam { // Longitudinal double _dfx0Pn; //!< Initial longitudinal slopes dFx/dsx [N] at Nominal load double _dfx0P2n; //!< Intial longitudinal slopes dFx/dsx [N] at max load - double _fxmPn; //!< Maximum longituidnal force [N] at nominal load - double _fxmP2n; //!< Maximum longituidnal force [N] at max load + double _fxmPn; //!< Maximum longitudinal force [N] at nominal load + double _fxmP2n; //!< Maximum longitudinal force [N] at max load double _fxsPn; //!< Longitudinal load at sliding [N] at nominal load double _fxsP2n; //!< Longitudinal load at sliding [N] at max load double _sxmPn; //!< Slip sx at maximum longitudinal load Fx at nominal load @@ -367,8 +367,8 @@ struct TMeasyNrParam { // Longitudinal double _dfx0Pn; //!< Initial longitudinal slopes dFx/dsx [N] at Nominal load double _dfx0P2n; //!< Intial longitudinal slopes dFx/dsx [N] at max load - double _fxmPn; //!< Maximum longituidnal force [N] at nominal load - double _fxmP2n; //!< Maximum longituidnal force [N] at max load + double _fxmPn; //!< Maximum longitudinal force [N] at nominal load + double _fxmP2n; //!< Maximum longitudinal force [N] at max load double _fxsPn; //!< Longitudinal load at sliding [N] at nominal load double _fxsP2n; //!< Longitudinal load at sliding [N] at max load double _sxmPn; //!< Slip sx at maximum longitudinal load Fx at nominal load @@ -634,7 +634,7 @@ struct VehicleParam { bool _tcbool; //!< Boolean that checks for the presence of a torque converter. Can be set using "tcBool" in the //!< JSON file. Defaults to 0 if not specified. - double _maxBrakeTorque; //!< The maximum braking torque (Nm) that the brakes applu to the wheels. Can be set using + double _maxBrakeTorque; //!< The maximum braking torque (Nm) that the brakes apply to the wheels. Can be set using //!< "maxBrakeTorque" in the JSON file. Based on the normalized brake input between 0 and //!< 1, a torque input*_maxBrakeTorque is applied to the wheel. @@ -1001,7 +1001,7 @@ __device__ void tmxy_combined(double* f, double* fos, double s, double df0, doub /// This force provides the stability at low speeds and is belnded with the slip force provided by the tmxy_combined /// function. __device__ void -computeCombinedColumbForce(double* fx, double* fy, double mu, double vsx, double vsy, double fz, double vcoulomb); +computeCombinedcoulombForce(double* fx, double* fy, double mu, double vsx, double vsy, double fz, double vcoulomb); /// @brief Compute the vertical loads on the tire using quasi-static load transfer equations. @@ -1041,7 +1041,7 @@ __device__ void computeTireRHS(TMeasyState* t_states, /// @brief Computes the tire forces for the TMeasyNr tire model in the tire contact patch frame (T-RF) /// For the TMeasyNr tire model, since there is no relaxation, the tire forces from slip are blended with the tire -/// forces from columb friction. The blend coefficient depends on the longitudinal slip velocity of the tire. This model +/// forces from coulomb friction. The blend coefficient depends on the longitudinal slip velocity of the tire. This model /// is an approximation of the original TMeasy tire model and is inspired by the Project Chrono implementation (see code /// at https://github.com/projectchrono/chrono/blob/main/src/chrono_vehicle/wheeled_vehicle/tire/ChTMeasyTire.h). /// @param t_states TMeasyNr tire states diff --git a/wheeled_vehicle_models/18dof-gpu/dof18_halfImplicit_gpu.cu b/wheeled_vehicle_models/18dof-gpu/dof18_halfImplicit_gpu.cu index 118b906..965bac5 100644 --- a/wheeled_vehicle_models/18dof-gpu/dof18_halfImplicit_gpu.cu +++ b/wheeled_vehicle_models/18dof-gpu/dof18_halfImplicit_gpu.cu @@ -293,7 +293,7 @@ __host__ void d18SolverHalfImplicitGPU::Initialize(d18GPU::VehicleState& vehicle d18GPU::TMeasyState& tire_states_LR, d18GPU::TMeasyState& tire_states_RR, unsigned int num_vehicles) { - // Esnure that construct was called with TMeasy tire type + // Ensure that construct was called with TMeasy tire type assert((m_tire_type == TireType::TMeasy) && "Construct function called with TMeasyNr tire type, but Initialize called with TMeasy tire type"); assert((num_vehicles + m_vehicle_count_tracker_states <= m_total_num_vehicles) && @@ -319,7 +319,7 @@ __host__ void d18SolverHalfImplicitGPU::Initialize(d18GPU::VehicleState& vehicle d18GPU::TMeasyNrState& tire_states_LR, d18GPU::TMeasyNrState& tire_states_RR, unsigned int num_vehicles) { - // Esnure that construct was called with TMeasyNr tire type + // Ensure that construct was called with TMeasyNr tire type assert((m_tire_type == TireType::TMeasyNr) && "Construct function called with TMeasy tire type, but Initialize called with TMeasyNR tire type"); assert((num_vehicles + m_vehicle_count_tracker_states <= m_total_num_vehicles) && @@ -644,7 +644,7 @@ __host__ void d18SolverHalfImplicitGPU::WriteToFile() { } for (unsigned int sim_no = 0; sim_no < loop_limit; sim_no++) { unsigned int index_by = 0; - // If we are no storing all, we will have to index by random numbers + // If we are not storing all, we will have to index by random numbers if (m_store_all) { index_by = sim_no; } else { diff --git a/wheeled_vehicle_models/18dof-gpu/dof18_halfImplicit_gpu.cuh b/wheeled_vehicle_models/18dof-gpu/dof18_halfImplicit_gpu.cuh index 7da835b..515295e 100644 --- a/wheeled_vehicle_models/18dof-gpu/dof18_halfImplicit_gpu.cuh +++ b/wheeled_vehicle_models/18dof-gpu/dof18_halfImplicit_gpu.cuh @@ -59,7 +59,7 @@ class d18SolverHalfImplicitGPU { /// Each of these vehicles will have the specified parameters. This function signature /// is mainly provided for cases where the driver inputs are not available at the start of the simulation but rather - /// come from a controller during the simualtion. TireType defualts to TMEasy tires. To add more vehicles with + /// come from a controller during the simulation. TireType defualts to TMEasy tires. To add more vehicles with /// different parameters, call the Construct function again. It is also important to note thet the TireType has to /// be consistent across all the vehicles currently. For examples of use, see demos. /// @param vehicle_params_file Path to the vehicle parameter json file @@ -74,7 +74,7 @@ class d18SolverHalfImplicitGPU { /// Each of these vehicles will have the specified /// parameters. This is mainly provided for cases where the driver inputs are not available at the start of the - /// simulation but rather come from a controller during the simualtion and the user wants to specify a TireType. To + /// simulation but rather come from a controller during the simulation and the user wants to specify a TireType. To /// add more vehicles with different parameters, call the Construct function again. It is also important to note /// thet the TireType has to be consistent across all the vehicles currently. For examples of use, see demos. /// @param vehicle_params_file Path to the vehicle parameter json file @@ -404,7 +404,7 @@ __global__ void Integrate(double current_time, d18GPU::SimData* sim_data, d18GPU::SimState* sim_states); //=================================================================================================================== -// Integrate calss rhsFun so this also cannot be a class member function +// Integrate calls rhsFun so this also cannot be a class member function /// @brief Computes the RHS of all the ODEs (tire velocities, chassis accelerations) using the computeRHS functions /// within the vehicle model diff --git a/wheeled_vehicle_models/18dof/README.md b/wheeled_vehicle_models/18dof/README.md index 89c7974..d44920b 100644 --- a/wheeled_vehicle_models/18dof/README.md +++ b/wheeled_vehicle_models/18dof/README.md @@ -1,5 +1,5 @@ ## Overview -The 11 Degree Of Freedom (DOF) vehicle model is a double-track vehicle model with simplified roll and no pitch. This is the intermediate level of fidelity and is thus faster than the 24dof model but slower than the 11 DOF model. The 18 DOF model does not capture pitch and heave motions, and the front and rear suspension are represented simply by their respective roll stiffness and roll damping coefficients. Additionally, wheel lift off conditions cannot be simulated. The vertical forces $F_{z_{ij}}$ are obtained based on quasi-static lateral and longitudinal load transfers. This model assumes the same engine, torque converter, powertrain and TMeasy tires as the 11 DOF and 24 DOF models. The 18 DOF model takes the same input as the 11 DOF and 24 DOF models - Throttle $\in [0,1]$, Braking $\in [0,1]$ and Steering $\in [-1,1]$ where $-1$ is a full left turn. See chapter 2 [here](https://uwmadison.box.com/s/2tsvr4adbrzklle30z0twpu2nlzvlayc) for more details. +The 18 Degree Of Freedom (DOF) vehicle model is a double-track vehicle model with simplified roll and no pitch. This is the intermediate level of fidelity and is thus faster than the 24 DOF model but slower than the 11 DOF model. The 18 DOF model does not capture pitch and heave motions, and the front and rear suspension are represented simply by their respective roll stiffness and roll damping coefficients. Additionally, wheel lift off conditions cannot be simulated. The vertical forces $F_{z_{ij}}$ are obtained based on quasi-static lateral and longitudinal load transfers. This model assumes the same engine, torque converter, powertrain and TMeasy tires as the 11 DOF and 24 DOF models. The 18 DOF model takes the same input as the 11 DOF and 24 DOF models - Throttle $\in [0,1]$, Braking $\in [0,1]$ and Steering $\in [-1,1]$ where $-1$ is a full left turn. See chapter 2 [here](https://uwmadison.box.com/s/2tsvr4adbrzklle30z0twpu2nlzvlayc) for more details. ### Where do I set model parameters? Model parameters are set through JSON files which are then used in the `construct` solver function. Examples of these JSON files are available for 2 different vehicles in [data/json/HMMWV](./data/json/HMMWV) and [data/json/Sedan](./data/json/Sedan). Examples of use are available in [demos](./demos/). @@ -39,7 +39,7 @@ Once Sundials is built successfully, `USE_SUNDIALS` is set to `ON` and `c` is hi - `SUNDIALS_DIR` - Here, set the absolute path to the sundials build directory. This is the directory in which the `SUNDIALSConfig.cmake` file is found. Once this path is correctly set, hit `c` to configure. -Once all the required options are set hit `c` to configure and `g` to generate. This will then populate your `build` directory with the necessary `makefile` with which you can build the 18dof model along with its demos by running +Once all the required options are set hit `c` to configure and `g` to generate. This will then populate your `build` directory with the necessary `makefile` with which you can build the 18 DOF model along with its demos by running ```bash make -j4 ``` @@ -47,7 +47,7 @@ We recommend to not run `make install` to ensure path consistencies for the demo Once this is run, the `build` folder will be populated with the executables of the [demos](./demos) and the Python library (if `BUILD_PYTHON_MODULE` is set to `ON`). ### Python Wrapper -Since the Python module is built using SWIG, the path to the Python wrapper library needs to be appened to `PYTHON_PATH`. This library can be found in the build directory mentioned above and its path can be set (on Linux) permanently using the following instructions +Since the Python module is built using SWIG, the path to the Python wrapper library needs to be appended to `PYTHON_PATH`. This library can be found in the build directory mentioned above and its path can be set (on Linux) permanently using the following instructions 1) First, open your `bashrc` or `zshrc` file in a text-editor. 2) To this file add the following line ```bash diff --git a/wheeled_vehicle_models/18dof/dof18.cpp b/wheeled_vehicle_models/18dof/dof18.cpp index 8c49fac..0dfa859 100644 --- a/wheeled_vehicle_models/18dof/dof18.cpp +++ b/wheeled_vehicle_models/18dof/dof18.cpp @@ -28,7 +28,7 @@ double d18::driveTorque(const VehicleParam& v_params, const double throttle, con powertrain_map[i]._y = v_params._powertrainMap[i]._y * throttle; } - // interpolate in the torque map to get the torque at this paticular + // interpolate in the torque map to get the torque at this particular // speed motor_torque = getMapY(powertrain_map, motor_speed); double motor_losses = getMapY(v_params._lossesMap, motor_speed); @@ -42,7 +42,7 @@ double d18::driveTorque(const VehicleParam& v_params, const double throttle, con } // Function that calculates the torque split to each tire based on the -// differential max bias Exactly the same as Chrono implementation +// differential max bias exactly the same as Chrono implementation void d18::differentialSplit(double torque, double max_bias, double speed_left, @@ -107,7 +107,7 @@ void d18::vehToTireTransform(TMeasyState& tirelf_st, tirelr_st._vsy = v_states._v - v_states._wz * v_params._b; tirelr_st._vsx = v_states._u - (v_states._wz * v_params._cr) / 2.; - // rigth rear - No steer + // right rear - No steer tirerr_st._fz = loads[3]; tirerr_st._vsy = v_states._v - v_states._wz * v_params._b; tirerr_st._vsx = v_states._u + (v_states._wz * v_params._cr) / 2.; @@ -149,7 +149,7 @@ void d18::vehToTireTransform(TMeasyNrState& tirelf_st, tirelr_st._vsy = v_states._v - v_states._wz * v_params._b; tirelr_st._vsx = v_states._u - (v_states._wz * v_params._cr) / 2.; - // rigth rear - No steer + // right rear - No steer tirerr_st._fz = loads[3]; tirerr_st._vsy = v_states._v - v_states._wz * v_params._b; tirerr_st._vsx = v_states._u + (v_states._wz * v_params._cr) / 2.; @@ -227,7 +227,7 @@ void d18::tireToVehTransform(TMeasyNrState& tirelf_st, /// Tire Functions //////////////////////////////////////////////////////////// -// Code for the TM easy tire model implemented with the 8DOF model +// Code for the TM easy tire model implemented with the 18 DOF model void d18::tireInit(TMeasyParam& t_params) { // calculates some critical values that are needed t_params._fzRdynco = (t_params._pn * (t_params._rdyncoP2n - 2.0 * t_params._rdyncoPn + 1.)) / @@ -287,7 +287,7 @@ void d18::tmxy_combined(double& f, double& fos, double s, double df0, double sm, } } -void d18::computeCombinedColumbForce(double& fx, +void d18::computeCombinedcoulombForce(double& fx, double& fy, double mu, double vsx, @@ -590,7 +590,7 @@ void d18::computeTireRHS(TMeasyNrState& t_states, // Compute the combined column force (used for low speed stability) double Fx0 = 0; double Fy0 = 0; - computeCombinedColumbForce(Fx0, Fy0, t_params._mu, vsx, vsy, fz, t_params._vcoulomb); + computeCombinedcoulombForce(Fx0, Fy0, t_params._mu, vsx, vsy, fz, t_params._vcoulomb); // evaluate the slips double sx = -vsx / vta; @@ -620,7 +620,7 @@ void d18::computeTireRHS(TMeasyNrState& t_states, double sxs = InterpL(fz, t_params._sxsPn, t_params._sxsP2n, t_params._pn); double sys = InterpL(fz, t_params._sysPn, t_params._sysP2n, t_params._pn); - // Compute the coefficient to "blend" the columb force with the slip force + // Compute the coefficient to "blend" the coulomb force with the slip force double frblend = sineStep(std::abs(t_states._vsx), t_params._frblend_begin, 0., t_params._frblend_end, 1.); // Now standard TMeasy tire forces // For now, not using any normalization of the slips - similar to Chrono implementation @@ -655,7 +655,7 @@ void d18::computeTireRHS(TMeasyNrState& t_states, Fy = 0.; } - // Now that we have both the columb force and the slip force, we can combine them with the sine blend to prevent + // Now that we have both the coulomb force and the slip force, we can combine them with the sine blend to prevent // force jumping Fx = (1.0 - frblend) * Fx0 + frblend * Fx; @@ -1231,8 +1231,7 @@ void d18::setTireParamsJSON(TMeasyParam& t_params, const char* fileName) { std::cout << "Error with rapidjson:" << std::endl << d.GetParseError() << std::endl; } - // pray to what ever you believe in and hope that the json file has all - // these + t_params._jw = d["jw"].GetDouble(); t_params._rr = d["rr"].GetDouble(); t_params._r0 = d["r0"].GetDouble(); diff --git a/wheeled_vehicle_models/18dof/dof18.h b/wheeled_vehicle_models/18dof/dof18.h index b1156a5..24e628b 100644 --- a/wheeled_vehicle_models/18dof/dof18.h +++ b/wheeled_vehicle_models/18dof/dof18.h @@ -129,8 +129,8 @@ struct TMeasyParam { // Longitudinal double _dfx0Pn; //!< Initial longitudinal slopes dFx/dsx [N] at Nominal load double _dfx0P2n; //!< Intial longitudinal slopes dFx/dsx [N] at max load - double _fxmPn; //!< Maximum longituidnal force [N] at nominal load - double _fxmP2n; //!< Maximum longituidnal force [N] at max load + double _fxmPn; //!< Maximum longitudinal force [N] at nominal load + double _fxmP2n; //!< Maximum longitudinal force [N] at max load double _fxsPn; //!< Longitudinal load at sliding [N] at nominal load double _fxsP2n; //!< Longitudinal load at sliding [N] at max load double _sxmPn; //!< Slip sx at maximum longitudinal load Fx at nominal load @@ -361,8 +361,8 @@ struct TMeasyNrParam { // Longitudinal double _dfx0Pn; //!< Initial longitudinal slopes dFx/dsx [N] at Nominal load double _dfx0P2n; //!< Intial longitudinal slopes dFx/dsx [N] at max load - double _fxmPn; //!< Maximum longituidnal force [N] at nominal load - double _fxmP2n; //!< Maximum longituidnal force [N] at max load + double _fxmPn; //!< Maximum longitudinal force [N] at nominal load + double _fxmP2n; //!< Maximum longitudinal force [N] at max load double _fxsPn; //!< Longitudinal load at sliding [N] at nominal load double _fxsP2n; //!< Longitudinal load at sliding [N] at max load double _sxmPn; //!< Slip sx at maximum longitudinal load Fx at nominal load @@ -889,7 +889,7 @@ void tmxy_combined(double& f, double& fos, double s, double df0, double sm, doub /// @brief Computes the combined columnb force for the TMeasyNr tire model -/// This force provides the stability at low speeds and is belnded with the slip force provided by the tmxy_combined +/// This force provides the stability at low speeds and is blended with the slip force provided by the tmxy_combined /// function. void computeCombinedColumbForce(double& fx, double& fy, double mu, double vsx, double vsy, double fz, double vcoulomb); @@ -928,7 +928,7 @@ void computeTireRHS(TMeasyState& t_states, const TMeasyParam& t_params, const Ve /// @brief Computes the tire forces for the TMeasyNr tire model in the tire contact patch frame (T-RF) /// For the TMeasyNr tire model, since there is no relaxation, the tire forces from slip are blended with the tire -/// forces from columb friction. The blend coefficient depends on the longitudinal slip velocity of the tire. This model +/// forces from coulomb friction. The blend coefficient depends on the longitudinal slip velocity of the tire. This model /// is an approximation of the original TMeasy tire model and is inspired by the Project Chrono implementation (see code /// at https://github.com/projectchrono/chrono/blob/main/src/chrono_vehicle/wheeled_vehicle/tire/ChTMeasyTire.h). /// @param t_states TMeasyNr tire states diff --git a/wheeled_vehicle_models/18dof/dof18_halfImplicit.cpp b/wheeled_vehicle_models/18dof/dof18_halfImplicit.cpp index 712e494..38e9080 100644 --- a/wheeled_vehicle_models/18dof/dof18_halfImplicit.cpp +++ b/wheeled_vehicle_models/18dof/dof18_halfImplicit.cpp @@ -385,12 +385,12 @@ double d18SolverHalfImplicit::IntegrateStepWithJacobian(double t, // Set a vector of del Ys - for now set this to some scale of y std::vector delY(y.begin(), y.end()); - // In a loop pertub each state and get the corresponding perturbed ydot + // In a loop perturb each state and get the corresponding perturbed ydot int ySize = y.size(); #pragma omp parallel for simd for (int i = 0; i < ySize; i++) { - // Perterbation is 1e-3 * y (since some states are really small values wile some are huge) + // Perturbation is 1e-3 * y (since some states are really small values wile some are huge) delY[i] = std::abs(delY[i] * 1e-3); if (delY[i] < 1e-8) { // This means that the particular state is 0. In this case set dels to 1e-3 @@ -423,9 +423,9 @@ double d18SolverHalfImplicit::IntegrateStepWithJacobian(double t, // Computing the control jacobian //=============================== - // Set a vector of del controls - for now we ingnore braking + // Set a vector of del controls - for now we ignore braking std::vector delControls = {1e-3, 1e-3}; - // In a loop pertub each control and get the corresponding perturbed ydot + // In a loop perturb each control and get the corresponding perturbed ydot int controlSize = delControls.size(); for (int i = 0; i < controlSize; i++) { @@ -674,7 +674,7 @@ void d18SolverHalfImplicit::rhsFun(double t, DriverInput& controls) { // ====================================================================================================================== -// Function takes (y +- dely) and provides a new ydot for the pertubed y (ydot is the rhs of the system of equations) +// Function takes (y +- dely) and provides a new ydot for the perturbed y (ydot is the rhs of the system of equations) void d18SolverHalfImplicit::PerturbRhsFun(std::vector& y, DriverInput& controls, std::vector& ydot) { // Extract the vehicle and tire states vector state diff --git a/wheeled_vehicle_models/24dof-gpu/README.md b/wheeled_vehicle_models/24dof-gpu/README.md index 8de0614..b9844b7 100644 --- a/wheeled_vehicle_models/24dof-gpu/README.md +++ b/wheeled_vehicle_models/24dof-gpu/README.md @@ -32,10 +32,10 @@ Once you launch the curses-based GUI for CMake, you will see an `Empty Cache`, h - `CUDA_USE_STATIC_CUDA_RUNTIME` - Boolean for whether CUDA runtime is statically linked. Leave as is. Default: `ON` - `CUDA_rt_LIBRARY` - Path to CUDA runtime library. Should be automatically filled in. Default: `path_to_runtime_library_on_your_machine` - Once the options are set, hit `c` to configure and `g` to generate. This will then populate your `build` directory with the necessary `makefile` with which you can build the 24dof-gpu model along with its demos by running + Once the options are set, hit `c` to configure and `g` to generate. This will then populate your `build` directory with the necessary `makefile` with which you can build the 24 DOF GPU model along with its demos by running ```bash make -j4 ``` -We recommend to not run `make install` to ensure path consistencies for the demos (as they call upon certain data files relative to the build directory +We recommend to not run `make install` to ensure path consistencies for the demos (as they call upon certain data files relative to the build directory). diff --git a/wheeled_vehicle_models/24dof-gpu/dof24_gpu.cu b/wheeled_vehicle_models/24dof-gpu/dof24_gpu.cu index 358edad..c7f964b 100644 --- a/wheeled_vehicle_models/24dof-gpu/dof24_gpu.cu +++ b/wheeled_vehicle_models/24dof-gpu/dof24_gpu.cu @@ -264,7 +264,7 @@ __device__ void d24GPU::vehToSusTransform(const VehicleState* v_states, susrr_st->_vs = -v_params->_b * v_states->_wz + v_states->_v; // y direction susrr_st->_ws = (-v_params->_cr * v_states->_wx / 2.) + v_params->_b * v_states->_wy + v_states->_w; // z direction - // Evalute the length of the struct and its compression velocity in current time step + // Evaluate the length of the struct and its compression velocity in current time step // This is to get the unsprung mass velocity and accelerations in G-RF // Instantaneous length of the strut @@ -942,7 +942,7 @@ __device__ void d24GPU::computeTireRHS(const VehicleState* v_states, double fs = hypot(fxs * calpha, fys * salpha); double ss = hypot(sxs * calpha / hsxn, sys * salpha / hsyn); - // calculate force and force /slip from the curve characteritics + // calculate force and force /slip from the curve characteristics double f, fos; tmxy_combined(&f, &fos, sc, df0, sm, fm, ss, fs); @@ -953,7 +953,7 @@ __device__ void d24GPU::computeTireRHS(const VehicleState* v_states, t_states->_My = -sineStep(vta, vx_min, 0., vx_max, 1.) * t_params->_rr * fz * t_states->_rStat * sgn(t_states->_omega); - // some normalised slip velocities + // some normalized slip velocities double vtxs = r_eff * abs(t_states->_omega) * hsxn + 0.01; double vtys = r_eff * abs(t_states->_omega) * hsyn + 0.01; @@ -966,7 +966,7 @@ __device__ void d24GPU::computeTireRHS(const VehicleState* v_states, // Also compute the tire forces that need to be applied on the vehicle // Note here that these tire forces are computed using the current pre - // integreated xe, unline in the semi-implicit solver + // integrated xe, unline in the semi-implicit solver double fxdyn = t_params->_dx * (-vtxs * t_params->_cx * t_states->_xe - fos * vsx) / (vtxs * t_params->_dx + fos) + t_params->_cx * t_states->_xe; @@ -1071,7 +1071,7 @@ __device__ void d24GPU::computeTireRHS(const VehicleState* v_states, double sxs = InterpL(fz, t_params->_sxsPn, t_params->_sxsP2n, t_params->_pn); double sys = InterpL(fz, t_params->_sysPn, t_params->_sysP2n, t_params->_pn); - // Compute the coefficient to "blend" the columb force with the slip force + // Compute the coefficient to "blend" the coulomb force with the slip force double frblend = sineStep(abs(t_states->_vsx), t_params->_frblend_begin, 0., t_params->_frblend_end, 1.); // Now standard TMeasy tire forces // For now, not using any normalization of the slips - similar to Chrono implementation @@ -1106,7 +1106,7 @@ __device__ void d24GPU::computeTireRHS(const VehicleState* v_states, Fy = 0.; } - // Now that we have both the columb force and the slip force, we can combine them with the sine blend to prevent + // Now that we have both the coulomb force and the slip force, we can combine them with the sine blend to prevent // force jumping Fx = (1.0 - frblend) * Fx0 + frblend * Fx; @@ -1288,7 +1288,7 @@ __device__ double d24GPU::driveTorque(const VehicleParam* v_params, const double powertrain_map[i]._y = v_params->_powertrainMap[i]._y * throttle; } - // interpolate in the torque map to get the torque at this paticular + // interpolate in the torque map to get the torque at this particular // speed motor_torque = getMapY(powertrain_map, motor_speed, v_params->_powertrainMapSize); double motor_losses = getMapY(v_params->_lossesMap, motor_speed, v_params->_lossesMapSize); @@ -1438,7 +1438,7 @@ __device__ void d24GPU::computePowertrainRHS(VehicleState* v_states, v_states->_crankOmega = 0.25 * (tirelf_st->_omega + tirerf_st->_omega + tirelr_st->_omega + tirerr_st->_omega) / v_params->_gearRatios[v_states->_current_gr]; - // The torque after tranny will then just become as there is no torque + // The torque after transmission will then just become as there is no torque // converter torque_t = driveTorque(v_params, controls->m_throttle, v_states->_crankOmega) / v_params->_gearRatios[v_states->_current_gr]; @@ -1614,7 +1614,7 @@ __device__ void d24GPU::computePowertrainRHS(VehicleState* v_states, v_states->_crankOmega = 0.25 * (tirelf_st->_omega + tirerf_st->_omega + tirelr_st->_omega + tirerr_st->_omega) / v_params->_gearRatios[v_states->_current_gr]; - // The torque after tranny will then just become as there is no torque + // The torque after transmission will then just become as there is no torque // converter torque_t = driveTorque(v_params, controls->m_throttle, v_states->_crankOmega) / v_params->_gearRatios[v_states->_current_gr]; @@ -1804,8 +1804,7 @@ __host__ void d24GPU::setTireParamsJSON(TMeasyParam& t_params, const char* fileN std::cout << "Error with rapidjson:" << std::endl << d.GetParseError() << std::endl; } - // pray to what ever you believe in and hope that the json file has all - // these + t_params._jw = d["jw"].GetDouble(); t_params._rr = d["rr"].GetDouble(); t_params._r0 = d["r0"].GetDouble(); @@ -2203,7 +2202,7 @@ __host__ void d24GPU::setSuspensionParamsJSON(SuspensionParam& sus_params, const std::cout << "Error with rapidjson:" << std::endl << d.GetParseError() << std::endl; } - // pray to what ever you believe in and hope that the json file has all these + sus_params._ks = d["ks"].GetDouble(); sus_params._bs = d["bs"].GetDouble(); } diff --git a/wheeled_vehicle_models/24dof-gpu/dof24_gpu.cuh b/wheeled_vehicle_models/24dof-gpu/dof24_gpu.cuh index 7c16224..3e8911f 100644 --- a/wheeled_vehicle_models/24dof-gpu/dof24_gpu.cuh +++ b/wheeled_vehicle_models/24dof-gpu/dof24_gpu.cuh @@ -131,8 +131,8 @@ struct TMeasyParam { // Longitudinal double _dfx0Pn; //!< Initial longitudinal slopes dFx/dsx [N] at Nominal load double _dfx0P2n; //!< Intial longitudinal slopes dFx/dsx [N] at max load - double _fxmPn; //!< Maximum longituidnal force [N] at nominal load - double _fxmP2n; //!< Maximum longituidnal force [N] at max load + double _fxmPn; //!< Maximum longitudinal force [N] at nominal load + double _fxmP2n; //!< Maximum longitudinal force [N] at max load double _fxsPn; //!< Longitudinal load at sliding [N] at nominal load double _fxsP2n; //!< Longitudinal load at sliding [N] at max load double _sxmPn; //!< Slip sx at maximum longitudinal load Fx at nominal load @@ -416,8 +416,8 @@ struct TMeasyNrParam { // Longitudinal double _dfx0Pn; //!< Initial longitudinal slopes dFx/dsx [N] at Nominal load double _dfx0P2n; //!< Intial longitudinal slopes dFx/dsx [N] at max load - double _fxmPn; //!< Maximum longituidnal force [N] at nominal load - double _fxmP2n; //!< Maximum longituidnal force [N] at max load + double _fxmPn; //!< Maximum longitudinal force [N] at nominal load + double _fxmP2n; //!< Maximum longitudinal force [N] at max load double _fxsPn; //!< Longitudinal load at sliding [N] at nominal load double _fxsP2n; //!< Longitudinal load at sliding [N] at max load double _sxmPn; //!< Slip sx at maximum longitudinal load Fx at nominal load @@ -581,7 +581,7 @@ struct TMeasyNrState { // Vehicle Structs // ----------------------------------------------------------------------------- /// @brief Defined here are chassis, engine/motor, powertrain, driveline and steering parameters required for the -/// simualtion of a 24 DOF model. +/// simulation of a 24 DOF model. /// The 24 DOF model, which considers the suspension at each corner, offers the same /// benefits as the 18 DOF model, but it can also predict vehicle heave and pitch motions. @@ -655,7 +655,7 @@ struct VehicleParam { _TRmapSize(other->_TRmapSize), _shiftMap(other->_shiftMap) {} - // Declaration of all the 14 DOF vehicle parameters pretty much the same as the 8DOF model + // Declaration of all the 24 DOF vehicle parameters pretty much the same as the 18 DOF model double _a; //!< Distance of C.G to front axle (m) double _b; //!< Distance of C.G to rear axle (m) double _h; //!< Height of C.G @@ -713,7 +713,7 @@ struct VehicleParam { bool _tcbool; //!< Boolean that checks for the presence of a torque converter. Can be set using "tcBool" in the //!< JSON file. Defaults to 0 if not specified. - double _maxBrakeTorque; //!< The maximum braking torque (Nm) that the brakes applu to the wheels. Can be set using + double _maxBrakeTorque; //!< The maximum braking torque (Nm) that the brakes apply to the wheels. Can be set using //!< "maxBrakeTorque" in the JSON file. Based on the normalized brake input between 0 and //!< 1, a torque input*_maxBrakeTorque is applied to the wheel. @@ -788,7 +788,7 @@ struct VehicleParam { }; /// @brief The VehicleState struct holds the chassis, engine/motor, powertrain, driveline and steering states required -/// for the simualtion. +/// for the simulation. /// Apart from the states that are updated by time integration, this struct also holds "non-states" /// such as accelerations, forces and torques that are not updated by time integration. See here for more details @@ -1110,7 +1110,7 @@ struct SuspensionState { /// In essence, this /// stores all the "data" required to simulate 1 vehicle on the GPU. This is something largely the user does not have to -/// worrry about. +/// worry about. struct SimData { SimData() : _driver_data(nullptr), _driver_data_len(0) {} @@ -1473,7 +1473,7 @@ __device__ void computeForcesThroughSus(const VehicleState* v_states, /// input parameters __device__ void tmxy_combined(double* f, double* fos, double s, double df0, double sm, double fm, double ss, double fs); -/// @brief Computes the combined columnb force for the TMeasyNr tire model +/// @brief Computes the combined coulomb force for the TMeasyNr tire model /// This force provides the stability at low speeds and is belnded with the slip force provided by the tmxy_combined /// function. @@ -1497,7 +1497,7 @@ __device__ void computeTireRHS(const VehicleState* v_states, /// @brief Computes the tire forces for the TMeasyNr tire model in the tire contact patch frame (T-RF) /// For the TMeasyNr tire model, since there is no relaxation, the tire forces from slip are blended with the tire -/// forces from columb friction. The blend coefficient depends on the longitudinal slip velocity of the tire. This model +/// forces from coulomb friction. The blend coefficient depends on the longitudinal slip velocity of the tire. This model /// is an approximation of the original TMeasy tire model and is inspired by the Project Chrono implementation (see code /// at https://github.com/projectchrono/chrono/blob/main/src/chrono_vehicle/wheeled_vehicle/tire/ChTMeasyTire.h). /// @param v_states Vehicle States diff --git a/wheeled_vehicle_models/24dof-gpu/dof24_halfImplicit_gpu.cu b/wheeled_vehicle_models/24dof-gpu/dof24_halfImplicit_gpu.cu index 9c19968..c5c6d9b 100644 --- a/wheeled_vehicle_models/24dof-gpu/dof24_halfImplicit_gpu.cu +++ b/wheeled_vehicle_models/24dof-gpu/dof24_halfImplicit_gpu.cu @@ -318,7 +318,7 @@ __host__ void d24SolverHalfImplicitGPU::Initialize(d24GPU::VehicleState& vehicle d24GPU::SuspensionState& sus_states_LR, d24GPU::SuspensionState& sus_states_RR, unsigned int num_vehicles) { - // Esnure that construct was called with TMeasy tire type + // Ensure that construct was called with TMeasy tire type assert((m_tire_type == TireType::TMeasy) && "Construct function called with TMeasyNr tire type, but Initialize called with TMeasy tire type"); assert((num_vehicles + m_vehicle_count_tracker_states <= m_total_num_vehicles) && @@ -354,7 +354,7 @@ __host__ void d24SolverHalfImplicitGPU::Initialize(d24GPU::VehicleState& vehicle d24GPU::SuspensionState& sus_states_LR, d24GPU::SuspensionState& sus_states_RR, unsigned int num_vehicles) { - // Esnure that construct was called with TMeasy tire type + // Ensure that construct was called with TMeasy tire type assert((m_tire_type == TireType::TMeasy) && "Construct function called with TMeasyNr tire type, but Initialize called with TMeasy tire type"); assert((num_vehicles + m_vehicle_count_tracker_states <= m_total_num_vehicles) && @@ -390,7 +390,7 @@ __host__ void d24SolverHalfImplicitGPU::SetOutput(const std::string& output_file m_store_all = store_all; if (!m_store_all) { // Check if number of outputs asked is greater than the total number of vehicles, if this is the case, raise - // awarning and set to m_total_num_vehicles + // a warning and set to m_total_num_vehicles if (no_outs > m_total_num_vehicles) { std::cout << "Number of outputs asked is greater than the total number of vehicles, setting number of " "outputs to total number of vehicles" @@ -506,7 +506,7 @@ __host__ void d24SolverHalfImplicitGPU::Solve() { // If we have to save output, copy over the device into the response if (m_output) { - // Amount of respoonse already filled + // Amount of response already filled unsigned int filled_response = m_total_num_vehicles * m_collection_states * m_device_collection_timeSteps * kernel_launches_since_last_dump; diff --git a/wheeled_vehicle_models/24dof-gpu/dof24_halfImplicit_gpu.cuh b/wheeled_vehicle_models/24dof-gpu/dof24_halfImplicit_gpu.cuh index 8e6af09..3d2213e 100644 --- a/wheeled_vehicle_models/24dof-gpu/dof24_halfImplicit_gpu.cuh +++ b/wheeled_vehicle_models/24dof-gpu/dof24_halfImplicit_gpu.cuh @@ -25,7 +25,7 @@ class d24SolverHalfImplicitGPU { /// Each of these vehicles will have the specified parameters and driver inputs. To add /// more vehicles (ensuring they are still lesser than the total number of vehicles initally specified in the class /// constructor) with different parameters, call the Construct function again. The tire type defaults to TMEasy and - /// is set for all the vehilces. It is also important to note thet the TireType has to be consistent across all the + /// is set for all the vehicles. It is also important to note thet the TireType has to be consistent across all the /// vehicles currently. For examples of use, see demos. /// @param vehicle_params_file Path to the vehicle parameter json file /// @param tire_params_file Path to the tire parameter json file @@ -82,7 +82,7 @@ class d24SolverHalfImplicitGPU { /// parameters. This is mainly provided for cases where the driver inputs are not available at the start of the /// simulation but rather come from a controller during the simualtion and the user wants to specify a TireType. To /// add more vehicles with different parameters, call the Construct function again. It is also important to note - /// thet the TireType has to be consistent across all the vehicles currently. For examples of use, see demos. + /// that the TireType has to be consistent across all the vehicles currently. For examples of use, see demos. /// @param vehicle_params_file Path to the vehicle parameter json file /// @param tire_params_file Path to the tire parameter json file /// @param sus_params_file Path to the suspension parameter json file @@ -365,7 +365,7 @@ class d24SolverHalfImplicitGPU { // Need a bunch of csv writers for each of the vehicles. We will store a pointer to this list std::unique_ptr m_csv_writers_ptr; }; -// Cannout have global function as class member function +// Cannot have global function as class member function /// @brief Integrate the system of equations using the half implicit method - Calls the RHS function at each time step /// Used internally within Solve diff --git a/wheeled_vehicle_models/24dof/README.md b/wheeled_vehicle_models/24dof/README.md index 42585ae..a83930a 100644 --- a/wheeled_vehicle_models/24dof/README.md +++ b/wheeled_vehicle_models/24dof/README.md @@ -39,7 +39,7 @@ Once Sundials is built successfully, `USE_SUNDIALS` is set to `ON` and `c` is hi - `SUNDIALS_DIR` - Here, set the absolute path to the sundials build directory. This is the directory in which the `SUNDIALSConfig.cmake` file is found. Once this path is correctly set, hit `c` to configure. -Once all the required options are set hit `c` to configure and `g` to generate. This will then populate your `build` directory with the necessary `makefile` with which you can build the 24dof model along with its demos by running +Once all the required options are set hit `c` to configure and `g` to generate. This will then populate your `build` directory with the necessary `makefile` with which you can build the 24 DOF model along with its demos by running ```bash make -j4 ``` @@ -47,7 +47,7 @@ We recommend to not run `make install` to ensure path consistencies for the demo Once this is run, the `build` folder will be populated with the executables of the [demos](./demos) and the Python library (if `BUILD_PYTHON_MODULE` is set to `ON`). ### Python Wrapper -Since the Python module is built using SWIG, the path to the Python wrapper library needs to be appened to `PYTHON_PATH`. This library can be found in the build directory mentioned above and its path can be set (on Linux) permanently using the following instructions +Since the Python module is built using SWIG, the path to the Python wrapper library needs to be appended to `PYTHON_PATH`. This library can be found in the build directory mentioned above and its path can be set (on Linux) permanently using the following instructions 1) First, open your `bashrc` or `zshrc` file in a text-editor. 2) To this file add the following line ```bash diff --git a/wheeled_vehicle_models/24dof/dof24.cpp b/wheeled_vehicle_models/24dof/dof24.cpp index 09c2478..a7918ae 100644 --- a/wheeled_vehicle_models/24dof/dof24.cpp +++ b/wheeled_vehicle_models/24dof/dof24.cpp @@ -175,7 +175,7 @@ void d24::vehToSusTransform(const VehicleState& v_states, susrr_st._vs = -v_params._b * v_states._wz + v_states._v; // y direction susrr_st._ws = (-v_params._cr * v_states._wx / 2.) + v_params._b * v_states._wy + v_states._w; // z direction - // Evalute the length of the struct and its compression velocity in current time step + // Evaluate the length of the struct and its compression velocity in current time step // This is to get the unsprung mass velocity and accelerations in G-RF // Instantaneous length of the strut @@ -258,7 +258,7 @@ void d24::vehToSusTransform(const VehicleState& v_states, susrr_st._vs = -v_params._b * v_states._wz + v_states._v; // y direction susrr_st._ws = (-v_params._cr * v_states._wx / 2.) + v_params._b * v_states._wy + v_states._w; // z direction - // Evalute the length of the struct and its compression velocity in current time step + // Evaluate the length of the struct and its compression velocity in current time step // This is to get the unsprung mass velocity and accelerations in G-RF // Instantaneous length of the strut @@ -964,7 +964,7 @@ void d24::computeTireRHS(const VehicleState& v_states, // Also compute the tire forces that need to be applied on the vehicle // Note here that these tire forces are computed using the current pre - // integreated xe, unline in the semi-implicit solver + // integrated xe, unline in the semi-implicit solver double fxdyn = t_params._dx * (-vtxs * t_params._cx * t_states._xe - fos * vsx) / (vtxs * t_params._dx + fos) + t_params._cx * t_states._xe; @@ -1068,7 +1068,7 @@ void d24::computeTireRHS(const VehicleState& v_states, double sxs = InterpL(fz, t_params._sxsPn, t_params._sxsP2n, t_params._pn); double sys = InterpL(fz, t_params._sysPn, t_params._sysP2n, t_params._pn); - // Compute the coefficient to "blend" the columb force with the slip force + // Compute the coefficient to "blend" the coulomb force with the slip force double frblend = sineStep(std::abs(t_states._vsx), t_params._frblend_begin, 0., t_params._frblend_end, 1.); // Now standard TMeasy tire forces // For now, not using any normalization of the slips - similar to Chrono implementation @@ -1103,7 +1103,7 @@ void d24::computeTireRHS(const VehicleState& v_states, Fy = 0.; } - // Now that we have both the columb force and the slip force, we can combine them with the sine blend to prevent + // Now that we have both the coulomb force and the slip force, we can combine them with the sine blend to prevent // force jumping Fx = (1.0 - frblend) * Fx0 + frblend * Fx; @@ -1291,7 +1291,7 @@ double d24::driveTorque(const VehicleParam& v_params, const double throttle, con powertrain_map[i]._y = v_params._powertrainMap[i]._y * throttle; } - // interpolate in the torque map to get the torque at this paticular + // interpolate in the torque map to get the torque at this particular // speed motor_torque = getMapY(powertrain_map, motor_speed); double motor_losses = getMapY(v_params._lossesMap, motor_speed); @@ -1334,7 +1334,7 @@ void d24::differentialSplit(double torque, torque_right = slow; } } -// Computes the powertrain and produces the wheel angular veloocity differential equations +// Computes the powertrain and produces the wheel angular velocity differential equations void d24::computePowertrainRHS(VehicleState& v_states, TMeasyState& tirelf_st, TMeasyState& tirerf_st, @@ -1438,7 +1438,7 @@ void d24::computePowertrainRHS(VehicleState& v_states, v_states._crankOmega = 0.25 * (tirelf_st._omega + tirerf_st._omega + tirelr_st._omega + tirerr_st._omega) / v_params._gearRatios[v_states._current_gr]; - // The torque after tranny will then just become as there is no torque + // The torque after transmission will then just become as there is no torque // converter torque_t = driveTorque(v_params, controls.m_throttle, v_states._crankOmega) / v_params._gearRatios[v_states._current_gr]; @@ -1610,7 +1610,7 @@ void d24::computePowertrainRHS(VehicleState& v_states, v_states._crankOmega = 0.25 * (tirelf_st._omega + tirerf_st._omega + tirelr_st._omega + tirerr_st._omega) / v_params._gearRatios[v_states._current_gr]; - // The torque after tranny will then just become as there is no torque + // The torque after transmission will then just become as there is no torque // converter torque_t = driveTorque(v_params, controls.m_throttle, v_states._crankOmega) / v_params._gearRatios[v_states._current_gr]; @@ -1807,8 +1807,7 @@ void d24::setTireParamsJSON(TMeasyParam& t_params, const char* fileName) { std::cout << "Error with rapidjson:" << std::endl << d.GetParseError() << std::endl; } - // pray to what ever you believe in and hope that the json file has all - // these + t_params._jw = d["jw"].GetDouble(); t_params._rr = d["rr"].GetDouble(); t_params._r0 = d["r0"].GetDouble(); @@ -2206,7 +2205,7 @@ void d24::setSuspensionParamsJSON(SuspensionParam& sus_params, const char* fileN std::cout << "Error with rapidjson:" << std::endl << d.GetParseError() << std::endl; } - // pray to what ever you believe in and hope that the json file has all these + sus_params._ks = d["ks"].GetDouble(); sus_params._bs = d["bs"].GetDouble(); } diff --git a/wheeled_vehicle_models/24dof/dof24.h b/wheeled_vehicle_models/24dof/dof24.h index 19539a8..8833f43 100644 --- a/wheeled_vehicle_models/24dof/dof24.h +++ b/wheeled_vehicle_models/24dof/dof24.h @@ -130,8 +130,8 @@ struct TMeasyParam { // Longitudinal double _dfx0Pn; //!< Initial longitudinal slopes dFx/dsx [N] at Nominal load double _dfx0P2n; //!< Intial longitudinal slopes dFx/dsx [N] at max load - double _fxmPn; //!< Maximum longituidnal force [N] at nominal load - double _fxmP2n; //!< Maximum longituidnal force [N] at max load + double _fxmPn; //!< Maximum longitudinal force [N] at nominal load + double _fxmP2n; //!< Maximum longitudinal force [N] at max load double _fxsPn; //!< Longitudinal load at sliding [N] at nominal load double _fxsP2n; //!< Longitudinal load at sliding [N] at max load double _sxmPn; //!< Slip sx at maximum longitudinal load Fx at nominal load @@ -187,7 +187,7 @@ struct TMeasyState { /// @brief Constructor that takes in all the states and sets them to the values that are passed in. Note, its /// usually very difficult to set all the states to physical meaningful values while ensuring that the tire is in - /// equilibrium. This is also largely untested and its thus recommended to initiaize the states to 0 or use the copy + /// equilibrium. This is also largely untested and its thus recommended to initialize the states to 0 or use the copy /// constructor below TMeasyState(double xe, double ye, @@ -410,8 +410,8 @@ struct TMeasyNrParam { // Longitudinal double _dfx0Pn; //!< Initial longitudinal slopes dFx/dsx [N] at Nominal load double _dfx0P2n; //!< Intial longitudinal slopes dFx/dsx [N] at max load - double _fxmPn; //!< Maximum longituidnal force [N] at nominal load - double _fxmP2n; //!< Maximum longituidnal force [N] at max load + double _fxmPn; //!< Maximum longitudinal force [N] at nominal load + double _fxmP2n; //!< Maximum longitudinal force [N] at max load double _fxsPn; //!< Longitudinal load at sliding [N] at nominal load double _fxsP2n; //!< Longitudinal load at sliding [N] at max load double _sxmPn; //!< Slip sx at maximum longitudinal load Fx at nominal load @@ -539,7 +539,7 @@ struct TMeasyNrState { _My(other._My), _engTor(other._engTor) {} - // Sates that are integrated - these are actually wheel states but we don't use that abstraction + // States that are integrated - these are actually wheel states but we don't use that abstraction double _omega; //!< Angular velocity of wheel double _dOmega; //!< Angular acceleration of wheel double _xt; //!< Vertical tire compression @@ -637,7 +637,7 @@ struct VehicleParam { _CFmap(other._CFmap), _TRmap(other._TRmap) {} - // Declaration of all the 14 DOF vehicle parameters pretty much the same as the 8DOF model + // Declaration of all the 24 DOF vehicle parameters pretty much the same as the 18 DOF model double _a; //!< Distance of C.G to front axle (m) double _b; //!< Distance of C.G to rear axle (m) double _h; //!< Height of C.G @@ -690,7 +690,7 @@ struct VehicleParam { bool _tcbool; //!< Boolean that checks for the presence of a torque converter. Can be set using "tcBool" in the //!< JSON file. Defaults to 0 if not specified. - double _maxBrakeTorque; //!< The maximum braking torque (Nm) that the brakes applu to the wheels. Can be set using + double _maxBrakeTorque; //!< The maximum braking torque (Nm) that the brakes apply to the wheels. Can be set using //!< "maxBrakeTorque" in the JSON file. Based on the normalized brake input between 0 and //!< 1, a torque input*_maxBrakeTorque is applied to the wheel. @@ -985,7 +985,7 @@ struct SuspensionState { /// @brief Constructor that takes in all the states and sets them to the values that are passed in. Note, its /// usually very difficult to set all the states to physical meaningful values while ensuring that the tire is in - /// equilibrium. This is also largely untested and its thus recommended to initiaize the states to 0 or use the copy + /// equilibrium. This is also largely untested and its thus recommended to initialize the states to 0 or use the copy /// constructor below SuspensionState(double xs, double xsi, @@ -1341,7 +1341,7 @@ void tmxy_combined(double& f, double& fos, double s, double df0, double sm, doub /// @brief Computes the combined columnb force for the TMeasyNr tire model -/// This force provides the stability at low speeds and is belnded with the slip force provided by the tmxy_combined +/// This force provides the stability at low speeds and is blended with the slip force provided by the tmxy_combined /// function. void computeCombinedColumbForce(double& fx, double& fy, double mu, double vsx, double vsy, double fz, double vcoulomb); @@ -1363,7 +1363,7 @@ void computeTireRHS(const VehicleState& v_states, /// @brief Computes the tire forces for the TMeasyNr tire model in the tire contact patch frame (T-RF) /// For the TMeasyNr tire model, since there is no relaxation, the tire forces from slip are blended with the tire -/// forces from columb friction. The blend coefficient depends on the longitudinal slip velocity of the tire. This model +/// forces from coulomb friction. The blend coefficient depends on the longitudinal slip velocity of the tire. This model /// is an approximation of the original TMeasy tire model and is inspired by the Project Chrono implementation (see code /// at https://github.com/projectchrono/chrono/blob/main/src/chrono_vehicle/wheeled_vehicle/tire/ChTMeasyTire.h). /// @param v_states Vehicle States diff --git a/wheeled_vehicle_models/24dof/dof24_halfImplicit.cpp b/wheeled_vehicle_models/24dof/dof24_halfImplicit.cpp index 77bb4ec..cb4b9a7 100644 --- a/wheeled_vehicle_models/24dof/dof24_halfImplicit.cpp +++ b/wheeled_vehicle_models/24dof/dof24_halfImplicit.cpp @@ -428,7 +428,7 @@ double d24SolverHalfImplicit::IntegrateStepWithJacobian(double t, // Set a vector of del Ys - for now set this to some scale of y std::vector delY(y.begin(), y.end()); - // In a loop pertub each state and get the corresponding perturbed ydot + // In a loop perturb each state and get the corresponding perturbed ydot int ySize = y.size(); #pragma omp parallel for simd @@ -465,9 +465,9 @@ double d24SolverHalfImplicit::IntegrateStepWithJacobian(double t, // ============================== // Computing the control jacobian //=============================== - // Set a vector of del controls - for now we ingnore braking + // Set a vector of del controls - for now we ignore braking std::vector delControls = {1e-3, 1e-3}; - // In a loop pertub each control and get the corresponding perturbed ydot + // In a loop perturb each control and get the corresponding perturbed ydot int controlSize = delControls.size(); for (int i = 0; i < controlSize; i++) { @@ -783,7 +783,7 @@ void d24SolverHalfImplicit::rhsFun(double t, DriverInput& controls) { } } // ====================================================================================================================== -// Function takes (y +- dely) and provides a new ydot for the pertubed y (ydot is the rhs of the system of equations) +// Function takes (y +- dely) and provides a new ydot for the perturbed y (ydot is the rhs of the system of equations) void d24SolverHalfImplicit::PerturbRhsFun(std::vector& y, DriverInput& controls, std::vector& ydot) { VehicleState veh_st; SuspensionState suslf_st; diff --git a/wheeled_vehicle_models/24dof/dof24_halfImplicit.h b/wheeled_vehicle_models/24dof/dof24_halfImplicit.h index 485d387..745f8b8 100644 --- a/wheeled_vehicle_models/24dof/dof24_halfImplicit.h +++ b/wheeled_vehicle_models/24dof/dof24_halfImplicit.h @@ -48,7 +48,7 @@ class d24SolverHalfImplicit { /// TireType defualts to TMEasy tires /// This function signature is mainly provided for cases where the driver inputs are not available at the start of - /// the simulation but rather come from a controller during the simualtion. + /// the simulation but rather come from a controller during the simulation. /// @param vehicle_params_file Path to the vehicle parameter json file /// @param tire_params_file Path to the tire parameter json file /// @param sus_params_file Path to the suspension parameter json file @@ -60,7 +60,7 @@ class d24SolverHalfImplicit { /// TireType (Either TMEasy or TMEasyNr). /// This is mainly provided for cases where the driver inputs are not available at the start of the - /// simulation but rather come from a controller during the simualtion and the user wants to specify a TireType. + /// simulation but rather come from a controller during the simulation and the user wants to specify a TireType. /// @param vehicle_params_file Path to the vehicle parameter json file /// @param tire_params_file Path to the tire parameter json file /// @param sus_params_file Path to the suspension parameter json file @@ -106,7 +106,7 @@ class d24SolverHalfImplicit { /// @brief Solve the system of equations and run the simulation uptil m_tend - /// Note: If the user wants to simulate step by step (where step is the simualtion time step), use IntegrateStep or + /// Note: If the user wants to simulate step by step (where step is the simulation time step), use IntegrateStep or /// IntegrateStepWithJacobian (in case m_jacobian_state and m_jacobian_controls is desired). If the user has set the /// output to a csv file, then the csv files will be written to the data/output folder. void Solve(); @@ -223,7 +223,7 @@ class d24SolverHalfImplicit { /// @brief Write csv_writer to csv file in case of step by step simulation - /// In case the user calls IntegrateStepWithJacobian or IntegrateStep as well as set's output to true, then + /// In case the user calls IntegrateStepWithJacobian or IntegrateStep as well as sets output to true, then /// at each step states are only written to the csv writer object not to the csv file itself. Thus the user needs to /// call this function to write the data to the csv file by calling WriteToFile. void WriteToFile(); diff --git a/wheeled_vehicle_models/24dof/dof24_sundials.h b/wheeled_vehicle_models/24dof/dof24_sundials.h index ac8f930..4f5d1b8 100644 --- a/wheeled_vehicle_models/24dof/dof24_sundials.h +++ b/wheeled_vehicle_models/24dof/dof24_sundials.h @@ -162,7 +162,7 @@ class d24SolverSundials { /// @brief Set the maximum step size for the solver. /// Since the sundials integrator is an adaptive time step integrator, users can and only need to specify the - /// maximum time-step that the solver can take to integrata the system. See sundials documentation for more details + /// maximum time-step that the solver can take to integrate the system. See sundials documentation for more details /// - https://sundials.readthedocs.io/en/latest/cvodes/Mathematics_link.html /// @param hmax Maximum time-step (s) void SetMaxStep(double hmax);