collision_detection::CollisionResult
CollisionCheckMoveIt::getPathCollisionResult(const std::vector<sensor_msgs::JointState>& targetJointsStateVector, bool contacts)
{
  collision_detection::CollisionResult collision_result;
  for (std::vector<sensor_msgs::JointState>::const_iterator it = targetJointsStateVector.begin(); it != targetJointsStateVector.end(); ++it) {
    collision_result = getCollisionResult(*it, contacts);
    if (collision_result.collision) {
#ifdef DEBUG_COLLISIONS
      ROS_INFO("Collision at %ld of %zd in path.", it - targetJointsStateVector.begin(), targetJointsStateVector.size());
#endif
      return collision_result;
    }
  }

  return collision_result;
}
Beispiel #2
0
void Projectile::update(uint32_t time_ms, const TileMap& map)
{
	float delta = m_velocity * time_ms;

	auto rect = getDamageRectangle(delta);
	auto result = map.getCollisionTilesTest(rect);
	auto collisionResult = getCollisionResult(result, rect);
	test = BoundingBox{ rect };

	if (collisionResult.collided) {
		m_collided = true;
		m_x = collisionResult.x - getDamageRectangle(delta).width();
	}
	else {
		m_x += delta;
	}
}
bool
CollisionCheckMoveIt::hasCollision(const sensor_msgs::JointState& targetJointsState) {
  collision_detection::CollisionResult collision_result = getCollisionResult(targetJointsState);
  return collision_result.collision;
}