]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
Unify ORTE initialization
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 27 Feb 2013 10:26:38 +0000 (11:26 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 27 Feb 2013 10:26:38 +0000 (11:26 +0100)
- Ensure that ORTE structure is zero-initialized. Either by it being a
  global variable or by explicit memset().
- Do not initialzie strength parameter (expect for in joyd). The default
  strength of all puvlishers is therefore zero.

src/cand/cand.cc
src/display-qt/ortesignals.cpp
src/displayd/displayd.c
src/joyd/joyd.cc
src/robofsm/robot_orte.c
src/robomon/RobomonAtlantis.cpp
src/robomon/RobomonTuning.cpp

index 50d6481ca025735b388b6ce3cddf364c7a10f778..c36836dad572885e3d134a50da40117f8dabef21 100644 (file)
@@ -363,12 +363,13 @@ void rcv_lift_cmd_cb(const ORTERecvInfo *info, void *vinstance,
 }
 }
 
+struct robottype_orte_data orte;
+
 int main(int argc, char *argv[])
 {
        int ret;
        int size;
 
-       struct robottype_orte_data orte;
        struct can_frame frame;
 
        if (cand_init() < 0) {
@@ -378,8 +379,6 @@ int main(int argc, char *argv[])
                printf("cand: init OK\n");
        }
 
-       orte.strength = 1;
-
        /* orte initialization */
        if(robottype_roboorte_init(&orte)) {
                printf("Roboorte initialization failed! Exiting...\n");
index 265c357531d8272a4fad71480fbcba80a1a81010..d488a635d84679d97138e454000173dad43131ef 100644 (file)
@@ -9,7 +9,7 @@ OrteSignals::OrteSignals()
 
 void OrteSignals::createOrte()
 {
-       orte.strength = 1;
+       memset(&orte, 0, sizeof(orte));
        robottype_roboorte_init(&orte); //kontrola uspechu ?
 
        //subscribers
@@ -58,4 +58,4 @@ void OrteSignals::color_con(char color)
 void OrteSignals::time_con(void)
 {
        emit time_sig(orte.match_time.time);
-}
\ No newline at end of file
+}
index 6c258d1855d63de9715765545119d153764d54c9..1c3cd6b09d8dd6787b8a6d1b5ef13ab5523495a9 100644 (file)
@@ -389,7 +389,7 @@ void rcv_fsm_motion_cb(const ORTERecvInfo *info, void *vinstance,
 }
 
 
-
+struct robottype_orte_data orte;
 
 int main(int argc, char *argv[])
 {
@@ -398,7 +398,6 @@ int main(int argc, char *argv[])
        int ret;
        //int size;
 
-       struct robottype_orte_data orte;
        char * tty;
 
        signal(SIGINT, sig_handler);
@@ -424,8 +423,6 @@ int main(int argc, char *argv[])
 //#endif
        }
 
-       orte.strength = 1;
-
        /* orte initialization */
        if(robottype_roboorte_init(&orte)) {
                fprintf(stderr, "displayd: Roboorte initialization failed! Exiting...\n");
index 84c5f0b5ac2b932d8ae9343c5b832043b7c52551..9ebcec86a5ce4a21086a3b334bc94d62183d59c5 100644 (file)
@@ -279,7 +279,7 @@ int main(int argc, char *argv[])
 
        signal(SIGINT, int_handler);
 
-       orte.strength = 30;
+       orte.strength = 2;
 
        /* orte initialization */
        if (robottype_roboorte_init(&orte)) {
index 9d5a231739f741eb309295b2f84c0373996e1650..abb34f54e5aa9f5338e6d77b1c9b2b9f3dfd13ed 100644 (file)
@@ -479,8 +479,6 @@ int robot_init_orte()
 {
        int rv = 0;
 
-       robot.orte.strength = 20;
-
        rv = robottype_roboorte_init(&robot.orte);
        if (rv)
                return rv;
index 7995af1d8108856a40a11fb9ca87b99b71dac23b..63270a711a1911992a5058d9cedd9d7e6ebe86ac 100644 (file)
@@ -774,8 +774,6 @@ void RobomonAtlantis::createOrte()
 {
        int rv;
 
-       orte.strength = 11;
-
        memset(&orte, 0, sizeof(orte));
        rv = robottype_roboorte_init(&orte);
        if (rv) {
index 91dff8dfbca004ca31e1f441ad8d5f3ba01c1ec1..6e8f31ee9e17a900d6f3cd91616ffc82617bd4cb 100644 (file)
@@ -267,9 +267,7 @@ void RobomonTuning::closeEvent(QCloseEvent *)
  **********************************************************************/
 void RobomonTuning::createOrte()
 {
-
-       orte.strength = 12;
-
+       memset(&orte, 0, sizeof(orte));
        if (robottype_roboorte_init(&orte) != 0) {
                perror("robottype_roboorte_init");
                exit(1);