示例#1
0
def check_and_set_param(param, param_id, param_value):
    global need_reboot
    if param.param_id != param_id:
        return
    remote_value = param_utils.decode_param(param)

    if isinstance(remote_value, int):
        differ = (remote_value != param_value)
    else:
        differ = (abs(remote_value - param_value) > 0.001)

    if differ:
        param_utils.set_parameter(connection, param_id, param_value)
        need_reboot = True
示例#2
0
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

from pymavlink import mavutil
from pymavlink.dialects.v20 import common as mavlink
from utils import main_utils, param_utils

if __name__ == '__main__':
    try:
        connection = main_utils.connect()
        main_utils.start_sending_heartbeat(connection)

        connection.wait_heartbeat()

        params = param_utils.list_params(connection)
        for param in params:
            print('%s = %s' %
                  (param.param_id, str(param_utils.decode_param(param))))

        while True:

            param_id = input('Parameter to set: ')
            param_value = input('New value for parameter %s: ' % (param_id))

            param_utils.set_parameter(connection, param_id, param_value)
    except KeyboardInterrupt:
        print()
        exit(0)
示例#3
0
#!/usr/bin/env python3

#    Copyright 2020, NTRobotics
#
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
# 
#        http://www.apache.org/licenses/LICENSE-2.0
# 
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

from pymavlink import mavutil
from utils import main_utils, param_utils

if __name__ == '__main__':
    try:
        connection = main_utils.connect()
        main_utils.start_sending_heartbeat(connection)

        connection.wait_heartbeat()

        params = param_utils.list_params(connection)
        for param in params:
            print('%s = %s' % (param.param_id, str(param_utils.decode_param(param))))
    except KeyboardInterrupt:
        exit(0)