Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed jps direction in id #6

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions include/jps/forward.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace jps

using warthog::pack_id;
using warthog::pad_id;
using jps_id = warthog::pad32_id;
using jps_id = pad_id;

typedef enum
{
Expand All @@ -26,12 +26,6 @@ typedef enum
ALL = 255
} direction;

// we sometimes store the id of a node in the lower 3 bytes of a word and
// use the upper byte to store something else (e.g. the parent direction)
[[deprecated]]
constexpr uint32_t JPS_ID_MASK
= (1 << 24) - 1;

using vec_jps_id = std::vector<jps_id>;
using vec_jps_cost = std::vector<warthog::cost_t>;

Expand Down
16 changes: 0 additions & 16 deletions src/jump/offline_jump_point_locator2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ offline_jump_point_locator2::jump_northwest(
{
uint32_t jp_cost = (label_straight1 & 32767);
jps_id jp_id = jps_id(jump_from.id - mapw * jp_cost);
*(((uint8_t*)&jp_id) + 3) = NORTH;
neighbours.push_back(jp_id);
costs.push_back(jp_cost + num_steps * warthog::DBL_ROOT_TWO);
}
Expand All @@ -216,7 +215,6 @@ offline_jump_point_locator2::jump_northwest(
{
uint32_t jp_cost = (label_straight2 & 32767);
jps_id jp_id = jps_id(jump_from.id - jp_cost);
*(((uint8_t*)&jp_id) + 3) = WEST;
neighbours.push_back(jp_id);
costs.push_back(jp_cost + num_steps * warthog::DBL_ROOT_TWO);
}
Expand Down Expand Up @@ -277,7 +275,6 @@ offline_jump_point_locator2::jump_northeast(
{
uint32_t jp_cost = (label_straight1 & 32767);
jps_id jp_id = jps_id(jump_from.id - mapw * jp_cost);
*(((uint8_t*)&jp_id) + 3) = NORTH;
neighbours.push_back(jp_id);
costs.push_back(jp_cost + num_steps * warthog::DBL_ROOT_TWO);
}
Expand All @@ -287,7 +284,6 @@ offline_jump_point_locator2::jump_northeast(
{
uint32_t jp_cost = (label_straight2 & 32767);
jps_id jp_id = jps_id(jump_from.id + jp_cost);
*(((uint8_t*)&jp_id) + 3) = EAST;
neighbours.push_back(jp_id);
costs.push_back(jp_cost + num_steps * warthog::DBL_ROOT_TWO);
}
Expand Down Expand Up @@ -347,7 +343,6 @@ offline_jump_point_locator2::jump_southwest(
{
uint32_t jp_cost = (label_straight1 & 32767);
jps_id jp_id = jps_id(jump_from.id + mapw * jp_cost);
*(((uint8_t*)&jp_id) + 3) = SOUTH;
neighbours.push_back(jp_id);
costs.push_back(jp_cost + num_steps * warthog::DBL_ROOT_TWO);
}
Expand All @@ -357,7 +352,6 @@ offline_jump_point_locator2::jump_southwest(
{
uint32_t jp_cost = (label_straight2 & 32767);
jps_id jp_id = jps_id(jump_from.id - jp_cost);
*(((uint8_t*)&jp_id) + 3) = WEST;
neighbours.push_back(jp_id);
costs.push_back(jp_cost + num_steps * warthog::DBL_ROOT_TWO);
}
Expand Down Expand Up @@ -419,7 +413,6 @@ offline_jump_point_locator2::jump_southeast(
{
uint32_t jp_cost = (label_straight1 & 32767);
jps_id jp_id = jps_id(jump_from.id + mapw * jp_cost);
*(((uint8_t*)&jp_id) + 3) = SOUTH;
neighbours.push_back(jp_id);
costs.push_back(jp_cost + num_steps * warthog::DBL_ROOT_TWO);
}
Expand All @@ -429,7 +422,6 @@ offline_jump_point_locator2::jump_southeast(
{
uint32_t jp_cost = (label_straight2 & 32767);
jps_id jp_id = jps_id(jump_from.id + jp_cost);
*(((uint8_t*)&jp_id) + 3) = EAST;
neighbours.push_back(jp_id);
costs.push_back(jp_cost + num_steps * warthog::DBL_ROOT_TWO);
}
Expand Down Expand Up @@ -484,7 +476,6 @@ offline_jump_point_locator2::jump_north(
uint32_t nx = node_id.id % map_->width();
if(nx == gx)
{
*(((uint8_t*)&goal_id) + 3) = NORTH;
neighbours.push_back(goal_id);
costs.push_back((goal_delta / map_->width()) + cost_to_node_id);
return;
Expand All @@ -495,7 +486,6 @@ offline_jump_point_locator2::jump_north(
if(!(label & 32768))
{
jps_id jp_id = jps_id(node_id.id - id_delta);
*(((uint8_t*)&jp_id) + 3) = NORTH;
neighbours.push_back(jp_id);
costs.push_back(num_steps + cost_to_node_id);
}
Expand All @@ -518,7 +508,6 @@ offline_jump_point_locator2::jump_south(
uint32_t nx = node_id.id % map_->width();
if(nx == gx)
{
*(((uint8_t*)&goal_id) + 3) = SOUTH;
neighbours.push_back(goal_id);
costs.push_back((goal_delta / map_->width()) + cost_to_node_id);
return;
Expand All @@ -529,7 +518,6 @@ offline_jump_point_locator2::jump_south(
if(!(label & 32768))
{
jps_id jp_id = jps_id(node_id.id + id_delta);
*(((uint8_t*)&jp_id) + 3) = SOUTH;
neighbours.push_back(jp_id);
costs.push_back(num_steps + cost_to_node_id);
}
Expand All @@ -547,7 +535,6 @@ offline_jump_point_locator2::jump_east(
uint32_t goal_delta = goal_id.id - node_id.id;
if(num_steps >= goal_delta)
{
*(((uint8_t*)&goal_id) + 3) = EAST;
neighbours.push_back(goal_id);
costs.push_back(goal_delta + cost_to_node_id);
return;
Expand All @@ -557,7 +544,6 @@ offline_jump_point_locator2::jump_east(
if(!(label & 32768))
{
jps_id jp_id = jps_id(node_id.id + num_steps);
*(((uint8_t*)&jp_id) + 3) = EAST;
neighbours.push_back(jp_id);
costs.push_back(num_steps + cost_to_node_id);
}
Expand All @@ -575,7 +561,6 @@ offline_jump_point_locator2::jump_west(
uint32_t goal_delta = node_id.id - goal_id.id;
if(num_steps >= goal_delta)
{
*(((uint8_t*)&goal_id) + 3) = WEST;
neighbours.push_back(goal_id);
costs.push_back(goal_delta + cost_to_node_id);
return;
Expand All @@ -585,7 +570,6 @@ offline_jump_point_locator2::jump_west(
if(!(label & 32768))
{
jps_id jp_id = jps_id(node_id.id - num_steps);
*(((uint8_t*)&jp_id) + 3) = WEST;
neighbours.push_back(jp_id);
costs.push_back(num_steps + cost_to_node_id);
}
Expand Down
3 changes: 1 addition & 2 deletions src/search/jps2plus_expansion_policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ jps2plus_expansion_policy::expand(
// bits 24-31 store the direction to the parent
jps_id jp_id = jp_ids_.at(i);
// TODO: FIX jps node id
warthog::search::search_node* mynode
= generate(jps_id(jp_id.id & jps::JPS_ID_MASK));
warthog::search::search_node* mynode = generate(jps_id(jp_id.id));
add_neighbour(mynode, costs_.at(i));
}
}
Expand Down