提交 03b5ee3b 编写于 作者: L Liangliang Zhang 提交者: GitHub

Perception: added build for box and object. (#436)

上级 96457781
......@@ -7,7 +7,7 @@ os: linux
env:
- JOB=lint
- JOB=cibuild
- JOB=test_cpu
- JOB=citest
cache:
directories:
- $HOME/.cache/bazel
......
......@@ -396,6 +396,7 @@ function gen_coverage() {
}
function run_test() {
generate_build_targets
if [ "$USE_GPU" == "1" ]; then
echo -e "${YELLOW}Running tests under GPU mode. GPU is required to run the tests.${NO_COLOR}"
......@@ -497,7 +498,7 @@ function citest() {
bash cybertron.sh build_fast
cd /apollo
citest_basic
run_test
if [ $? -eq 0 ]; then
success 'Test passed!'
return 0
......
......@@ -26,4 +26,56 @@ cc_test(
],
)
cc_library(
name = "object",
hdrs = [
"object.h",
"object_supplement.h",
"object_types.h",
"vehicle_struct.h",
],
srcs = [
"object.cc",
],
deps = [
":point_cloud",
":box",
],
)
cc_test(
name = "object_test",
size = "small",
srcs = [
"object_test.cc",
],
deps = [
":object",
"@gtest//:main",
],
)
cc_library(
name = "box",
hdrs = [
"box.h",
"comparison_traits.h",
],
deps = [
":point_cloud",
],
)
cc_test(
name = "box_test",
size = "small",
srcs = [
"box_test.cc",
],
deps = [
":box",
"@gtest//:main",
],
)
cpplint()
......@@ -13,16 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#ifndef MODULES_PERCEPTION_BASE_IMAGE_CORE_H_
#define MODULES_PERCEPTION_BASE_IMAGE_CORE_H_
#ifndef MODULES_PERCEPTION_BASE_BOX_H_
#define MODULES_PERCEPTION_BASE_BOX_H_
#include <float.h>
#include <stdint.h>
#include <algorithm>
#include <cfloat>
#include <cstdint>
#include <memory>
#include <sstream>
#include <string>
#include <vector>
#include "modules/perception/base/comparison_traits.h"
#include "modules/perception/base/point.h"
......@@ -30,9 +31,6 @@ namespace apollo {
namespace perception {
namespace base {
template <typename T>
struct Rect;
template <typename T>
struct BBox2D;
......@@ -163,16 +161,8 @@ struct BBox2D {
T ymax = 0; // bottom-right
};
typedef Rect<int> RectI;
typedef Rect<float> RectF;
typedef Rect<double> RectD;
typedef BBox2D<int> BBox2DI;
typedef BBox2D<float> BBox2DF;
typedef BBox2D<double> BBox2DD;
} // namespace base
} // namespace perception
} // namespace apollo
#endif // MODULES_PERCEPTION_BASE_IMAGE_CORE_H_
#endif // MODULES_PERCEPTION_BASE_BOX_H_
\ No newline at end of file
......@@ -13,10 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include <gtest/gtest.h>
#include "modules/perception/base/box.h"
#include <limits>
#include <vector>
#include "modules/perception/base/box.h"
#include "gtest/gtest.h"
namespace apollo {
namespace perception {
......
......@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#ifndef MODULES_PERCEPTION_BASE_COMPARISON_TRAITS_H_
#define MODULES_PERCEPTION_BASE_COMPARISON_TRAITS_H_
......
......@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/perception/base/object.h"
#include <sstream>
......
......@@ -15,11 +15,12 @@
*****************************************************************************/
#ifndef MODULES_PERCEPTION_BASE_OBJECT_H_
#define MODULES_PERCEPTION_BASE_OBJECT_H_
#include <Eigen/Core>
#include <string>
#include <vector>
#include "Eigen/Core"
#include "modules/perception/base/object_supplement.h"
#include "modules/perception/base/object_types.h"
#include "modules/perception/base/point_cloud_types.h"
......@@ -28,6 +29,7 @@
namespace apollo {
namespace perception {
namespace base {
struct alignas(16) Object {
Object();
Object(const Object &) = default;
......@@ -39,7 +41,7 @@ struct alignas(16) Object {
int id = -1;
// @brief convex hull of the object, required
PolygonDType polygon;
PointCloud<PointD> polygon;
// oriented boundingbox information
// @brief main direction of the object, required
......@@ -110,9 +112,6 @@ struct alignas(16) Object {
FusionObjectSupplement fusion_supplement;
};
typedef std::shared_ptr<Object> ObjectPtr;
typedef std::shared_ptr<const Object> ObjectConstPtr;
} // namespace base
} // namespace perception
} // namespace apollo
......
......@@ -15,6 +15,7 @@
*****************************************************************************/
#ifndef MODULES_PERCEPTION_BASE_OBJECT_SUPPLEMENT_H_
#define MODULES_PERCEPTION_BASE_OBJECT_SUPPLEMENT_H_
#include <memory>
#include <string>
#include <vector>
......@@ -47,9 +48,9 @@ struct alignas(16) LidarObjectSupplement {
// @brief valid only for on_use = true
bool on_use = false;
// @brief cloud of the object in lidar coordinates
PointFCloud cloud;
base::AttributePointCloud<PointF> cloud;
// @brief cloud of the object in world coordinates
PointDCloud cloud_world;
base::AttributePointCloud<PointD> cloud_world;
// @brief background indicator
bool is_background = false;
// @brief false positive indicator
......@@ -107,10 +108,10 @@ struct alignas(16) CameraObjectSupplement {
pts8.clear();
object_feature.clear();
alpha = 0.0;
box = BBox2DF();
projected_box = BBox2DF();
front_box = BBox2DF();
back_box = BBox2DF();
box = BBox2D<float>();
projected_box = BBox2D<float>();
front_box = BBox2D<float>();
back_box = BBox2D<float>();
local_center = Eigen::Vector3f(0.0f, 0.0f, 0.0f);
visual_type = VisualObjectType::MAX_OBJECT_TYPE;
visual_type_probs.resize(
......@@ -130,10 +131,10 @@ struct alignas(16) CameraObjectSupplement {
std::string sensor_name;
// @brief 2d box
BBox2DF box;
BBox2D<float> box;
// @brief projected 2d box
BBox2DF projected_box;
BBox2D<float> projected_box;
// @brief local track id
int local_track_id = -1;
......@@ -142,10 +143,10 @@ struct alignas(16) CameraObjectSupplement {
std::vector<float> pts8;
// @brief front box
BBox2DF front_box;
BBox2D<float> front_box;
// @brief back box
BBox2DF back_box;
BBox2D<float> back_box;
std::vector<float> object_feature;
// @brief alpha angle from KITTI: Observation angle of object, in [-pi..pi]
......@@ -191,7 +192,7 @@ struct SensorObjectMeasurement {
size = Eigen::Vector3f(0, 0, 0);
velocity = Eigen::Vector3f(0, 0, 0);
type = ObjectType::UNKNOWN;
box = BBox2DF();
box = BBox2D<float>();
}
std::string sensor_id = "unknown_sensor";
......@@ -203,7 +204,7 @@ struct SensorObjectMeasurement {
Eigen::Vector3f velocity = Eigen::Vector3f(0, 0, 0);
ObjectType type = ObjectType::UNKNOWN;
// @brief only for camera measurement
BBox2DF box;
BBox2D<float> box;
};
struct alignas(16) FusionObjectSupplement {
......
......@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include <gtest/gtest.h>
#include "modules/perception/base/object.h"
#include "gtest/gtest.h"
namespace apollo {
namespace perception {
namespace base {
......
......@@ -17,6 +17,7 @@
#define MODULES_PERCEPTION_BASE_OBJECT_TYPES_H_
#include <map>
#include <string>
namespace apollo {
namespace perception {
......@@ -93,6 +94,7 @@ enum class VisualLandmarkType {
TrafficLight,
MAX_LANDMARK_TYPE,
};
const std::map<VisualLandmarkType, std::string> kVisualLandmarkType2NameMap = {
{VisualLandmarkType::RoadArrow, "RoadArrow"},
{VisualLandmarkType::RoadText, "RoadText"},
......@@ -228,4 +230,5 @@ const std::map<std::string, ObjectSubType> kName2SubTypeMap = {
} // namespace base
} // namespace perception
} // namespace apollo
#endif // MODULES_PERCEPTION_BASE_OBJECT_TYPES_H_
......@@ -15,9 +15,11 @@
*****************************************************************************/
#ifndef MODULES_PERCEPTION_BASE_VEHICLE_STRUCT_H_
#define MODULES_PERCEPTION_BASE_VEHICLE_STRUCT_H_
namespace apollo {
namespace perception {
namespace base {
struct CarLight {
float brake_visible = 0;
float brake_switch_on = 0;
......@@ -35,6 +37,7 @@ struct CarLight {
right_turn_switch_on = 0;
}
};
} // namespace base
} // namespace perception
} // namespace apollo
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册