1 // ============================================================================= 2 // PROJECT CHRONO - http://projectchrono.org 3 // 4 // Copyright (c) 2019 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: Han Wang, Asher Elmquist 13 // ============================================================================= 14 // 15 // Container class for a radar sensor 16 // 17 // ============================================================================= 18 19 #ifndef CHRADARSENSOR_H 20 #define CHRADARSENSOR_H 21 22 #include "chrono_sensor/sensors/ChOptixSensor.h" 23 24 namespace chrono { 25 namespace sensor { 26 27 /// @addtogroup sensor_sensors 28 /// @{ 29 30 /// Radar Class/ This corresponds to a fmcw radar 31 class CH_SENSOR_API ChRadarSensor : public ChOptixSensor { 32 public: 33 /// Constructor for the base radar class 34 /// @param parent Body to which the sensor is attached 35 /// @param updateRate the rate at which the sensor will be updated 36 /// @param offsetPose the relative mounting position of the sensor 37 /// @param w Width in number of samples of a radar scan 38 /// @param h Height in number of samples of a radar scan 39 /// @param hfov Horizontal field of view of the lidar 40 /// @param vfov vertical angle of the lidar 41 /// @param max_distance the farthest detectable distance for the radar 42 /// @param clip_near Near clipping distance so that lidar sensor can be easily placed inside a visualization object 43 /// (sensor housing) 44 ChRadarSensor(std::shared_ptr<chrono::ChBody> parent, 45 const float updateRate, 46 chrono::ChFrame<double> offsetPose, 47 const unsigned int w, 48 const unsigned int h, 49 const float hfov, 50 const float vfov, 51 const float max_distance, 52 const float clip_near = 1e-3f); 53 54 /// Class destructor 55 ~ChRadarSensor(); 56 57 /// Gives the horizontal field of view of the radar (angle between right-most and left-most ray for a "frame"). 58 /// Horizontal field of view should be 360-(angular resulution) in degrees for a full 360 degree scanning radar. 59 /// @return The horizontal field of view of the radar sensor GetHFOV()60 float GetHFOV() const { return m_hFOV; } 61 62 /// Returns the vertical field of view the radar 63 /// @return The vertical field of view the radar sensor GetVFOV()64 float GetVFOV() const { return m_vFOV; } 65 66 67 /// Returns the maximum range of the radar 68 /// @return The maximum distance for the radar GetMaxDistance()69 float GetMaxDistance() const { return m_max_distance; } 70 71 /// Returns the near clipping distance 72 /// @return the near clipping distance GetClipNear()73 float GetClipNear() const { return m_clip_near; } 74 75 /// Returns the translational velocity of the object the radar is attached to 76 /// @return Returns the translational velocity of the object the radar is attached to GetTranslationalVelocity()77 ChVector<double> GetTranslationalVelocity() { return m_parent->GetPos_dt(); } 78 79 /// Returns the angular velocity of the object the radar is attached to 80 /// @return Returns the angular velocity of the object the radar is attached to GetAngularVelocity()81 ChVector<double> GetAngularVelocity() { return m_parent->GetWvel_loc(); } 82 83 private: 84 float m_hFOV; ///< the horizontal field of view of the radar 85 float m_vFOV; ///< vertical field of view of the radar 86 float m_max_distance; ///< max distance for radar 87 float m_clip_near; ///< near clipping distance so that radar sensor housings can be transparent to self 88 }; 89 90 /// @} sensor_sensors 91 92 } // namespace sensor 93 } // namespace chrono 94 95 #endif