rosin-project / metacontrol_experiments

Controls simulation for metacontrol_sim
Apache License 2.0
1 stars 3 forks source link

Select the experiment parameters by passing arguments to the script #4

Closed marioney closed 3 years ago

marioney commented 4 years ago

Created from https://github.com/rosin-project/metacontrol_sim/issues/32#issuecomment-630256366

Experiments parameters should be passed as arguments.

Batch of simulations can then be launched by calling the single sim script with different parameters

marioney commented 4 years ago

The script has been modified to accept parameters and a new run batch script has been added see https://github.com/rosin-project/metacontrol_experiments/commit/eea5452753a541e05cb25a805673dfa7d452e3fb

chcorbato commented 4 years ago

This is looking really good! I get the following build error, though:

________________________________________________________________
Errors     << metacontrol_experiments:make /home/chcorbato/rosin_paper_ws/logs/metacontrol_experiments/build.make.005.log
/home/chcorbato/rosin_paper_ws/src/metacontrol_experiments/src/stop_simulation_node.cpp:12:10: fatal error: metacontrol_sim/IncreaseConsumptionFactor.h: No such file or directory
 #include <metacontrol_sim/IncreaseConsumptionFactor.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It looks like some new files need to be added to the git index?

marioney commented 4 years ago

I forgot to mention, that some new srv files in https://github.com/rosin-project/metacontrol_sim/commit/ae7ff41e65bfa2fcf1fa101e5ee3e99f92c597bb were added. Did you pull them?

chcorbato commented 4 years ago

Sorry, normally I pull everything but looks like I did not last night. Now it build and runs!

When running it without arguments I get an error about the obstacles though:

$ ./run_single_sim.sh
...
[ INFO] [1589867337.257566338, 6.014000000]: Power load of consumer has changed to: 1.6832
1.68320024014
[ERROR] [1589867337.469781183, 6.110000000]: GetModelProperties: model [unknown_obstacle1] does not exist
[ERROR] [1589867337.586530081, 6.150000000]: GetModelProperties: model [unknown_obstacle2] does not exist
[ERROR] [1589867337.814599168, 6.261000000]: GetModelProperties: model [unknown_obstacle3] does not exist

However, there is no error reported in the output of the ./run_single_sim.sh

process[stop_simulation_node-1]: started with pid [17620]
process[create_unknown_obstacles_node-2]: started with pid [17621]
[ INFO] [1589867322.072434551]: [STOP SIM] - Start node
[ INFO] [1589867322.109924939]: [STOP SIM] Will increase power consumption by 1.20 after 0.6 of the path is completed
[ INFO] [1589867322.136659331]: [STOP SIM] Logging to /home/chcorbato/rosin_paper_ws/src/metacontrol_experiments/data/log_Metacontrol_sim_19_05-07_48.csv
[ INFO] [1589867322.136785395]: [STOP SIM] Node Initialization Completed
[ INFO] [1589867322.136845167]: Initialized an async multi-thread node.
[ INFO] [1589867322.137059347]: [STOP SIM] - Wait for goal msg
[ INFO] [1589867328.860330775]: [LogData :: goal_callback] - Goal Pos x -8.500000 - y -6.500000
[ INFO] [1589867328.937354174]: [STOP SIM] - Initial goal distance: 13.01
[ INFO] [1589867328.937439515]: [STOP SIM] - Wait for robot to reach the goal
[INFO] [1589867337.243253, 6.006000]: Adding obstacles: 3
[INFO] [1589867337.465202, 6.109000]: Adding obstacles.
[INFO] [1589867337.581946, 6.149000]: SpawnModel: Successfully spawned entity
[INFO] [1589867337.805976, 6.255000]: SpawnModel: Successfully spawned entity
[INFO] [1589867338.029512, 6.361000]: SpawnModel: Successfully spawned entity
[create_unknown_obstacles_node-2] process has finished cleanly
log file: /home/chcorbato/.ros/log/62928dea-9994-11ea-bcb4-acbc328abab1/create_unknown_obstacles_node-2*.log
[ INFO] [1589867409.104005761]: [STOP SIM] - 2 / 3 of the route completed
[ INFO] [1589867409.114274191]: Power consumption increased 
[ INFO] [1589867430.604181921]: [STOP SIM :: stop_simulation] Killing nodes
killing /fake_localization
killed
ERROR: Unknown node(s):
 * /record_bag_node
================================================================================REQUIRED process [stop_simulation_node-1] has died!
process has finished cleanly
log file: /home/chcorbato/.ros/log/62928dea-9994-11ea-bcb4-acbc328abab1/stop_simulation_node-1*.log
Initiating shutdown!
================================================================================
[stop_simulation_node-1] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done
exit
Simulation Finished!!

I will do some more tests.

chcorbato commented 4 years ago

When running it without arguments I get an error about the obstacles though:

When I run it specifying the obstacles I do not get the error, e.g. $ ./run_single_sim.sh -o 1 -p 0

Also, the terminal with the roscore is not terminated

marioney commented 4 years ago

When running it without arguments I get an error about the obstacles though:

$ ./run_single_sim.sh
...
[ INFO] [1589867337.257566338, 6.014000000]: Power load of consumer has changed to: 1.6832
1.68320024014
[ERROR] [1589867337.469781183, 6.110000000]: GetModelProperties: model [unknown_obstacle1] does not exist
[ERROR] [1589867337.586530081, 6.150000000]: GetModelProperties: model [unknown_obstacle2] does not exist
[ERROR] [1589867337.814599168, 6.261000000]: GetModelProperties: model [unknown_obstacle3] does not exist

I think that's not a real error, it's just a check to see if the obstacles exist before spawning them because by default 3 obstacles are spawned. Does the simulation runs correctly even after the error message?

chcorbato commented 4 years ago

Does the simulation runs correctly even after the error message?

No, the simulation runs correctly, see above:

However, there is no error reported in the output of the ./run_single_sim.sh

I leave this open because maybe you want to change [ERROR] [1589867337.469781183, 6.110000000]: GetModelProperties: model [unknown_obstacle1] does not exist into a WARN, but feel free to close it or triage it as you see it fit.

chcorbato commented 4 years ago

I leave this open because maybe you want to change [ERROR] [1589867337.469781183, 6.110000000]: GetModelProperties: model [unknown_obstacle1] does not exist into a WARN, but feel free to close it or triage it as you see it fit.

I see this is not an issue of the script for the experiments but an error from gazebo probably raised here (to be confirmed) https://github.com/rosin-project/metacontrol_experiments/blob/2e0f679fcbc58ce66819818c66a8199b258e9796/scripts/create_unknown_obstacles.py#L34

chcorbato commented 3 years ago

Original issue completed, therefore I close it. Small issue with an ERROR message that could be a WARNabove moved to a separate issue #23