Difference between revisions of "Paul Cox Notes"

From PaparazziUAV
Jump to navigation Jump to search
Line 1: Line 1:
==Sept 30 ==
==Sept 30 ==
===using joystick:===
==Using a Joystick:==
===PC-side configuration===
On the PC side we will send actuator commands two different ways:
1. Running an ocaml application that listens to the joystick device and using a configuration file, will send ivy messages that get forwarded to the vehicle by the server.
2. Normal paparazzi settings mechanism (using settings dialog on PC) that sets corresponding variables on the vehicle.
 
 


running the test program you can see which buttons do what:
running the test program you can see which buttons do what:
Line 94: Line 100:
   <field name="ac_id" type="uint8"/>
   <field name="ac_id" type="uint8"/>
  </message>
  </message>
</pre>
===Vehicle-side configuration===
On the vehicle side we are using a twog for hardware so we will use the setup_actuators target found in:
./conf/autopilot/setup.makefile
This makefile is used by the tiny.makefile which is used because we specify we're using the twog in twinjet_overo.xml
<pre>
  <firmware name="fixedwing">
    <target name="ap" board="twog_1">
</pre>
The setup target is defined as follows:
<pre>
  <firmware name="setup">
    <target name="tunnel" board="twog_1" />
    <target name="setup_actuators" board="twog_1" />
  </firmware>
</pre>
If we were adding the joystick to the autopilot code we could instead add the following line to the firmware section:
<subsystem name="joystick"/>
Here's the setup.makefile section that worked for me:
<pre>
setup_actuators.CFLAGS += -DFBW -DLED -DTIME_LED=1 -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017
setup_actuators.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600 -DDOWNLINK_DEVICE=Uart1 -DPPRZ_UART=Uart1
setup_actuators.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDATALINK=PPRZ
setup_actuators.CFLAGS += -DDOWNLINK_FBW_DEVICE=Uart1 -DDOWNLINK_AP_DEVICE=Uart1
setup_actuators.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c pprz_transport.c downlink.c actuators.c setup_actuators.c $(SRC_ARCH)/uart_hw.c $(SRC_ARCH)/servos_4017_hw.c main.c
</pre>
Here is the settings.xml file:
<pre>
<settings>
    <dl_settings NAME="Actuators" >
      <dl_setting VAR="actuators[1]" MIN="900" STEP="1" MAX="2100" module="actuators" shortname="chan1"/>
      <dl_setting VAR="actuators[2]" MIN="900" STEP="1" MAX="2100" module="actuators" shortname="chan2"/>
      <dl_setting VAR="actuators[3]" MIN="900" STEP="1" MAX="2100" module="actuators" shortname="chan3"/>
      <dl_setting VAR="actuators[4]" MIN="900" STEP="1" MAX="2100" module="actuators" shortname="chan4"/>
      <dl_setting VAR="actuators[5]" MIN="900" STEP="1" MAX="2100" module="actuators" shortname="chan5"/>
      <dl_setting VAR="actuators[6]" MIN="900" STEP="1" MAX="2100" module="actuators" shortname="chan6"/>
      <dl_setting VAR="actuators[7]" MIN="900" STEP="1" MAX="2100" module="actuators" shortname="chan7"/>
    </dl_settings>
</settings>
</pre>
</pre>

Revision as of 06:44, 1 October 2010

Sept 30

Using a Joystick:

PC-side configuration

On the PC side we will send actuator commands two different ways:

1. Running an ocaml application that listens to the joystick device and using a configuration file, will send ivy messages that get forwarded to the vehicle by the server.
2. Normal paparazzi settings mechanism (using settings dialog on PC) that sets corresponding variables on the vehicle.


running the test program you can see which buttons do what:

~/paparazzi3/trunk/sw/ground_segment/joystick$ ./test_stick 
Available button: 288 (0x120)
Available button: 289 (0x121)
Available button: 290 (0x122)
Available button: 291 (0x123)
Available button: 292 (0x124)
Available button: 293 (0x125)
Available button: 294 (0x126)
Available button: 295 (0x127)
Available button: 296 (0x128)
Available button: 297 (0x129)
Available button: 298 (0x12a)
Available button: 299 (0x12b)
Available axis: 0 (0x0)
Available axis: 1 (0x1)
Available axis: 2 (0x2)
Available axis: 5 (0x5)
Available axis: 16 (0x10)
Available axis: 17 (0x11)
Available axis: 40 (0x28)
Axis 0 : parameters = [0,255]
Axis 1 : parameters = [0,255]
Axis 2 : parameters = [0,255]
Axis 3 : parameters = [0,255]
Axis 4 : parameters = [-1,1]
Axis 5 : parameters = [-1,1]
Axis 6 : parameters = [0,255]
Input device name: "GreenAsia Inc.    USB Joystick     " on device "/dev/input/event6"


buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 127 0 0 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 87 0 0 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 20 0 0 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 69 0 0 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 127 0 0 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 127 0 0 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 0 0 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 0 0 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 0 0 127 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 0 111 48 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 0 127 -64 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 -127 32 -127 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 -127 -39 -69 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 0 -117 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 0 -127 127 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis -127 40 -35 127 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis -127 49 127 127 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis -127 127 127 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis -53 127 127 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 8 127 0 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 127 84 0 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 0 0 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 0 0 0 0 0 127 0 0 0
buttons 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 0 0 0 0 0 127 0 0 0
buttons 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 0 0 0 0 0 127 0 0 0
buttons 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 | axis -127 -66 0 0 0 0 127 0 0 0
buttons 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 | axis -127 0 0 0 0 0 127 0 0 0
buttons 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 127 0 0 0 0 127 0 0 0
buttons 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 | axis 47 127 0 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 59 127 0 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 0 0 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 0 0 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis -105 -127 0 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis -78 -127 0 0 0 0 127 0 0 0
buttons 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 -99 0 0 0 0 127 0 0 0
buttons 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | axis 0 0 0 0 0 0 127 0 0 0

Then creating an xml configuration file:

paul@ledelle:~/paparazzi3/trunk/sw/ground_segment/joystick$ medit attack3_booz_nav.xml

and now running the application:

export PAPARAZZI_HOME=/home/paul/paparazzi3/trunk
paparazzi3/trunk/sz/ground_segment/joystick/input2ivy -ac TJOVERO ngs_set_actuators.xml

running ivyprobe we can see the message getting transmitted:

paul@ledelle:~/paparazzi3/trunk/sw/ground_segment/joystick$ ivyprobe '(.*)'

shows:

Paparazzi joystick sent  'input2ivy SET_ACTUATOR 1496 2 3'

but we have to make sure the server knows this message needs to be forwarded: in messages.xml the message should be labeled as "forwarded" :

 <message name="SET_ACTUATOR" id="100" link="forwarded">
   <field name="value" type="uint16"/>
   <field name="no" type="uint8"/>
   <field name="ac_id" type="uint8"/>
 </message>


Vehicle-side configuration

On the vehicle side we are using a twog for hardware so we will use the setup_actuators target found in:

./conf/autopilot/setup.makefile

This makefile is used by the tiny.makefile which is used because we specify we're using the twog in twinjet_overo.xml

  <firmware name="fixedwing">
    <target name="ap" 			board="twog_1">

The setup target is defined as follows:

  <firmware name="setup">
    <target name="tunnel" 		board="twog_1" />
    <target name="setup_actuators" 	board="twog_1" />
  </firmware>

If we were adding the joystick to the autopilot code we could instead add the following line to the firmware section:

<subsystem name="joystick"/>

Here's the setup.makefile section that worked for me:

setup_actuators.CFLAGS += -DFBW -DLED -DTIME_LED=1 -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017
setup_actuators.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600 -DDOWNLINK_DEVICE=Uart1 -DPPRZ_UART=Uart1 
setup_actuators.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDATALINK=PPRZ 
setup_actuators.CFLAGS += -DDOWNLINK_FBW_DEVICE=Uart1 -DDOWNLINK_AP_DEVICE=Uart1
setup_actuators.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c pprz_transport.c downlink.c actuators.c setup_actuators.c $(SRC_ARCH)/uart_hw.c $(SRC_ARCH)/servos_4017_hw.c main.c

Here is the settings.xml file:

<settings>
    <dl_settings NAME="Actuators" >
      <dl_setting VAR="actuators[1]" MIN="900" STEP="1" MAX="2100" module="actuators" shortname="chan1"/>
      <dl_setting VAR="actuators[2]" MIN="900" STEP="1" MAX="2100" module="actuators" shortname="chan2"/>
      <dl_setting VAR="actuators[3]" MIN="900" STEP="1" MAX="2100" module="actuators" shortname="chan3"/>
      <dl_setting VAR="actuators[4]" MIN="900" STEP="1" MAX="2100" module="actuators" shortname="chan4"/>
      <dl_setting VAR="actuators[5]" MIN="900" STEP="1" MAX="2100" module="actuators" shortname="chan5"/>
      <dl_setting VAR="actuators[6]" MIN="900" STEP="1" MAX="2100" module="actuators" shortname="chan6"/>
      <dl_setting VAR="actuators[7]" MIN="900" STEP="1" MAX="2100" module="actuators" shortname="chan7"/>
    </dl_settings>
</settings>