Skip to content

Commit b2fbbf8

Browse files
committed
measurement noise as launch arg
1 parent 9ad4d5e commit b2fbbf8

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

launch/distri_gmm_calculator.launch.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ def generate_launch_description():
2727
TARGETS_NUM = 4
2828
SENS_RANGE = 5.0
2929
COMM_RANGE = 7.0
30+
NOISE_DEV = 0.5
3031
ENV_SIZE = 20.0
31-
GRAPHICS_ON = True
32+
GRAPHICS_ON = False
3233

3334
GUI = False
3435

@@ -44,6 +45,7 @@ def generate_launch_description():
4445
{"TARGETS_NUM": TARGETS_NUM},
4546
{"SENS_RANGE": SENS_RANGE},
4647
{"COMM_RANGE": COMM_RANGE},
48+
{"NOISE_DEV": NOISE_DEV},
4749
{"ENV_SIZE": ENV_SIZE},
4850
{"GRAPHICS_ON": GRAPHICS_ON}],
4951
output='screen')

launch/distributed_gmm.launch.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
def generate_launch_description():
2020
TURTLEBOT3_MODEL = os.environ['TURTLEBOT3_MODEL']
2121
ROBOTS_NUM = 8
22-
ROBOT_RANGE = 7.0
22+
ROBOT_RANGE = 10.0
2323
AREA_SIZE_x = 20.0
2424
AREA_SIZE_y = 20.0
2525
AREA_LEFT = -10.0
@@ -32,6 +32,7 @@ def generate_launch_description():
3232
n = Node(
3333
package='gmm_coverage',
3434
node_executable='distributed_gmm',
35+
name='distributed_gmm_'+str(i),
3536
remappings=[('/gaussian_mixture_model', '/gaussian_mixture_model_'+str(i))],
3637
parameters=[{"ROBOTS_NUM": ROBOTS_NUM}, {"ROBOT_RANGE": ROBOT_RANGE}, {"AREA_SIZE_x": AREA_SIZE_x}, {"AREA_SIZE_y": AREA_SIZE_y}, {"AREA_LEFT": AREA_LEFT}, {"AREA_BOTTOM": AREA_BOTTOM}, {"SIM": SIM}, {"ID": i}, {"GUI": GUI}],
3738
output='screen')

src/distributed_gmm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const double b = 0.025; //for differential drive control (only i
6262
//------------------------------------------------------------------------
6363
const float CONVERGENCE_TOLERANCE = 0.1;
6464
//------------------------------------------------------------------------
65-
const int shutdown_timer = 10; //count how many seconds to let the robots stopped before shutting down the node
65+
const int shutdown_timer = 30; //count how many seconds to let the robots stopped before shutting down the node
6666

6767

6868
bool IsPathExist(const std::string &s)

src/gmm_calc.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class Supervisor : public rclcpp::Node
6464
this->get_parameter("SENS_RANGE", SENS_RANGE);
6565
this->declare_parameter<double>("COMM_RANGE", 5.0);
6666
this->get_parameter("COMM_RANGE", COMM_RANGE);
67+
this->declare_parameter<double>("NOISE_STD", 1.0);
68+
this->get_parameter("NOISE_STD", NOISE_STD);
6769
this->declare_parameter<double>("ENV_SIZE", 20.0);
6870
this->get_parameter("ENV_SIZE", ENV_SIZE);
6971
this->declare_parameter<bool>("GRAPHICS_ON", true);
@@ -157,6 +159,7 @@ class Supervisor : public rclcpp::Node
157159
int TARGETS_NUM;
158160
double COMM_RANGE;
159161
double SENS_RANGE;
162+
double NOISE_STD;
160163
double ENV_SIZE;
161164
bool GRAPHICS_ON;
162165
GaussianMixtureModel gmm;
@@ -238,9 +241,8 @@ Eigen::VectorXd Supervisor::addNoise(Eigen::VectorXd point)
238241
// Generate random inputs
239242
std::random_device rd;
240243
std::mt19937 gen(rd());
241-
double dev = 1.0;
242-
std::normal_distribution<double> dist_x(point(0), dev);
243-
std::normal_distribution<double> dist_y(point(1), dev);
244+
std::normal_distribution<double> dist_x(point(0), NOISE_STD);
245+
std::normal_distribution<double> dist_y(point(1), NOISE_STD);
244246

245247
Eigen::VectorXd noisy_point(2);
246248
noisy_point << dist_x(gen), dist_y(gen);

0 commit comments

Comments
 (0)