提交 3ba3ec53 编写于 作者: U unacao 提交者: siyangy

separate arrows for obstacle velocity and heading (#868)

上级 8e14f4ac
......@@ -112,6 +112,8 @@ void SetObstacleInfo(const PerceptionObstacle &obstacle, Object *world_object) {
world_object->set_height(obstacle.height());
world_object->set_speed(
std::hypot(obstacle.velocity().x(), obstacle.velocity().y()));
world_object->set_speed_heading(
std::atan2(obstacle.velocity().y(), obstacle.velocity().x()));
world_object->set_timestamp_sec(obstacle.timestamp());
}
......
......@@ -233,6 +233,7 @@ TEST_F(SimulationWorldServiceTest, UpdatePerceptionObstacles) {
EXPECT_DOUBLE_EQ(5.0, object.width());
EXPECT_DOUBLE_EQ(6.0, object.height());
EXPECT_DOUBLE_EQ(5.0, object.speed());
EXPECT_NEAR(0.927295, object.speed_heading(), kEpsilon);
EXPECT_EQ(0, object.polygon_point_size());
EXPECT_EQ(Object_Type_VEHICLE, object.type());
} else {
......
......@@ -26,7 +26,8 @@ const MenuIdOptionMapping = {
perceptionUnknownUnmovable: 'showObstaclesUnknownUnmovable',
perceptionUnknown: 'showObstaclesUnknown',
perceptionVirtual: 'showObstaclesVirtual',
perceptionArrow: 'showObstaclesArrow',
perceptionVelocity: 'showObstaclesVelocity',
perceptionHeading: 'showObstaclesHeading',
perceptionId: 'showObstaclesId',
predictionMajor: 'showPredictionMajor',
predictionMinor: 'showPredictionMinor',
......
......@@ -60,14 +60,20 @@ export default class PerceptionObstacles {
obstacle.positionY,
(obstacle.height || DEFAULT_HEIGHT) / 2));
const color = ObstacleColorMapping[obstacle.type] || DEFAULT_COLOR;
if (STORE.options.showObstaclesArrow && obstacle.type &&
if (STORE.options.showObstaclesVelocity && obstacle.type &&
obstacle.type !== 'UNKNOWN_UNMOVABLE' && obstacle.speed > 0.5) {
const arrowMesh = this.updateArrow(position, obstacle.heading,
color, arrowIdx++, scene);
const arrowMesh = this.updateArrow(position,
obstacle.speedHeading, color, arrowIdx++, scene);
const scale = 1 + Math.log2(obstacle.speed);
arrowMesh.scale.set(scale, scale, scale);
arrowMesh.visible = true;
}
if (STORE.options.showObstaclesHeading) {
const arrowMesh = this.updateArrow(position, obstacle.heading,
0xFFFFFF, arrowIdx++, scene);
arrowMesh.scale.set(1, 1, 1);
arrowMesh.visible = true;
}
if (STORE.options.showObstaclesId) {
this.updateId(obstacle.id,
new THREE.Vector3(position.x, position.y, obstacle.height),
......
......@@ -10,7 +10,8 @@ export default [
perceptionUnknownMovable: 'Unknown Movable',
perceptionUnknownUnmovable: 'Unknown Stationary',
perceptionUnknown: 'Unknown',
perceptionArrow: 'Heading & Speed',
perceptionVelocity: 'Velocity',
perceptionHeading: 'Heading',
perceptionId: 'Id'
}
}, {
......
......@@ -48,7 +48,8 @@ options:
showObstaclesUnknownUnmovable: true
showObstaclesUnknown: true
showObstaclesVirtual: false
showObstaclesArrow: true
showObstaclesVelocity: true
showObstaclesHeading: true
showObstaclesId: true
cameraAngle: Default
debug:
......
......@@ -22,8 +22,10 @@ export default class Options {
PARAMETERS.options.defaults.showObstaclesUnknown;
@observable showObstaclesVirtual =
PARAMETERS.options.defaults.showObstaclesVirtual;
@observable showObstaclesArrow =
PARAMETERS.options.defaults.showObstaclesArrow;
@observable showObstaclesVelocity =
PARAMETERS.options.defaults.showObstaclesVelocity;
@observable showObstaclesHeading =
PARAMETERS.options.defaults.showObstaclesHeading;
@observable showObstaclesId =
PARAMETERS.options.defaults.showObstaclesId;
@observable cameraAngle = PARAMETERS.options.defaults.cameraAngle;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册