[Top][All Lists]

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

[Paparazzi-devel] Joystick question

From: Chris
Subject: [Paparazzi-devel] Joystick question
Date: Sun, 08 May 2011 08:44:40 +0300
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20110424 Thunderbird/3.1.10

I finally made everything work well with my Saitek Aviator and i also made some changes that aim in reducing modem bandwidth so i need to ask for your opinion on those.

1) added a variable to the rc_datalink.h and .c files ("datalink_pprz_mode") that controls the autopilot's mode:

extern volatile int8_t datalink_pprz_mode;

#define NormalizeRcDl(_in, _out) {  \
  _out[RADIO_ROLL] = (MAX_PPRZ/128) * _in[RADIO_ROLL];            \
  Bound(_out[RADIO_ROLL], MIN_PPRZ, MAX_PPRZ);                \
  _out[RADIO_PITCH] = (MAX_PPRZ/128) * _in[RADIO_PITCH];        \
  Bound(_out[RADIO_PITCH], MIN_PPRZ, MAX_PPRZ);                \
  _out[RADIO_YAW] = (MAX_PPRZ/128) * _in[RADIO_YAW];            \
  Bound(_out[RADIO_YAW], MIN_PPRZ, MAX_PPRZ);                \
  _out[RADIO_THROTTLE] = ((MAX_PPRZ/255)*(127+ _in[RADIO_THROTTLE]));    \
  Bound(_out[RADIO_THROTTLE], 0, MAX_PPRZ);                \
  _out[RADIO_MODE] = MAX_PPRZ * (datalink_pprz_mode - 1);        \
  Bound(_out[RADIO_MODE], MIN_PPRZ, MAX_PPRZ);                \

2) The variable was added to the settings.xml file and the joystick .xml file was configured to change the variable like this:

<message class="ground" name="DL_SETTING" on_event="stick_right_button">
<field name="index" value="IndexOfSetting(datalink_pprz_mode)"/>
<field name="value" value="2"/>

<message class="ground" name="DL_SETTING" on_event="stick_center_button">
<field name="index" value="IndexOfSetting(datalink_pprz_mode)"/>
<field name="value" value="1"/>

<message class="ground" name="DL_SETTING" on_event="stick_left_button">
<field name="index" value="IndexOfSetting(datalink_pprz_mode)"/>
<field name="value" value="0"/>

That way i don't need the "MODE" portion of the RC_4CH message so the message length is now reduced by one byte and since that particular message is repeated at a high rate this should reduce bandwidth usage, am i correct or i dont gain anything by doing that?


reply via email to

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