Project

General

Profile

Revision 1077

Can run with no robots.

View differences:

branches/simulator/projects/simulator/simulator/core/main.c
29 29
	if (robots_initialize())
30 30
		return -1;
31 31

  
32
	if(argc - optind < 0){
33
		printf("Usage: simulator <robot execetuable>\n");
34
		exit(-1);
35
	}        
36

  
37 32
	int c;
38
    char worldLoadedFlag = 0;
33
	char worldLoadedFlag = 0;
39 34

  
40 35
	while((c = getopt(argc, argv, ":l:p:w:")) != -1)
41 36
	{
......
61 56
				break;
62 57
		}
63 58
	}
59
	
60
	if(argc - optind < 0){
61
		printf("Usage: simulator <robot execetuable>\n");
62
		exit(-1);
63
	}        
64 64

  
65 65
	if(!worldLoadedFlag)
66 66
		load_world("../test/world.txt", 100);
67 67

  
68
	if (optind > 0 && optind < argc)
69
		robot_create(argv[optind]);
68 70

  
69
	robot_create(argv[optind]);
70
	/*robot_create(argv[optind]);
71
	robot_create(argv[optind]);
72
	robot_create(argv[optind]);
73
	robot_create(argv[optind]);
74
	robot_create(argv[optind]);
75
	robot_create(argv[optind]);
76
	robot_create(argv[optind]);
77
	robot_create(argv[optind]);
78
	robot_create(argv[optind]);
79
	robot_create(argv[optind]);
80
	robot_create(argv[optind]);
81
	robot_create(argv[optind]);
82
	robot_create(argv[optind]);
83
	robot_create(argv[optind]);
84
	robot_create(argv[optind]);
85
	robot_create(argv[optind]);
86
	robot_create(argv[optind]);
87
	robot_create(argv[optind]);
88
	robot_create(argv[optind]);*/
89

  
90

  
91 71
	sigset_t set;
92 72
	//TODO: errors
93 73
	sigemptyset(&set);
branches/simulator/projects/simulator/simulator/core/robot.c
308 308

  
309 309
		ret = pthread_mutex_lock(&all_finished_mutex);
310 310
		if(ret)
311
		  err(errno, "error locking mutex in even loop");
311
			err(errno, "error locking mutex in even loop");
312 312
		// TODO: race condition for adding robots?
313 313
		if (finished < num_robots)
314 314
		{
......
328 328
			if (robots[i].id != -1)
329 329
			{
330 330
				robot_update(i);
331

  
332 331
				commit(&robots[i],i,timeStep);
333 332
			}
334 333
		for (i = 0; i < robots_size; i++)

Also available in: Unified diff