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: Radu Serban 13 // ============================================================================= 14 // 15 // Base class for a steering subsystem. 16 // 17 // ============================================================================= 18 19 #ifndef CH_STEERING_H 20 #define CH_STEERING_H 21 22 #include "chrono_vehicle/ChApiVehicle.h" 23 #include "chrono_vehicle/ChChassis.h" 24 25 namespace chrono { 26 namespace vehicle { 27 28 /// @addtogroup vehicle_wheeled_steering 29 /// @{ 30 31 /// Base class for a steering subsystem. 32 class CH_VEHICLE_API ChSteering : public ChPart { 33 public: 34 ChSteering(const std::string& name ///< [in] name of the subsystem 35 ); 36 37 virtual ~ChSteering(); 38 39 /// Get the position (location and orientation) of the steering subsystem 40 /// relative to the chassis reference frame. GetPosition()41 const ChCoordsys<>& GetPosition() const { return m_position; } 42 43 /// Get a handle to the main link of the steering subsystems. 44 /// Return a handle to the body to which the tierods of a steerable 45 /// suspension subsystem are attached. GetSteeringLink()46 std::shared_ptr<ChBody> GetSteeringLink() const { return m_link; } 47 48 /// Initialize this steering subsystem. 49 /// The steering subsystem is initialized by attaching it to the specified chassis at the specified location (with 50 /// respect to and expressed in the reference frame of the chassis) and with specified orientation (with respect to 51 /// the chassis reference frame). 52 virtual void Initialize(std::shared_ptr<ChChassis> chassis, ///< [in] associated chassis subsystem 53 const ChVector<>& location, ///< [in] location relative to the chassis frame 54 const ChQuaternion<>& rotation ///< [in] orientation relative to the chassis frame 55 ) = 0; 56 57 /// Update the state of this steering subsystem at the current time. 58 /// The steering subsystem is provided the current steering driver input (a 59 /// value between -1 and +1). Positive steering input indicates steering 60 /// to the left. This function is called during the vehicle update. 61 virtual void Synchronize(double time, ///< [in] current time 62 double steering ///< [in] current steering input [-1,+1] 63 ) = 0; 64 65 /// Get the total mass of the steering subsystem. 66 virtual double GetMass() const = 0; 67 68 /// Get the current global COM location of the steering subsystem. 69 virtual ChVector<> GetCOMPos() const = 0; 70 71 /// Log current constraint violations. LogConstraintViolations()72 virtual void LogConstraintViolations() {} 73 74 protected: 75 ChCoordsys<> m_position; ///< location and orientation relative to chassis 76 std::shared_ptr<ChBody> m_link; ///< handle to the main steering link 77 }; 78 79 /// Vector of handles to steering subsystems 80 typedef std::vector<std::shared_ptr<ChSteering> > ChSteeringList; 81 82 /// @} vehicle_wheeled_steering 83 84 } // end namespace vehicle 85 } // end namespace chrono 86 87 #endif 88