paparazzi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paparazzi-commits] [5344] made the test a litttle more interesting by a


From: antoine drouin
Subject: [paparazzi-commits] [5344] made the test a litttle more interesting by adding telemetry, and datalink.
Date: Thu, 12 Aug 2010 17:24:16 +0000

Revision: 5344
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=5344
Author:   poine
Date:     2010-08-12 17:24:15 +0000 (Thu, 12 Aug 2010)
Log Message:
-----------
made the test a litttle more interesting by adding telemetry, and datalink. 
Servo values and telemetry modes are changeable by datalink

Modified Paths:
--------------
    paparazzi3/trunk/conf/settings/settings_test_passthrough.xml
    paparazzi3/trunk/conf/telemetry/telemetry_test_passthrough.xml
    paparazzi3/trunk/sw/airborne/fms/fms_gs_com.c
    paparazzi3/trunk/sw/airborne/fms/fms_spi_link.h
    paparazzi3/trunk/sw/airborne/fms/overo_test_passthrough.c
    paparazzi3/trunk/sw/airborne/fms/overo_test_passthrough_telemetry.h

Added Paths:
-----------
    paparazzi3/trunk/sw/airborne/fms/overo_test_passthrough.h

Modified: paparazzi3/trunk/conf/settings/settings_test_passthrough.xml
===================================================================
--- paparazzi3/trunk/conf/settings/settings_test_passthrough.xml        
2010-08-12 15:44:34 UTC (rev 5343)
+++ paparazzi3/trunk/conf/settings/settings_test_passthrough.xml        
2010-08-12 17:24:15 UTC (rev 5344)
@@ -4,8 +4,18 @@
   <dl_settings>
     <dl_settings NAME="Misc">
 
-      <dl_setting var="telemetry_mode_Main_DefaultChannel" min="0" step="1" 
max="1" shortname ="telemetry" values="Default|Other"  module="fms/fms_gs_com"/>
+      <dl_setting var="telemetry_mode_Main_DefaultChannel" min="0" step="1" 
max="1" shortname ="telemetry" values="Default|Other" module="fms/fms_gs_com"/>
 
     </dl_settings>
+
+    <dl_settings NAME="Servos">
+      <dl_setting var="otp.servos_outputs_usecs[0]" min="1000" step="1" 
max="2000" shortname ="S1" module="fms/overo_test_passthrough"/>
+      <dl_setting var="otp.servos_outputs_usecs[1]" min="1000" step="1" 
max="2000" shortname ="S2" module="fms/overo_test_passthrough"/>
+      <dl_setting var="otp.servos_outputs_usecs[2]" min="1000" step="1" 
max="2000" shortname ="S3" module="fms/overo_test_passthrough"/>
+      <dl_setting var="otp.servos_outputs_usecs[3]" min="1000" step="1" 
max="2000" shortname ="S4" module="fms/overo_test_passthrough"/>
+      <dl_setting var="otp.servos_outputs_usecs[4]" min="1000" step="1" 
max="2000" shortname ="S5" module="fms/overo_test_passthrough"/>
+      <dl_setting var="otp.servos_outputs_usecs[5]" min="1000" step="1" 
max="2000" shortname ="S6" module="fms/overo_test_passthrough"/>
+    </dl_settings>
+
   </dl_settings>
 </settings>

Modified: paparazzi3/trunk/conf/telemetry/telemetry_test_passthrough.xml
===================================================================
--- paparazzi3/trunk/conf/telemetry/telemetry_test_passthrough.xml      
2010-08-12 15:44:34 UTC (rev 5343)
+++ paparazzi3/trunk/conf/telemetry/telemetry_test_passthrough.xml      
2010-08-12 17:24:15 UTC (rev 5344)
@@ -4,12 +4,18 @@
 
   <process name="Main">
     <mode name="DefaultMode">
-      <message name="ALIVE"               period="0.5"/>
-      <message name="IMU_GYRO"            period="0.1"/>
+      <message name="ALIVE"                   period="1."/>
+      <message name="TEST_PASSTHROUGH_STATUS" period="0.5"/>
+      <message name="DL_VALUE"                period="0.5"/>
     </mode>
 
     <mode name="OtherMode">
-      <message name="ALIVE"               period="0.5"/>
+      <message name="ALIVE"                   period="1."/>
+      <message name="TEST_PASSTHROUGH_STATUS" period="0.5"/>
+      <message name="DL_VALUE"                period="0.5"/>
+      <message name="IMU_GYRO"                period="0.05"/>
+      <message name="IMU_ACCEL"               period="0.05"/>
+      <message name="IMU_MAG"                 period="0.05"/>
     </mode>
   </process>
 

Modified: paparazzi3/trunk/sw/airborne/fms/fms_gs_com.c
===================================================================
--- paparazzi3/trunk/sw/airborne/fms/fms_gs_com.c       2010-08-12 15:44:34 UTC 
(rev 5343)
+++ paparazzi3/trunk/sw/airborne/fms/fms_gs_com.c       2010-08-12 17:24:15 UTC 
(rev 5344)
@@ -4,18 +4,21 @@
 
 #include "udp_transport2.h"
 
-/* generated */
+/* generated : holds PeriodicSendMain */
 #include "periodic.h"
 /* holds the definitions of PERIODIC_SEND_XXX */
 #include "overo_test_passthrough_telemetry.h"
 /* holds the definitions of DOWNLINK_SEND_XXX */
 #include "messages2.h"
+
 #include "dl_protocol.h"
+/* generated : holds DlSetting() and PeriodicSendDlValue() */
 #include "settings.h"
 
 struct FmsGsCom fms_gs_com;
 uint8_t telemetry_mode_Main_DefaultChannel;
 
+#define PERIODIC_SEND_DL_VALUE(_chan) PeriodicSendDlValue(_chan)
 
 static void on_datalink_event(int fd, short event __attribute__((unused)), 
void *arg);
 static void on_datalink_message(void);
@@ -58,6 +61,7 @@
 }
 
 static void on_datalink_message(void) {
+
   struct udp_transport *tp = fms_gs_com.udp_transport->impl;
   uint8_t msg_id = tp->udp_dl_payload[1]; 
 
@@ -69,13 +73,11 @@
     uint8_t i = DL_SETTING_index(tp->udp_dl_payload);
     float var = DL_SETTING_value(tp->udp_dl_payload);
     DlSetting(i, var);
-    printf("datalink : %d %f\n",i,var);
     DOWNLINK_SEND_DL_VALUE(fms_gs_com.udp_transport, &i, &var);
   }
     break;
 
   default :
-    printf("did nothing\n");
     break;
   }
 

Modified: paparazzi3/trunk/sw/airborne/fms/fms_spi_link.h
===================================================================
--- paparazzi3/trunk/sw/airborne/fms/fms_spi_link.h     2010-08-12 15:44:34 UTC 
(rev 5343)
+++ paparazzi3/trunk/sw/airborne/fms/fms_spi_link.h     2010-08-12 17:24:15 UTC 
(rev 5344)
@@ -19,6 +19,7 @@
  * along with paparazzi; see the file COPYING.  If not, write to
  * the Free Software Foundation, 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
+ *
  */
 
 #ifndef FMS_SPI_LINK_H

Modified: paparazzi3/trunk/sw/airborne/fms/overo_test_passthrough.c
===================================================================
--- paparazzi3/trunk/sw/airborne/fms/overo_test_passthrough.c   2010-08-12 
15:44:34 UTC (rev 5343)
+++ paparazzi3/trunk/sw/airborne/fms/overo_test_passthrough.c   2010-08-12 
17:24:15 UTC (rev 5344)
@@ -1,8 +1,7 @@
 /*
  * $Id$
  *
- * Copyright (C) 2008-2010 Antoine Drouin <address@hidden>
- * Copyright (C) 2010 Piotr Esden-Tempski <address@hidden>
+ * Copyright (C) 2010 The Paparazzi Team
  *
  * This file is part of paparazzi.
  *
@@ -20,6 +19,7 @@
  * along with paparazzi; see the file COPYING.  If not, write to
  * the Free Software Foundation, 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
+ *
  */
 
 #include <stdint.h>
@@ -30,6 +30,8 @@
 
 #include <event.h>
 
+#include "fms/overo_test_passthrough.h"
+
 #include "std.h"
 #include "fms_debug.h"
 #include "fms_periodic.h"
@@ -41,23 +43,15 @@
 /* stuff for telemetry/datalink */
 #include "fms_gs_com.h"
 
-/* let's store those data somewhere */
-#include "booz/booz_imu.h"
+struct OveroTestPassthrough otp;
 
-struct BoozImuFloat imu;
-
 static void main_periodic(int my_sig_num);
+static void dialog_with_io_proc(void);
 
-
-
-
-
-static void send_message(void);
-static void print_up_msg(struct AutopilotMessageCRCFrame * msg);
-static void print_down_msg(struct AutopilotMessageCRCFrame * msg);
-
 int main(int argc, char *argv[]) {
 
+  TRACE(TRACE_DEBUG, "%s", "Starting initialization\n");
+
   /* Initalize our SPI link to IO processor */
   if (spi_link_init()) {
     TRACE(TRACE_ERROR, "%s", "failed to open SPI link \n");
@@ -76,10 +70,15 @@
   /* Initialize our communications with ground segment */
   fms_gs_com_init("10.31.4.7", 4242, 4243, FALSE);
 
+  TRACE(TRACE_DEBUG, "%s", "Initialization completed, entering mainloop\n");
+
+  /* Initialize blaaa */
+  for (uint8_t i=0; i<6; i++) otp.servos_outputs_usecs[i] = 1500;
+
   /* Enter our mainloop */
   event_dispatch();
   
-  printf("leaving... goodbye!\n");
+  TRACE(TRACE_DEBUG, "%s", "leaving mainloop... goodbye!\n");
 
   return 0;
 
@@ -87,7 +86,7 @@
 
 static void main_periodic(int my_sig_num) {
 
-  send_message();
+  dialog_with_io_proc();
   
   fms_gs_com_periodic();
 
@@ -95,46 +94,38 @@
 
 
 
-static void send_message() {
-  static uint32_t foo = 0;
+static void dialog_with_io_proc() {
 
   struct AutopilotMessageCRCFrame msg_in;
   struct AutopilotMessageCRCFrame msg_out;
   uint8_t crc_valid; 
 
+#if 0
   uint16_t val = 1500 + 500*sin(foo*0.001);
   msg_out.payload.msg_down.pwm_outputs_usecs[0] = val;
   msg_out.payload.msg_down.pwm_outputs_usecs[1] = val;
   msg_out.payload.msg_down.pwm_outputs_usecs[2] = val;
+#endif
+  for (uint8_t i=0; i<6; i++) msg_out.payload.msg_down.pwm_outputs_usecs[i] = 
otp.servos_outputs_usecs[i];
 
   spi_link_send(&msg_out, sizeof(struct AutopilotMessageCRCFrame), &msg_in, 
&crc_valid);
   
 
   struct AutopilotMessagePTUp *in = &msg_in.payload.msg_up; 
-  RATES_FLOAT_OF_BFP(imu.gyro, in->gyro);
-  ACCELS_FLOAT_OF_BFP(imu.accel, in->accel); 
+  RATES_FLOAT_OF_BFP(otp.imu.gyro, in->gyro);
+  ACCELS_FLOAT_OF_BFP(otp.imu.accel, in->accel); 
+  MAGS_FLOAT_OF_BFP(otp.imu.mag, in->mag); 
 
-  if (!(foo % 200)) {
-    //    printf("msg %d, CRC errors: %d\n", spi_link.msg_cnt, 
spi_link.crc_err_cnt);
-    //    print_up_msg(&msg_in);
-    //    print_down_msg(&msg_out);
-    printf("%08d -> gx%+02.1f gy%+02.1f gz%+02.1f ax%+02.1f ay%+02.1f 
az%+02.1f rs%02x stm_msg %08d stm_err %d | CRC errors: %d\n",
-          foo,
-          DegOfRad(RATE_FLOAT_OF_BFP(in->gyro.p)), 
-          DegOfRad(RATE_FLOAT_OF_BFP(in->gyro.q)), 
-          DegOfRad(RATE_FLOAT_OF_BFP(in->gyro.r)),
-          ACCEL_FLOAT_OF_BFP(in->accel.x), 
-          ACCEL_FLOAT_OF_BFP(in->accel.y), 
-          ACCEL_FLOAT_OF_BFP(in->accel.z),
-          in->rc_status, 
-          in->stm_msg_cnt, 
-          in->stm_crc_err_cnt, 
-          spi_link.crc_err_cnt);
-  }
-  foo++;
+  otp.io_proc_msg_cnt = in->stm_msg_cnt;
+  otp.io_proc_err_cnt = in->stm_crc_err_cnt;
+
 }
 
 
+
+
+
+#if 0
 static void print_up_msg(struct AutopilotMessageCRCFrame * msg) { 
   printf("UP: %04X %04X %04X %04X %04x %04X %04X %04X %04X \n", 
         msg->payload.msg_up.gyro.p, 
@@ -176,3 +167,4 @@
 }
 
 
+#endif

Added: paparazzi3/trunk/sw/airborne/fms/overo_test_passthrough.h
===================================================================
--- paparazzi3/trunk/sw/airborne/fms/overo_test_passthrough.h                   
        (rev 0)
+++ paparazzi3/trunk/sw/airborne/fms/overo_test_passthrough.h   2010-08-12 
17:24:15 UTC (rev 5344)
@@ -0,0 +1,16 @@
+#ifndef OVERO_TEST_PASSTHROUGH_H
+#define OVERO_TEST_PASSTHROUGH_H
+
+#include "std.h"
+#include "booz/booz_imu.h"
+
+struct OveroTestPassthrough {
+  struct BoozImuFloat imu;
+  uint32_t io_proc_msg_cnt;
+  uint32_t io_proc_err_cnt;
+  uint16_t servos_outputs_usecs[6]; /* FIXME */
+};
+
+extern struct OveroTestPassthrough otp;
+
+#endif /* OVERO_TEST_PASSTHROUGH_H */

Modified: paparazzi3/trunk/sw/airborne/fms/overo_test_passthrough_telemetry.h
===================================================================
--- paparazzi3/trunk/sw/airborne/fms/overo_test_passthrough_telemetry.h 
2010-08-12 15:44:34 UTC (rev 5343)
+++ paparazzi3/trunk/sw/airborne/fms/overo_test_passthrough_telemetry.h 
2010-08-12 17:24:15 UTC (rev 5344)
@@ -3,11 +3,26 @@
 
 #define PERIODIC_SEND_ALIVE(_transport) DOWNLINK_SEND_ALIVE(_transport, 16, 
MD5SUM)
 
-#include "booz/booz_imu.h"
-extern struct BoozImuFloat imu;
+#include "fms/overo_test_passthrough.h"
+#include "fms/fms_spi_link.h"
+#include "fms/fms_gs_com.h"
+#define PERIODIC_SEND_TEST_PASSTHROUGH_STATUS(_transport)              \
+  DOWNLINK_SEND_TEST_PASSTHROUGH_STATUS(_transport,                    \
+                                       &otp.io_proc_msg_cnt,           \
+                                       &otp.io_proc_err_cnt,           \
+                                       &spi_link.msg_cnt,              \
+                                       &spi_link.crc_err_cnt)
+
+
 #define PERIODIC_SEND_IMU_GYRO(_transport)                             \
-  DOWNLINK_SEND_IMU_GYRO(_transport, &imu.gyro.p, &imu.gyro.q, &imu.gyro.r)
+  DOWNLINK_SEND_IMU_GYRO(_transport, &otp.imu.gyro.p, &otp.imu.gyro.q, 
&otp.imu.gyro.r)
 
+#define PERIODIC_SEND_IMU_ACCEL(_transport)                            \
+  DOWNLINK_SEND_IMU_ACCEL(_transport, &otp.imu.accel.x, &otp.imu.accel.y, 
&otp.imu.accel.z)
 
+#define PERIODIC_SEND_IMU_MAG(_transport)                              \
+  DOWNLINK_SEND_IMU_MAG(_transport, &otp.imu.mag.x, &otp.imu.mag.y, 
&otp.imu.mag.z)
 
+
+
 #endif /* OVERO_TEST_PASSTHROUGH_TELEMETRY_H */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]