You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clear Ch5, Ch6 override and set channel 3 to 500 (dictionary syntax)
88
+
Channel overrides: {'3': 500}
89
+
Clear all overrides
90
+
Channel overrides: {}
91
+
92
+
Close vehicle object
93
+
Completed
59
94
60
95
61
96
62
97
How does it work?
63
98
=================
64
99
65
-
Get the default values of the channels using the :py:attr:`channel_readback <dronekit.lib.Vehicle.channel_readback>` attribute.
66
-
67
-
You can over-ride these values using the :py:attr:`channel_override <dronekit.lib.Vehicle.channel_override>` attribute. This takes a dictionary argument defining the RC *output* channels to be overridden (specified by channel number), and their new values. Channels that are not specified in the dictionary are not overridden. All multi-channel updates are atomic. To cancel an override call ``channel_override`` again, setting zero for the overridden channels.
100
+
The RC transmitter channels are connected to the autopilot and control the vehicle.
68
101
69
102
The values of the first four channels map to the main flight controls: 1=Roll, 2=Pitch, 3=Throttle, 4=Yaw (the mapping is defined in ``RCMAP_`` parameters in
@@ -77,7 +110,60 @@ In general a value of 0 set for a specific ``RCn_FUNCTION`` indicates that the c
77
110
`mission controlled <http://plane.ardupilot.com/wiki/flight-features/channel-output-functions/#disabled>`_ (i.e. it will not directly be
78
111
controlled by normal autopilot code).
79
112
113
+
You can read the values of the channels using the :py:attr:`Vehicle.channels <dronekit.lib.Vehicle.channels>` attribute. The values are regularly updated,
114
+
from the UAV, based on the RC inputs from the transmitter. These can be read either as a set or individually:
115
+
116
+
.. code:: python
117
+
118
+
# Get all channel values from RC transmitter
119
+
print"Channel values from RC Tx:", vehicle.channels
120
+
121
+
# Access channels individually
122
+
print"Read channels individually:"
123
+
print" Ch1: %s"% vehicle.channels['1']
124
+
print" Ch2: %s"% vehicle.channels['2']
125
+
126
+
You can override the values sent to the vehicle by the autopilot using :py:attr:`Vehicle.channels.overrides <dronekit.lib.Channels.overrides>`
127
+
(although this is not recommended)! The overrides can be written individually using an indexing syntax or as a set using a dictionary syntax.
128
+
129
+
.. code:: python
130
+
131
+
# Set Ch2 override to 200 using indexing syntax
132
+
vehicle.channels.overrides['2'] =200
133
+
# Set Ch3, Ch4 override to 300,400 using dictionary syntax"
134
+
vehicle.channels.overrides = {'3':300, '4':400}
135
+
136
+
To clear all overrides, set the attribute to an empty dictionary.
137
+
To clear an individual override you can set its value to ``None`` (or call ``del`` on it):
138
+
139
+
.. code:: python
140
+
141
+
# Clear override by setting channels to None
142
+
# Clear using index syntax
143
+
vehicle.channels.overrides['2'] =None
144
+
145
+
# Clear using 'del' syntax
146
+
del vehicle.channels.overrides['3']
147
+
148
+
# Clear using dictionary syntax (and set override at same time!)
0 commit comments