]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
types: Added arrays to .idl (ORTE already supports them)
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 21 Apr 2009 13:45:50 +0000 (15:45 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 21 Apr 2009 13:45:50 +0000 (15:45 +0200)
src/hokuyo/hokuyo.c
src/robofsm/map_handling.c
src/robomon/RobomonAtlantis.cpp
src/robomon/RobomonTuning.cpp
src/types/robottype.idl

index 7d8576e4766a84b346c7225048e710bb0c38c053..6f41476e52506530ef51f03f4e6796dde644eba8 100644 (file)
@@ -211,15 +211,13 @@ void scan_publisher_callback(const ORTESendInfo *info,
                void *vinstance, void *arg)
 {
        struct hokuyo_scan_type *instance = (struct hokuyo_scan_type *) vinstance;
-       u_int16_t *scan_data;
        int i;
 
        switch(info->status) {
                case NEED_DATA:
                        hokuyo_get_scan();
-                       scan_data = (u_int16_t *)&(instance->data1);
                        for(i=0; i <= HOKUYO_CLUSTER_CNT; i++)
-                               scan_data[i] = scan[i];
+                               instance->data[i] = scan[i];
                        free(scan);
                        break;
                case CQL:
index 428333c83bd3c188f08439f8f92b5e2edf5d6bba..045642e7925ea0300396d854360ae76a7c710e83 100644 (file)
@@ -129,7 +129,7 @@ void update_map_hokuyo(struct hokuyo_scan_type *s)
        beam.x = HOKUYO_CENTER_OFFSET_M;
        beam.y = 0;
 
-       data = (u_int16_t*)&(s->data1);
+       data = s->data;
 
        for (i = 0; i < HOKUYO_CLUSTER_CNT; i++) {
                if((i==0)||(i==6)||(i==7)||(i==26)||(i==27)||(i==28))
index 482faef0d95a5b640247d40e5bc01062fad6d6d7..46b532cf1b1ec2596d3370ba17f3d0c227eccad3 100644 (file)
@@ -644,50 +644,14 @@ void RobomonAtlantis::simulateObstaclesHokuyo()
 {
        double distance, wall_distance;
        int i;
-       uint16_t *hokuyo[34] = { // FIXME should be HOKUYO_CLUSTER_CNT
-               &orte.hokuyo_scan.data1,
-               &orte.hokuyo_scan.data2,
-               &orte.hokuyo_scan.data3,
-               &orte.hokuyo_scan.data4,
-               &orte.hokuyo_scan.data5,
-               &orte.hokuyo_scan.data6,
-               &orte.hokuyo_scan.data7,
-               &orte.hokuyo_scan.data8,
-               &orte.hokuyo_scan.data9,
-               &orte.hokuyo_scan.data10,
-               &orte.hokuyo_scan.data11,
-               &orte.hokuyo_scan.data12,
-               &orte.hokuyo_scan.data13,
-               &orte.hokuyo_scan.data14,
-               &orte.hokuyo_scan.data15,
-               &orte.hokuyo_scan.data16,
-               &orte.hokuyo_scan.data17,
-               &orte.hokuyo_scan.data18,
-               &orte.hokuyo_scan.data19,
-               &orte.hokuyo_scan.data20,
-               &orte.hokuyo_scan.data21,
-               &orte.hokuyo_scan.data22,
-               &orte.hokuyo_scan.data23,
-               &orte.hokuyo_scan.data24,
-               &orte.hokuyo_scan.data25,
-               &orte.hokuyo_scan.data26,
-               &orte.hokuyo_scan.data27,
-               &orte.hokuyo_scan.data28,
-               &orte.hokuyo_scan.data29,
-               &orte.hokuyo_scan.data30,
-               &orte.hokuyo_scan.data31,
-               &orte.hokuyo_scan.data32,
-               &orte.hokuyo_scan.data33,
-               &orte.hokuyo_scan.data34,
-       };
-
+       uint16_t *hokuyo = orte.hokuyo_scan.data;
        
        for (i=0; i<HOKUYO_CLUSTER_CNT; i++) {
                wall_distance = distanceToWallHokuyo(i);
                distance = distanceToObstacleHokuyo(i, simulatedObstacle, SIM_OBST_SIZE_M/*meters*/);
                if (wall_distance < distance) 
                        distance = wall_distance;
-               *hokuyo[i] = (uint16_t)(distance*1000);
+               hokuyo[i] = distance*1000;
        }
        ORTEPublicationSend(orte.publication_hokuyo_scan);
        
index a00a8a02167753b090b7d1b60dcd998913c0796d..40e1b582081e69fffa9a11a0eec61370ebb62f97 100644 (file)
@@ -291,14 +291,14 @@ void RobomonTuning::setPwrAlert(int value)
 
 void RobomonTuning::setCanMsg()
 {
-       orte.can_msg.data1 = canData1->text().toInt();
-       orte.can_msg.data2 = canData2->text().toInt();
-       orte.can_msg.data3 = canData3->text().toInt();
-       orte.can_msg.data4 = canData4->text().toInt();
-       orte.can_msg.data5 = canData5->text().toInt();
-       orte.can_msg.data6 = canData6->text().toInt();
-       orte.can_msg.data7 = canData7->text().toInt();
-       orte.can_msg.data8 = canData8->text().toInt();
+       orte.can_msg.data[0] = canData1->text().toInt();
+       orte.can_msg.data[1] = canData2->text().toInt();
+       orte.can_msg.data[2] = canData3->text().toInt();
+       orte.can_msg.data[3] = canData4->text().toInt();
+       orte.can_msg.data[4] = canData5->text().toInt();
+       orte.can_msg.data[5] = canData6->text().toInt();
+       orte.can_msg.data[6] = canData7->text().toInt();
+       orte.can_msg.data[7] = canData8->text().toInt();
 
        orte.can_msg.len = canMsgLen->text().toInt();
        orte.can_msg.id = canId->text().toInt();
index 65e97f39f524f6029cd71d5e4575909435c9e2a3..364c7133302345e95e07f8cee43a8af385cffce0 100644 (file)
@@ -65,53 +65,13 @@ struct robot_cmd {
 };
 
 struct can_msg {
-    octet data1;
-    octet data2;
-    octet data3;
-    octet data4;
-    octet data5;
-    octet data6;
-    octet data7;
-    octet data8;
+    octet data[8];
     octet len;
     octet id;
 };
 
 struct hokuyo_scan {
-    unsigned short data1;
-    unsigned short data2;
-    unsigned short data3;
-    unsigned short data4;
-    unsigned short data5;
-    unsigned short data6;
-    unsigned short data7;
-    unsigned short data8;
-    unsigned short data9;
-    unsigned short data10;
-    unsigned short data11;
-    unsigned short data12;
-    unsigned short data13;
-    unsigned short data14;
-    unsigned short data15;
-    unsigned short data16;
-    unsigned short data17;
-    unsigned short data18;
-    unsigned short data19;
-    unsigned short data20;
-    unsigned short data21;
-    unsigned short data22;
-    unsigned short data23;
-    unsigned short data24;
-    unsigned short data25;
-    unsigned short data26;
-    unsigned short data27;
-    unsigned short data28;
-    unsigned short data29;
-    unsigned short data30;
-    unsigned short data31;
-    unsigned short data32;
-    unsigned short data33;
-    unsigned short data34;
+    unsigned short data[34];
 };
 
 /** Request for hokuyo pitch (angle) */