We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d7ab7cb commit a426211Copy full SHA for a426211
src/sim.cpp
@@ -192,8 +192,8 @@ inline void collectPartnerObsSystem(Engine &ctx,
192
const Rotation &other_rot = ctx.get<Rotation>(other);
193
const VehicleSize &other_size = ctx.get<VehicleSize>(other);
194
195
- Vector2 relative_pos = (other_position - pos).xy();
196
- relative_pos = rot.inv().rotateVec({relative_pos.x, relative_pos.y, 0}).xy();
+ Vector3 relative_pos = (other_position - pos);
+ relative_pos = rot.inv().rotateVec(relative_pos);
197
float relative_speed = other_velocity.linear.length(); // Design decision: return the speed of the other agent directly
198
199
Rotation relative_orientation = rot.inv() * other_rot;
tests/EgocentricRoadObservationTests.cpp
@@ -7,16 +7,17 @@ using namespace madrona::math;
7
using gpudrive::utils::ReferenceFrame;
8
9
TEST(EgocentricRoadObservationTests, Relative) {
10
- ReferenceFrame rf{Vector2{.x = 3, .y = 0},
+ ReferenceFrame rf{Vector3{.x = 3, .y = 0, .z=0},
11
Quat::angleAxis(toRadians(90), madrona::math::up)};
12
13
auto mapObs =
14
- rf.observationOf(Vector3{.x = 3, .y = 3, .z = 0},
+ rf.observationOf(Vector3{.x = 3, .y = 3, .z = 3},
15
Quat::angleAxis(toRadians(270), madrona::math::up),
16
Scale{{.d0 = 10, .d1 = 0.1, .d2 = 0.1}},
17
static_cast<gpudrive::EntityType>(0), 0);
18
19
EXPECT_LT(mapObs.position.x - 3, 0.000001);
20
EXPECT_LT(mapObs.position.y - 0, 0.000001);
21
+ EXPECT_LT(mapObs.position.z - 3, 0.000001);
22
EXPECT_EQ(mapObs.heading, toRadians(180));
23
}
0 commit comments