#include <errno.h>
#include <string.h>
#include <sys/stat.h>
+#include <sys/time.h>
using namespace std;
const scalar_t world_width = 400;
const scalar_t world_height = 400;
const scalar_t scaling = 0.16; // So that 400 * 0.16 = 64
- const scalar_t shape_size = 80;
const scalar_t dt = 0.1;
const int nb_iterations_per_steps = 5;
int every_nth = 4;
int nb_frames = 5;
- int multi_grasp = 0;
+ int random_grasp = 0;
+ int random_shape_size = 0;
int nb_shapes = 1;
char data_dir[1024] = "/tmp/";
int multi_images = 0;
i++;
}
- else if(strcmp(argv[i], "--multi_grasp") == 0) {
- multi_grasp = 1;
+ else if(strcmp(argv[i], "--random_grasp") == 0) {
+ random_grasp = 1;
+ i++;
+ }
+
+ else if(strcmp(argv[i], "--random_shape_size") == 0) {
+ random_shape_size = 1;
i++;
}
abort();
}
+ struct timeval start_time, current_time;
+
+ gettimeofday(&start_time, 0);
+
for(int n = 0; n < nb_sequences; n++) {
Universe *universe;
scalar_t grab_start_x, grab_start_y;
- if(multi_grasp) {
+ if(random_grasp) {
grab_start_x = world_width * (0.1 + 0.8 * drand48());
grab_start_y = world_height * (0.1 + 0.8 * drand48());
} else {
}
if((n+1)%100 == 0) {
+ gettimeofday(¤t_time, 0);
+ int estimated_remaining_time =
+ ((nb_sequences - n) * (current_time.tv_sec - start_time.tv_sec)) / n;
cout << "Created "
<< n+1 << "/" << nb_sequences << " sequences in "
<< data_dir
- << "." << endl;
+ << " (~"
+ << estimated_remaining_time/60 << "min"
+ << estimated_remaining_time%60 << "s remaining)."
+ << endl;
}
do {
nb_attempts = 0;
+ scalar_t shape_size;
+
+ if(random_shape_size) {
+ shape_size = 40 + 80 * drand48();
+ } else {
+ shape_size = 80;
+ }
+
do {
scalar_t x[] = { - shape_size * 0.4, + shape_size * 0.4,
+ shape_size * 0.4, - shape_size * 0.4 };