Skip to content

Commit

Permalink
updated types and export sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
nadarenator committed Dec 5, 2024
1 parent 56d0d39 commit 7dd7751
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct AgentID {

struct Goal
{
madrona::math::Vector2 position;
madrona::math::Vector3 position;
};

// WorldReset is a per-world singleton component that causes the current
Expand Down Expand Up @@ -185,19 +185,19 @@ struct AgentID {
return SelfObservation{
.speed = 0,
.vehicle_size = {0, 0},
.goal = {.position = {0, 0}},
.goal = {.position = {0, 0, 0}},
.collisionState = 0,
.id = -1};
}
};

const size_t SelfObservationExportSize = 7;
const size_t SelfObservationExportSize = 8;

static_assert(sizeof(SelfObservation) == sizeof(float) * SelfObservationExportSize);

struct MapObservation
{
madrona::math::Vector2 position;
madrona::math::Vector3 position;
Scale scale;
float heading;
float type;
Expand All @@ -207,7 +207,7 @@ struct AgentID {
static inline MapObservation zero()
{
return MapObservation{
.position = {0, 0},
.position = {0, 0, 0},
.scale = madrona::math::Diag3x3{0, 0, 0},
.heading = 0,
.type = static_cast<float>(EntityType::None),
Expand All @@ -217,14 +217,14 @@ struct AgentID {
}
};

const size_t MapObservationExportSize = 9;
const size_t MapObservationExportSize = 10;

static_assert(sizeof(MapObservation) == sizeof(float) * MapObservationExportSize);

struct PartnerObservation
{
float speed;
madrona::math::Vector2 position;
madrona::math::Vector3 position;
float heading;
VehicleSize vehicle_size;
float type;
Expand All @@ -233,7 +233,7 @@ struct AgentID {
static inline PartnerObservation zero() {
return PartnerObservation{
.speed = 0,
.position = {0, 0},
.position = {0, 0, 0},
.heading = 0,
.vehicle_size = {0, 0},
.type = static_cast<float>(EntityType::None),
Expand All @@ -255,7 +255,7 @@ struct AgentID {
PartnerObservation obs[consts::kMaxAgentCount - 1];
};

const size_t PartnerObservationExportSize = 8;
const size_t PartnerObservationExportSize = 9;

static_assert(sizeof(PartnerObservations) == sizeof(float) *
(consts::kMaxAgentCount - 1) * PartnerObservationExportSize);
Expand All @@ -275,7 +275,7 @@ struct AgentID {
{
float depth;
float encodedType;
madrona::math::Vector2 position;
madrona::math::Vector3 position;
};

// Linear depth values and entity type in a circle around the agent
Expand All @@ -286,7 +286,7 @@ struct AgentID {
LidarSample samplesRoadLines[consts::numLidarSamples];
};

const size_t LidarExportSize = 3 * consts::numLidarSamples * 4;
const size_t LidarExportSize = 3 * consts::numLidarSamples * 5;

static_assert(sizeof(Lidar) == sizeof(float) * LidarExportSize);
// Number of steps remaining in the episode. Allows non-recurrent policies
Expand All @@ -311,14 +311,14 @@ struct AgentID {

struct Trajectory
{
madrona::math::Vector2 positions[consts::kTrajectoryLength];
madrona::math::Vector3 positions[consts::kTrajectoryLength];
madrona::math::Vector2 velocities[consts::kTrajectoryLength];
float headings[consts::kTrajectoryLength];
float valids[consts::kTrajectoryLength];
Action inverseActions[consts::kTrajectoryLength];
};

const size_t TrajectoryExportSize = 2 * 2 * consts::kTrajectoryLength + 2 * consts::kTrajectoryLength + ActionExportSize * consts::kTrajectoryLength;
const size_t TrajectoryExportSize = 3 * 2 * consts::kTrajectoryLength + 2 * consts::kTrajectoryLength + ActionExportSize * consts::kTrajectoryLength;

static_assert(sizeof(Trajectory) == sizeof(float) * TrajectoryExportSize);

Expand Down

0 comments on commit 7dd7751

Please sign in to comment.