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

Updated comms model #579

Merged
merged 7 commits into from
Sep 23, 2020
Merged
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
2 changes: 2 additions & 0 deletions docker/cloudsim_bridge/Dockerfile
Original file line number Diff line number Diff line change
@@ -20,7 +20,9 @@ RUN apt-get update -qq \
gdb \
git \
libbluetooth-dev \
libccd-dev \
libcwiid-dev \
libfcl-dev \
libgoogle-glog-dev \
libspnav-dev \
libusb-dev \
2 changes: 2 additions & 0 deletions docker/cloudsim_sim/Dockerfile
Original file line number Diff line number Diff line change
@@ -20,7 +20,9 @@ RUN apt-get update -qq \
gdb \
git \
libbluetooth-dev \
libccd-dev \
libcwiid-dev \
libfcl-dev \
libgoogle-glog-dev \
libspnav-dev \
libusb-dev \
2 changes: 2 additions & 0 deletions docker/subt_shell/Dockerfile
Original file line number Diff line number Diff line change
@@ -11,7 +11,9 @@ RUN apt-get update -qq \
gdb \
git \
libbluetooth-dev \
libccd-dev \
libcwiid-dev \
libfcl-dev \
libgoogle-glog-dev \
libspnav-dev \
libusb-dev \
2 changes: 2 additions & 0 deletions docker/subt_sim_entry/Dockerfile
Original file line number Diff line number Diff line change
@@ -10,7 +10,9 @@ RUN apt-get update -qq \
gdb \
git \
libbluetooth-dev \
libccd-dev \
libcwiid-dev \
libfcl-dev \
libgoogle-glog-dev \
libspnav-dev \
libusb-dev \
2 changes: 2 additions & 0 deletions docker/subt_team_entry/Dockerfile
Original file line number Diff line number Diff line change
@@ -11,7 +11,9 @@ RUN apt-get update -qq \
gdb \
git \
libbluetooth-dev \
libccd-dev \
libcwiid-dev \
libfcl-dev \
libgoogle-glog-dev \
libspnav-dev \
libusb-dev \
Original file line number Diff line number Diff line change
@@ -75,8 +75,7 @@ attempt_send(const radio_configuration& radio,
tx_state.bytes_sent.push_back(std::make_pair(now, num_bytes));
tx_state.bytes_sent_this_epoch += num_bytes;

// Get the received power based on TX power and position of each
// node
// Get the received power based on TX power and position of each node
auto rx_power_dist = radio.pathloss_f(radio.default_tx_power,
tx_state,
rx_state);
Original file line number Diff line number Diff line change
@@ -37,11 +37,15 @@ struct rf_configuration
double fading_exponent; ///< Fading exponent
double L0; ///< Received power at 1m (in dBm)
double sigma; ///< Standard deviation for received power
double scaling_factor; ///< Scaling factor
double range_per_hop; ///< Extra ranged added per breadcrumb
rf_configuration() :
max_range(50.0),
fading_exponent(2.5),
L0(40),
sigma(10)
sigma(10),
scaling_factor(1.0),
range_per_hop(2.0)
{ }

/// Output stream operator
@@ -54,7 +58,9 @@ struct rf_configuration
<< "-- max_range: " << config.max_range << std::endl
<< "-- fading_exponent: " << config.fading_exponent << std::endl
<< "-- L0: " << config.L0 << std::endl
<< "-- sigma: " << config.sigma << std::endl;
<< "-- sigma: " << config.sigma << std::endl
<< "-- scaling_factor: " << config.scaling_factor << std::endl
<< "-- range_per_hop: " << config.range_per_hop << std::endl;

return oss;
}
@@ -64,7 +70,7 @@ struct rf_configuration
///
/// Compute the pathloss based on distance between two nodes and
/// return the received power.
///
///
/// @param tx_power Transmit power (dBm)
/// @param tx_state Transmit state (pose)
/// @param rx_state Receiver state (pose)
@@ -79,7 +85,7 @@ rf_power distance_based_received_power(const double& tx_power,
/// Compute the pathloss based on distance between two nodes and
/// return the received power. Vary return by drawing from normal
/// distribution.
///
///
/// @param tx_power Transmit power (dBm)
/// @param tx_state Transmit state (pose)
/// @param rx_state Receiver state (pose)
@@ -88,8 +94,33 @@ rf_power log_normal_received_power(const double& tx_power,
radio_state& tx_state,
radio_state& rx_state,
const rf_configuration& config);

/// Compute received power based on distance.
///
/// Compute the pathloss based on distance between two nodes and
/// return the received power. Vary return by drawing from normal
/// distribution.
///
/// @param tx_power Transmit power (dBm)
/// @param range Greatest distance in a single hop (m)
/// @param num_hops Number of breadcrumbs crossed
/// @param config Physical-layer configuration
rf_power log_normal_v2_received_power(const double& tx_power,
const double& range,
const unsigned int& num_hops,
const rf_configuration& config);

/// Compute received power based on visibility information only.
///
/// Compute the pathloss based on the visibility cost between two nodes and
/// return the received power.Vary return by drawing from normal
/// distribution.
///
/// @param tx_power Transmit power (dBm)
/// @param config Physical-layer configuration
rf_power visibility_only_received_power(const double& tx_power,
const rf_configuration& config);
}
}
}
#endif

30 changes: 29 additions & 1 deletion subt-communication/subt_rf_interface/src/subt_rf_model.cpp
Original file line number Diff line number Diff line change
@@ -56,7 +56,35 @@ rf_power log_normal_received_power(const double& tx_power,
}

double PL = config.L0 + 10 * config.fading_exponent * log10(range);


return {tx_power - PL, config.sigma};
}

/////////////////////////////////////////////
rf_power log_normal_v2_received_power(const double& tx_power,
const double& range,
const unsigned int& num_hops,
const rf_configuration& config)
{
if(config.max_range > 0.0 &&
range > config.max_range) {
return {-std::numeric_limits<double>::infinity(), 0.0};
}

double adjusted_range = config.scaling_factor *
(range + num_hops * config.range_per_hop);

double PL = config.L0 + 10 * config.fading_exponent * log10(adjusted_range);

return {tx_power - PL, config.sigma};
}

/////////////////////////////////////////////
rf_power visibility_only_received_power(const double& tx_power,
const rf_configuration& config)
{
double PL = config.L0 + 10 * config.fading_exponent;

return {tx_power - PL, config.sigma};
}

52 changes: 42 additions & 10 deletions subt_ign/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -36,6 +36,12 @@ find_package(ignition-launch1 REQUIRED)
find_package(sdformat8 REQUIRED)
find_package(yaml-cpp REQUIRED)

find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBFCL_PC REQUIRED fcl)
# find *absolute* paths to LIBFCL_INCLUDE_DIRS and LIBFCL_LIBRARIES
find_path(LIBFCL_INCLUDE_DIRS fcl/config.h HINTS ${LIBFCL_PC_INCLUDE_DIR} ${LIBFCL_PC_INCLUDE_DIRS})
find_library(LIBFCL_LIBRARIES fcl HINTS ${LIBFCL_PC_LIBRARY_DIRS})

###########
## Build ##
###########
@@ -47,6 +53,8 @@ include_directories(
${CATKIN_DEVEL_PREFIX}/include
)

message(STATUS ${LIBFCL_INCLUDE_DIRS})

link_directories()

catkin_package(
@@ -179,14 +187,43 @@ install(TARGETS validate_connections
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)

add_library(Visibility
STATIC
src/ign_to_fcl.cc
src/SimpleDOTParser.cc
src/VisibilityRfModel.cc
src/VisibilityTable.cc
)
target_include_directories(Visibility
PUBLIC
${catkin_INCLUDE_DIRS}
${LIBFCL_INCLUDE_DIRS}
)
target_link_libraries(
Visibility
PUBLIC
ignition-gazebo${IGN_GAZEBO_VER}::core
ignition-common3::ignition-common3
ignition-common3::graphics
${LIBFCL_LIBRARIES}
${catkin_LIBRARIES}
)

add_executable(validate_visibility_table
src/validate_visibility_table.cc)
target_link_libraries(validate_visibility_table
PRIVATE
Visibility
)
install(TARGETS validate_visibility_table
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)

# Create the libCommsBrokerPlugin.so library.
set(comms_broker_plugin_name CommsBrokerPlugin)
add_library(${comms_broker_plugin_name}
src/CommsBrokerPlugin.cc
src/VisibilityRfModel.cc
src/VisibilityTable.cc
src/SimpleDOTParser.cc
)
target_include_directories(${comms_broker_plugin_name}
PRIVATE ${CATKIN_DEVEL_PREFIX}/include)
@@ -200,7 +237,7 @@ target_link_libraries(${comms_broker_plugin_name}
ignition-transport7::ignition-transport7
sdformat8::sdformat8
${protobuf_lib_name}
${catkin_LIBRARIES}
Visibility
)
install(TARGETS ${comms_broker_plugin_name}
ARCHIVE DESTINATION lib
@@ -211,14 +248,9 @@ install(TARGETS ${comms_broker_plugin_name}
set(visibility_plugin_name VisibilityPlugin)
add_library(${visibility_plugin_name} SHARED
src/VisibilityPlugin.cc
src/VisibilityTable.cc
src/SimpleDOTParser.cc
)
target_include_directories(${visibility_plugin_name}
PRIVATE ${CATKIN_DEVEL_PREFIX}/include)
target_link_libraries(${visibility_plugin_name}
PRIVATE
ignition-gazebo${IGN_GAZEBO_VER}::core
ignition-common3::ignition-common3
ignition-math6::ignition-math6
ignition-msgs4::ignition-msgs4
@@ -227,7 +259,7 @@ target_link_libraries(${visibility_plugin_name}
ignition-transport7::ignition-transport7
sdformat8::sdformat8
${protobuf_lib_name}
${catkin_LIBRARIES}
Visibility
)
install(TARGETS ${visibility_plugin_name}
ARCHIVE DESTINATION lib
3 changes: 2 additions & 1 deletion subt_ign/include/subt_ign/CommonTypes.hh
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
#include <string>
#include <utility>
#include <ignition/math/graph/Graph.hh>
#include <subt_ign/VisibilityTypes.hh>

namespace subt
{
@@ -41,7 +42,7 @@ namespace subt
using VisibilityInfo =
std::map<std::pair<ignition::math::graph::VertexId,
ignition::math::graph::VertexId>,
double>;
VisibilityCost>;

/// \brief Class used to store information about a member of the team.
class TeamMember
Loading