1 // ============================================================================= 2 // PROJECT CHRONO - http://projectchrono.org 3 // 4 // Copyright (c) 2014 projectchrono.org 5 // All rights reserved. 6 // 7 // Use of this source code is governed by a BSD-style license that can be found 8 // in the LICENSE file at the top level of the distribution and at 9 // http://projectchrono.org/license-chrono.txt. 10 // 11 // ============================================================================= 12 // Authors: Alessandro Tasora 13 // ============================================================================= 14 // 15 // Base class for a wheel brake. 16 // 17 // ============================================================================= 18 19 #ifndef CH_BRAKE_H 20 #define CH_BRAKE_H 21 22 #include <vector> 23 24 #include "chrono_vehicle/ChApiVehicle.h" 25 #include "chrono_vehicle/ChPart.h" 26 #include "chrono_vehicle/wheeled_vehicle/ChSuspension.h" 27 28 namespace chrono { 29 namespace vehicle { 30 31 /// @addtogroup vehicle_wheeled_brake 32 /// @{ 33 34 /// Base class for a brake subsystem. 35 class CH_VEHICLE_API ChBrake : public ChPart { 36 public: 37 ChBrake(const std::string& name); 38 ~ChBrake()39 virtual ~ChBrake() {} 40 41 /// Initialize the brake by associating it to an existing suspension subsystem. 42 virtual void Initialize(std::shared_ptr<ChChassis> chassis, ///< associated chassis subsystem 43 std::shared_ptr<ChSuspension> suspension, ///< associated suspension subsystem 44 VehicleSide side ///< brake mounted on left/right side 45 ) = 0; 46 47 /// Update the brake subsystem: set the brake modulation. 48 /// The input value is in the range [0,1].<br> 49 /// <pre> 50 /// modulation = 0 indicates no braking 51 /// modulation = 1 indicates that the subsystem should provide maximum braking torque 52 /// </pre> 53 virtual void Synchronize(double modulation) = 0; 54 55 /// Enable/disable ability of locking (default: false). 56 /// Note that a derived class may or may not support this option. EnableLocking(bool val)57 void EnableLocking(bool val) { m_can_lock = val; } 58 59 /// Get the current brake torque. 60 virtual double GetBrakeTorque() = 0; 61 62 protected: 63 bool m_can_lock; ///< can the brake lock? 64 }; 65 66 /// Vector of handles to brake subsystems. 67 typedef std::vector<std::shared_ptr<ChBrake>> ChBrakeList; 68 69 /// @} vehicle_wheeled_brake 70 71 } // end namespace vehicle 72 } // end namespace chrono 73 74 #endif 75