BlueROV-9: Driving Control

2023-05-16

Home location:

http://python.dronekit.io/guide/vehicle_state_and_parameters.html

The Home location isset when a vehicle first gets a good location fix from the GPS. The location isused as the target when the vehicle does a “return to launch”. In Coptermissions (and often Plane) missions, the altitude of waypoints is set relativeto this position.

Vehicle.home_location has the following behavior:

1. In order to get the current value (ina LocationGlobal object) you must first download Vehicle.commands, as shown:

cmds = vehicle.commands
cmds.download()
cmds.wait_ready()
print " Home Location: %s" % vehicle.home_location

The returned value is None before you download the commands or if the home_location has not yet been set by the autopilot. For this reason our example code checks that the value exists (in a loop) before writing it.

# Get Vehicle Home location - will be `None` until first set by autopilot
while not vehicle.home_location:
    cmds = vehicle.commands
    cmds.download()
    cmds.wait_ready()
    if not vehicle.home_location:
        print " Waiting for home location ..."
# We have a home location.
print "\n Home location: %s" % vehicle.home_location
2. The attribute can be set to a LocationGlobal object (the code fragment below sets it to the current location):
vehicle.home_location=vehicle.location.global_frame

There are some caveats:

  • You must be able to read a non-None value before you can write it (the autopilot has to set the value initially before it can be written or read).
  • The new location must be within 50 km of the EKF origin or setting the value will silently fail.
  • The value is cached in the home_location. If the variable can potentially change on the vehicle you will need to re-download the Vehicle.commands in order to confirm the value.

3. The attribute is not observable.

Note: Vehicle.home_location behaves this way because ArduPilot implements/stores the home location as a waypoint rather than sending them as messages. While DroneKit-Python hides this fact from you when working with commands, to access the value you still need to download the commands.

We hope to improve this attribute in later versions of ArduPilot, where there may be specific commands to get the home locationfrom the vehicle.

 

Parameters:

1. Getting parameters

# Print the valueof the THR_MIN parameter.
print "Param: %s"% vehicle.parameters['THR_MIN']

2. Setting parameters

# Change theparameter value (Copter, Rover)
vehicle.parameters['THR_MIN']=100

3. Listing all parameters

Vehicle.parameters can be iterated to list all parameters and their values:

print "\nPrintall parameters (iterate `vehicle.parameters`):"
for key, value in vehicle.parameters.iteritems():
    print " Key:%s Value:%s" % (key,value)

4. Observing parameter changes

@vehicle.parameters.on_attribute('THR_MIN')
defdecorated_thr_min_callback(self,attr_name, value):
    print " PARAMETER CALLBACK: %s changed to: %s" % (attr_name, value)
 

Taking Off:

Note: Arming turns on the vehicle’s motors inpreparation for flight. The flight controller will not arm until the vehiclehas passed a series of pre-arm checks to ensure that it is safe to fly.

These checks areencapsulated by the Vehicle.is_armable attribute, which is true when the vehicle has booted, EKF is ready, andthe vehicle has GPS lock.

These checks areencapsulated by the Vehicle.is_armable attribute, which is true when the vehicle has booted, EKF is ready, andthe vehicle has GPS lock.

print "Basic pre-arm checks"
# Don't let theuser try to arm until autopilot is ready
whilenot vehicle.is_armable:
    print " Waiting for vehicle to initialise..."
    time.sleep(1)
If you need more status information you can perform the followingsorts of checks:
if v.mode.name== "INITIALISING":
    print "Waiting for vehicle to initialise"
    time.sleep(1)
whilevehicle.gps_0.fix_type < 2:
    print "Waiting for GPS...:", vehicle.gps_0.fix_type
    time.sleep(1)

Velocity control:

The function send_ned_velocity() below generates aSET_POSITION_TARGET_LOCAL_NED MAVLink message which is used to directly specify the speedcomponents of the vehicle in theMAV_FRAME_LOCAL_NED frame (relative to home location). The message is re-sent everysecond for the specified duration.

Note: From Copter 3.3 the vehicle will stop moving if a new messageis not received in approximately 3 seconds. Prior to Copter 3.3 the messageonly needs to be sent once, and the velocity remains active until the nextmovement command is received. The example code works for both cases!

def send_ned_velocity(velocity_x, velocity_y,velocity_z, duration):
    """
    Move vehicle in direction based onspecified velocity vectors.
    """
    msg = vehicle.message_factory.set_position_target_local_ned_encode(
        0,       # time_boot_ms(not used)
        0, 0,   #target system, target component
        mavutil.mavlink.MAV_FRAME_LOCAL_NED, # frame
        0b0000111111000111, # type_mask (only speeds enabled)
        0, 0, 0,# x,y, z positions (not used)
        velocity_x, velocity_y,velocity_z, # x, y, z velocity in m/s
        0, 0, 0,# x,y, z acceleration (not supported yet, ignored in GCS_Mavlink)
        0, 0)   #yaw, yaw_rate (not supported yet, ignored in GCS_Mavlink)
# send command to vehicle on 1 Hz cycle
    for x in range(0,duration):
        vehicle.send_mavlink(msg)
        time.sleep(1)

The type_mask parameter is a bitmask that indicates which ofthe other parameters in the message are used/ignored by the vehicle (0 meansthat the dimension is enabled, 1 means ignored). In the example the value0b0000111111000111 is used to enable the velocity components.

In the MAV_FRAME_LOCAL_NED the speed components velocity_x and velocity_y are parallel to the North and East directions (not to the front andside of the vehicle). The velocity_z component isperpendicular to the plane of velocity_x and velocity_y, with apositive value towards the ground, following the right-hand convention. For more information about theMAV_FRAME_LOCAL_NED frame of reference, see this wikipedia article on NED.


本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

BlueROV-9: Driving Control 的相关文章

  • HTTP Status 500 - Control character in cookie value or attribute.HTTP Status 500 - Cookie name错误解决方法

    原因 xff1a cookie有名称限制 xff0c 路径限制 xff0c 大小限制 xff0c 时间限制 xff0c 数量限制 xff0c 而导致该异常的原因是因为cookie的名称限制 cookie键和值均不支持中文以及空格 xff0c
  • Ajax 跨域请求 Access-Control-Allow-Origin 问题

    这转移一台GMtool的服务器 xff0c 结果转移过去后 xff0c 去登陆账号密码卡在登陆界面上 xff0c 用google开发者工作查看network时 xff0c 是卡在一个验证的服务器上 xff0c 然而可悲的是那台验证上的服务也
  • 无法访问opensips control panel

    OpenSIPS控制面板是一个用于供应的PHP Web门户OpenSIPS服务器 xff0c 可以为opensips提供系统和用户配置 xff0c 我们可以在该面板上添加 修改 管理sip账户信息和权限 有时候无法访问 xff0c 需要先将
  • MFC-Tab Control控件使用

    在MFC当中使用Tab Control控件切换不同的界面 xff0c 使用起来会复杂一些 xff0c 至少是比Qt中的Tab Widget复杂得多 我接下来会以一个MFC对话框应用程序为例子 xff0c 说明Tab Control控件的简单
  • 十、键盘控制无人机 · 下(multirotor_keyboard_control.py解读)

    笔记来源于开源项目 xff1a 基于PX4和ROS的无人机仿真平台 来源于开源项目 xff1a GAAS 目录 一 解读启动通信的multirotor keyboard control py脚本 1 库函数以及消息 2 变量及其初始值 3
  • Apollo control之PID算法

    Apollo studio 官网 xff1a Apollo开发者社区 baidu com 目录 1 PID简介 2 PID调参思路 3 代码 4 解决积分饱和的方法 4 1 IC 积分遇限削弱法 4 2 BC 反馈抑制抗饱和 1 PID简介
  • sdf模型插入gazebo_ros_control插件

    gazebo ros control目前只支持老版的urdf模型 xff0c 官方教程 xff1a http gazebosim org tutorials tut 61 ros control sdf模型怎么办呢 xff1f 回答 xff
  • PX4 Position_Control RC_Remoter引入

    PX4飞控位置环控制中如何引入遥控器的控制量 本文基于PX4 1 12版本 相比于之前的版本 多引入了Flight Task这么一个模块 省流总结 遥控器的值通过 flight tasks update gt velocity setpoi
  • mc_att_control源码解析

    目录 源码分析内环控制外环控制 之前写了博客分析了一下旋翼姿态控制的基础知识 mc att control基础知识 这次就对照代码将整个旋翼姿态控制过程呈现一遍 先看一下整个程序的框图 从图中可以看到 实际上整个控制分成内外两个环进行控制
  • BlueROV-9: Driving Control

    Home location http python dronekit io guide vehicle state and parameters html The Home location isset when a vehicle fir
  • pixhawk mc_pos_control.cpp源码解读

    好久没跟新blog了 xff0c 这段时期边调试边看程序 xff0c 所以有点慢 要开始着手调试了 这篇blog是顺着上一篇pixhawk 整体架构的认识写的 xff0c 接下来看程序的话 xff0c 打算把各个功能模块理解一遍 xff0c
  • Attitude Control (Copter Code Overview)

    Attitude Control Copter Code Overview Between AC3 1 5 and AC 3 2 the attitude control logic was restructured as part of
  • 解读gazebo_ros_control gazebo_ros

    本篇的目的是想解读gazebo ros control 以及 gazebo ros 因为gazebo本身是独立于ros的 通过教程Intermediate Control plugin 以及教程 Category Write a plugi
  • 1、无人系统控制站软件开发平台 CSS(Control Station Studio)概述

    1 初衷 在CSS之前 xff0c 通过参与开发数个大中型无人机地面控制站项目 xff0c 在GCS xff08 Ground Control Station xff09 设计与实现方面积累了一些经验和感悟 在先前的开发过程中 xff0c
  • http cache-control 指令的设置以及意义

    转载地址 https developer mozilla org zh CN docs Web HTTP Headers Cache Control http www cnblogs com yuyii archive 2008 10 16
  • PX4 OffBoard Control

    终于还是走上了这一步 xff0c 对飞控下手 xff0c 可以说是一张白纸了 记录一下学习的过程方便以后的查阅 目录 一 ubuntu18 04配置px4编译环境及mavros环境 二 PX4的OffBoard控制 1 搭建功能包 2 编写
  • 机器人独立关节PD控制(控制小白入门)

    通过今天的学习仿佛对机器人控制有了进一步了解 特记录下看书和抄相关代码笔记 参考书目如下 模型如下 推导出动力学方程如下 忽略重力 摩擦力及外界干扰 可以写成如下形式 不计重力 与上上张图片对比 得p的具体含义 此处p只用到p1 p2 p3
  • 《现代控制系统》第五章——反馈控制系统性能分析 5.4 二阶系统里面极点以及零点带来的影响

    上一节图里面描绘的曲线 仅仅是针对阶跃响应为 的系统来说的 但是这给我们提供了一个很好的例子 许多系统拥有成对的主极点 我们可以通过类似上图的关系来估计系统的阶跃响应 这个方法尽管只是一个估算 但却能在避免拉普拉斯转化的情况下提供一个对超调
  • 【PID】51单片机PID控制电机转速

    PID参考链接 PID增量控制 include Pid Init h include main h extern u16 out extern u16 CurSpeed extern u16 SpeedSet extern u16 PWMT
  • 《现代控制系统》第五章——反馈控制系统性能分析 5.3 二阶系统的性能

    现在我们看一个单环二阶系统的单位阶跃响应 一个闭环反馈控制系统如下图所示 已知该闭环系统的转换方程为 把受控系统的转换方程代入进去得到 如果给一个阶跃输入 那么 查拉普拉斯逆变换表我们得到时域输出为 其中 同时也是特征方程在s域的根与原点的

随机推荐