提交 a473e3df 编写于 作者: L Liangliang Zhang 提交者: Xiangquan Xiao

Perception: use common::Point3D rather than perception::Point (#404)

上级 9628dcdf
......@@ -6,8 +6,7 @@ dist: trusty
os: linux
env:
- JOB=lint
- JOB=build_cpu
- JOB=check
- JOB=cibuild
cache:
directories:
- $HOME/.cache/bazel
......@@ -18,6 +17,7 @@ script:
- ./docker/scripts/dev_start.sh -t dev-x86_64-20180920_1434
- ./apollo_docker.sh ${JOB}
- rm -rf "${HOME}/.cache/bazel/_bazel_${USER}/install"
- rm -rf "/apollo/data/core"
notifications:
email:
on_success: change
......
......@@ -219,8 +219,12 @@ function build() {
}
function cibuild() {
echo "Start building, please wait ..."
generate_build_targets
info "Building framework ..."
cd /apollo/framework
bash cybertron.sh build_fast
cd /apollo
info "Building modules ..."
JOB_ARG="--jobs=$(nproc)"
if [ "$MACHINE_ARCH" == 'aarch64' ]; then
......@@ -229,26 +233,18 @@ function cibuild() {
info "Building with $JOB_ARG for $MACHINE_ARCH"
BUILD_TARGETS="
//modules/common/...
//modules/canbus:canbus_lib
//modules/control/...
//modules/dreamview/...
//modules/drivers/...
//modules/localization/...
//modules/map/...
//modules/monitor/...
//modules/perception/...
//modules/planning/...
//modules/prediction/...
//modules/routing/...
"
bazel build $JOB_ARG $DEFINES $@ $BUILD_TARGETS
# current velodyne drivers
build_velodyne
//modules/common/...
//modules/control/...
//modules/localization/proto/...
//modules/localization/rtk/...
`bazel query //modules/localization/msf/... except //modules/localization/msf/local_tool/...`
`bazel query //modules/localization/msf/local_tool/local_visualization/...`
//modules/perception/proto/...
//modules/planning/...
//modules/prediction/...
//modules/routing/..."
# future velodyne drivers
build_velodyne_vls128
bazel build $JOB_ARG $DEFINES $@ $BUILD_TARGETS
if [ $? -eq 0 ]; then
success 'Build passed!'
......@@ -480,10 +476,17 @@ function citest_map() {
}
function citest_basic() {
generate_build_targets
# common related test
echo "$BUILD_TARGETS" | grep "common\/" | xargs bazel test $DEFINES --config=unit_test -c dbg --test_verbose_timeout_warnings $@
BUILD_TARGETS="
//modules/common/...
//modules/control/...
//modules/localization/proto/...
//modules/localization/rtk/...
`bazel query //modules/localization/msf/... except //modules/localization/msf/local_tool/...`
`bazel query //modules/localization/msf/local_tool/local_visualization/...`
//modules/perception/proto/...
//modules/planning/...
//modules/prediction/...
//modules/routing/..."
# control related test
echo "$BUILD_TARGETS" | grep "control\/" | xargs bazel test $DEFINES --config=unit_test -c dbg --test_verbose_timeout_warnings $@
......@@ -504,10 +507,12 @@ function citest_basic() {
}
function citest() {
info "Building framework ..."
cd /apollo/framework
bash cybertron.sh build_fast
cd /apollo
citest_basic
citest_perception
citest_map
citest_dreamview
if [ $? -eq 0 ]; then
success 'Test passed!'
return 0
......
......@@ -207,23 +207,23 @@ TEST_F(SimulationWorldServiceTest, UpdatePerceptionObstacles) {
PerceptionObstacles obstacles;
PerceptionObstacle* obstacle1 = obstacles.add_perception_obstacle();
obstacle1->set_id(1);
apollo::perception::Point* point1 = obstacle1->add_polygon_point();
apollo::common::Point3D* point1 = obstacle1->add_polygon_point();
point1->set_x(0.0);
point1->set_y(0.0);
apollo::perception::Point* point2 = obstacle1->add_polygon_point();
apollo::common::Point3D* point2 = obstacle1->add_polygon_point();
point2->set_x(0.0);
point2->set_y(1.0);
apollo::perception::Point* point3 = obstacle1->add_polygon_point();
apollo::common::Point3D* point3 = obstacle1->add_polygon_point();
point3->set_x(-1.0);
point3->set_y(0.0);
apollo::perception::Point* point4 = obstacle1->add_polygon_point();
apollo::common::Point3D* point4 = obstacle1->add_polygon_point();
point4->set_x(-1.0);
point4->set_y(0.0);
obstacle1->set_timestamp(1489794020.123);
obstacle1->set_type(apollo::perception::PerceptionObstacle_Type_UNKNOWN);
PerceptionObstacle* obstacle2 = obstacles.add_perception_obstacle();
obstacle2->set_id(2);
apollo::perception::Point* point = obstacle2->mutable_position();
apollo::common::Point3D* point = obstacle2->mutable_position();
point->set_x(1.0);
point->set_y(2.0);
obstacle2->set_theta(3.0);
......
......@@ -3,29 +3,23 @@ syntax = "proto2";
package apollo.perception;
import "modules/common/proto/error_code.proto";
import "modules/common/proto/geometry.proto";
import "modules/common/proto/header.proto";
import "modules/map/proto/map_lane.proto";
// TODO(all) change to Point3D
message Point {
optional double x = 1; // in meters.
optional double y = 2; // in meters.
optional double z = 3; // height in meters.
}
message PerceptionObstacle {
optional int32 id = 1; // obstacle ID.
optional Point position = 2; // obstacle position in the world coordinate
optional int32 id = 1; // obstacle ID.
optional apollo.common.Point3D position = 2; // obstacle position in the world coordinate
// system.
optional double theta = 3; // heading in the world coordinate system.
optional Point velocity = 4; // obstacle velocity.
optional double theta = 3; // heading in the world coordinate system.
optional apollo.common.Point3D velocity = 4; // obstacle velocity.
// Size of obstacle bounding box.
optional double length = 5; // obstacle length.
optional double width = 6; // obstacle width.
optional double width = 6; // obstacle width.
optional double height = 7; // obstacle height.
repeated Point polygon_point = 8; // obstacle corner points.
repeated apollo.common.Point3D polygon_point = 8; // obstacle corner points.
// duration of an obstacle since detection in s.
optional double tracking_time = 9;
......@@ -34,10 +28,10 @@ message PerceptionObstacle {
UNKNOWN_MOVABLE = 1;
UNKNOWN_UNMOVABLE = 2;
PEDESTRIAN = 3; // Pedestrian, usually determined by moving behaviour.
BICYCLE = 4; // bike, motor bike
VEHICLE = 5; // Passenger car or truck.
BICYCLE = 4; // bike, motor bike
VEHICLE = 5; // Passenger car or truck.
};
optional Type type = 10; // obstacle type
optional Type type = 10; // obstacle type
optional double timestamp = 11; // GPS time in seconds.
// Just for offline debugging, onboard will not fill this field.
......@@ -46,12 +40,12 @@ message PerceptionObstacle {
optional double confidence = 13 [default = 1.0];
enum ConfidenceType {
CONFIDENCE_UNKNOWN = 0;
CONFIDENCE_CNN = 1;
CONFIDENCE_RADAR = 2;
CONFIDENCE_UNKNOWN = 0;
CONFIDENCE_CNN = 1;
CONFIDENCE_RADAR = 2;
};
optional ConfidenceType confidence_type = 14 [default = CONFIDENCE_CNN];
repeated Point drops = 15; // trajectory of object.
repeated apollo.common.Point3D drops = 15; // trajectory of object.
}
message CIPVInfo {
......@@ -61,7 +55,7 @@ message CIPVInfo {
message LaneMarker {
optional apollo.hdmap.LaneBoundaryType.Type lane_type = 1;
optional double quality = 2; // range = [0,1]; 1 = the best quality
optional double quality = 2; // range = [0,1]; 1 = the best quality
optional int32 model_degree = 3;
// equation X = c3 * Z^3 + c2 * Z^2 + c1 * Z + c0
optional double c0_position = 4;
......@@ -82,8 +76,8 @@ message LaneMarkers {
message PerceptionObstacles {
repeated PerceptionObstacle perception_obstacle = 1; // An array of obstacles
optional apollo.common.Header header = 2; // Header
optional apollo.common.Header header = 2; // Header
optional apollo.common.ErrorCode error_code = 3 [default = OK];
optional LaneMarkers lane_marker = 4;
optional CIPVInfo cipv_info = 5; // closest in path vehicle
optional CIPVInfo cipv_info = 5; // closest in path vehicle
}
......@@ -24,7 +24,7 @@ namespace prediction {
using apollo::localization::LocalizationEstimate;
using apollo::perception::PerceptionObstacle;
using apollo::perception::Point;
using Point = apollo::common::Point3D;
void PoseContainer::Insert(const ::google::protobuf::Message& message) {
localization::LocalizationEstimate localization;
......@@ -106,13 +106,9 @@ double PoseContainer::GetSpeed() const {
return std::hypot(velocity_x, velocity_y);
}
double PoseContainer::GetTheta() const {
return obstacle_ptr_->theta();
}
double PoseContainer::GetTheta() const { return obstacle_ptr_->theta(); }
Point PoseContainer::GetPosition() const {
return obstacle_ptr_->position();
}
Point PoseContainer::GetPosition() const { return obstacle_ptr_->position(); }
} // namespace prediction
} // namespace apollo
......@@ -67,17 +67,17 @@ class PoseContainer : public Container {
*/
double GetSpeed() const;
/**
* @brief Get heading of adc
* @return heading of adc
*/
/**
* @brief Get heading of adc
* @return heading of adc
*/
double GetTheta() const;
/**
* @brief Get adc position
* @return adc position
*/
apollo::perception::Point GetPosition() const;
apollo::common::Point3D GetPosition() const;
private:
/**
......
......@@ -38,13 +38,14 @@ using apollo::common::PointENU;
using apollo::common::Quaternion;
using apollo::hdmap::HDMapUtil;
using apollo::perception::PerceptionObstacle;
using apollo::perception::Point;
using Point = apollo::common::Point3D;
double GetAngleFromQuaternion(const Quaternion quaternion) {
double theta = std::atan2(2.0 * quaternion.qw() * quaternion.qz() +
quaternion.qx() * quaternion.qy(),
1.0 - 2.0 * (quaternion.qy() * quaternion.qy() +
quaternion.qz() * quaternion.qz())) +
1.0 -
2.0 * (quaternion.qy() * quaternion.qy() +
quaternion.qz() * quaternion.qz())) +
std::acos(-1.0) / 2.0;
return theta;
}
......
......@@ -54,26 +54,26 @@ double GetDefaultObjectLength(const int object_type);
double GetDefaultObjectWidth(const int object_type);
apollo::perception::Point SLtoXY(const double x, const double y,
const double theta);
apollo::common::Point3D SLtoXY(const double x, const double y,
const double theta);
apollo::perception::Point SLtoXY(const apollo::perception::Point& point,
const double theta);
apollo::common::Point3D SLtoXY(const apollo::common::Point3D& point,
const double theta);
double Distance(const apollo::perception::Point& point1,
const apollo::perception::Point& point2);
double Distance(const apollo::common::Point3D& point1,
const apollo::common::Point3D& point2);
double Speed(const apollo::perception::Point& point);
double Speed(const apollo::common::Point3D& point);
double Speed(const double vx, const double vy);
double GetNearestLaneHeading(const apollo::common::PointENU& point_enu);
double GetNearestLaneHeading(const apollo::perception::Point& point);
double GetNearestLaneHeading(const apollo::common::Point3D& point);
double GetNearestLaneHeading(const double x, const double y, const double z);
double GetLateralDistanceToNearestLane(const apollo::perception::Point& point);
double GetLateralDistanceToNearestLane(const apollo::common::Point3D& point);
double HeadingDifference(const double theta1, const double theta2);
......
......@@ -22,8 +22,8 @@
#include <map>
#include <vector>
#include "modules/common/configs/config_gflags.h"
#include "cybertron/common/log.h"
#include "modules/common/configs/config_gflags.h"
#include "modules/third_party_perception/common/third_party_perception_gflags.h"
#include "modules/third_party_perception/common/third_party_perception_util.h"
......@@ -44,7 +44,7 @@ using apollo::drivers::Mobileye;
using apollo::localization::LocalizationEstimate;
using apollo::perception::PerceptionObstacle;
using apollo::perception::PerceptionObstacles;
using apollo::perception::Point;
using Point = apollo::common::Point3D;
std::map<std::int32_t, ::apollo::hdmap::LaneBoundaryType_Type>
lane_conversion_map = {{0, apollo::hdmap::LaneBoundaryType::DOTTED_YELLOW},
......
......@@ -13,8 +13,8 @@ proto_library(
"radar_obstacle.proto",
],
deps = [
"//modules/common/proto:geometry_proto_lib",
"//modules/common/proto:error_code_proto_lib",
"//modules/common/proto:geometry_proto_lib",
"//modules/common/proto:header_proto_lib",
"//modules/perception/proto:perception_proto_lib",
],
......
......@@ -4,13 +4,14 @@ package apollo.third_party_perception;
import "modules/common/proto/error_code.proto";
import "modules/common/proto/header.proto";
import "modules/perception/proto/perception_obstacle.proto";
// import "modules/perception/proto/perception_obstacle.proto";
import "modules/common/proto/geometry.proto";
message RadarObstacle {
optional int32 id = 1; // obstacle ID.
optional apollo.perception.Point relative_position =
optional apollo.common.Point3D relative_position =
2; // obstacle position in the sl coordinate system.
optional apollo.perception.Point relative_velocity =
optional apollo.common.Point3D relative_velocity =
3; // obstacle relative velocity.
optional double rcs = 4; // radar signal intensity.
optional bool movable = 5; // whether this obstacle is able to move.
......@@ -18,8 +19,8 @@ message RadarObstacle {
optional double length = 7;
optional double height = 8;
optional double theta = 9;
optional apollo.perception.Point absolute_position = 10;
optional apollo.perception.Point absolute_velocity = 11;
optional apollo.common.Point3D absolute_position = 10;
optional apollo.common.Point3D absolute_velocity = 11;
optional int32 count = 12;
optional int32 moving_frames_count = 13;
}
......
......@@ -17,8 +17,8 @@
#include <cmath>
#include "modules/common/adapters/adapter_gflags.h"
#include "cybertron/common/log.h"
#include "modules/common/adapters/adapter_gflags.h"
#include "modules/common/util/message_util.h"
#include "modules/third_party_perception/common/third_party_perception_gflags.h"
#include "modules/third_party_perception/common/third_party_perception_util.h"
......@@ -39,7 +39,7 @@ using apollo::drivers::Mobileye;
using apollo::localization::LocalizationEstimate;
using apollo::perception::PerceptionObstacle;
using apollo::perception::PerceptionObstacles;
using apollo::perception::Point;
using Point = apollo::common::Point3D;
std::string ThirdPartyPerception::Name() const {
return FLAGS_third_party_perception_node_name;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册