Robot Agent  1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
task_navigate.c
Go to the documentation of this file.
1 
11 /* -- Includes -- */
12 /* system libraries */
13 
14 /* project libraries */
15 #include "task.h"
16 
20 void task_navigate(void)
21 {
22  // Check if task is enabled
24  {
25  // Local vaiables
26  int i;
27  void *data; // Void pointer for data
28  int data_type; // Data type
29 
30  // Check Queue for new Pheromone map sectors
31  // If present -> Update Pheromone map
32  // For testing purposes process all data in the queue
33  while(g_queue_navigate->count != 0)
34  {
35 
36  // Allocate memory for data structure
38  {
39  // Allocate memory
40  data = (void *)malloc(sizeof(pheromone_map_sector_t));
41  // Get data from the queue
42  queue_dequeue(g_queue_navigate, data, &data_type);
43  // Update Pheromone map
45  // Free data
46  free(data);
47  }
48  else
49  {
50  // Throw out of the queue !!!
51  }
52  }
53 
54  // Put pheromone only of position is reasonably accurate
56  {
58  }
59 
60 
61 
62  // Extract Pheromone map into sectors
64  // Send pheromone map sectors (add data to communication queue)
65  for(i = 0; i < g_phs->sector_count; i++)
66  {
68  }
69  // Free memory
71 
72  //Massi:check the go_ahead
73  if(g_go_ahead){
74  // Decide next move and send it to control
76 
77  }else{
78  // Decide next move and send it to control
80  }
81 
82  // Set event
84 
85  }
86 }
queue_t * g_queue_navigate
Definition: task.c:36
queue_node_t * head
Definition: queue.h:36
int enabled
Definition: task.h:46
int pheromone_eval(pheromone_t *ph, robot_t *robot)
Definition: pheromone.c:219
robot_t * g_robot
Definition: task.c:27
int count
Definition: queue.h:39
pheromone_map_sector_t ** pheromone_map_extract(pheromone_t *ph)
Definition: pheromone.c:371
doublylinkedlist_t * g_list_send
Definition: task.c:32
#define s_TASK_EVENT_SET
Definition: task.h:111
taskpipe_navigate_control_t g_tp_navigate_control
Definition: task.c:54
void pheromone_map_update(pheromone_t *ph, pheromone_map_sector_t *phms)
Definition: pheromone.c:336
#define s_CONFIG_ACCURACY_LIMIT
Definition: config.h:96
int g_go_ahead
Definition: task.c:60
enviroment_t * g_envs
Definition: task.c:23
pheromone_t * g_phs
Definition: task.c:28
#define s_DATA_STRUCT_TYPE_PHEROMONE
Definition: def.h:70
void doublylinkedlist_insert_end(doublylinkedlist_t *dlls, void *data, int data_type)
void task_navigate(void)
Definition: task_navigate.c:20
int pf_accuracy(pf_t *pfs, enviroment_t *envs)
Definition: pf.c:294
#define s_TRUE
Definition: def.h:60
void queue_dequeue(queue_t *qs, void *data, int *data_type)
Definition: queue.c:132
task_t g_task_navigate
Definition: task.c:40
void pheromone_put(pheromone_t *ph, int x, int y)
Definition: pheromone.c:174
void pheromone_map_destroy(pheromone_t *ph, pheromone_map_sector_t **phms)
Definition: pheromone.c:449
pf_t * g_pfs
Definition: task.c:26
Pheromone Map Sector structure.
Definition: pheromone.h:58