技术标签: IMU
查看电脑链接的串口信息(名称):
dmesg | grep ttyS*
请移步本人的另一篇博客文章,详细介绍了IMU工作原理和卡尔曼滤波方法:https://blog.csdn.net/hhaowang/article/details/88846468
官方文档:http://docs.ros.org/api/sensor_msgs/html/msg/Imu.html
IMU 消息类型为ROS中的一种标准传感器消息类型,其定义已经包含在sensor_msgs/Imu.msg文件夹中。在发布IM消息时需要将该消息类型的头文件包含在内。
消息详细描述如下:
# This is a message to hold data from an IMU (Inertial Measurement Unit)
#
# Accelerations should be in m/s^2 (not in g's), and rotational velocity should be in rad/sec
#
# If the covariance of the measurement is known, it should be filled in (if all you know is the
# variance of each measurement, e.g. from the datasheet, just put those along the diagonal)
# A covariance matrix of all zeros will be interpreted as "covariance unknown", and to use the
# data a covariance will have to be assumed or gotten from some other source
#
# If you have no estimate for one of the data elements (e.g. your IMU doesn't produce an orientation
# estimate), please set element 0 of the associated covariance matrix to -1
# If you are interpreting this message, please check for a value of -1 in the first element of each
# covariance matrix, and disregard the associated estimate.
Header header
geometry_msgs/Quaternion orientation
float64[9] orientation_covariance # Row major about x, y, z axes
geometry_msgs/Vector3 angular_velocity
float64[9] angular_velocity_covariance # Row major about x, y, z axes
geometry_msgs/Vector3 linear_acceleration
float64[9] linear_acceleration_covariance # Row major x, y z
【1】实现了串口IMU数据采集和发布,https://blog.csdn.net/jc15988821760/article/details/102581213
【2】采用rostools,对IMU数据进行滤波处理,https://blog.csdn.net/learning_tortosie/article/details/103189118
【3】发布IMU和GPS消息,https://blog.csdn.net/Tansir94/article/details/81385812
#include <ros/ros.h>
#include "sensor_msgs/Imu.h"
#include <std_msgs/String.h>
#include <sstream>
/**
* This tutorial demonstrates simple sending of messages over the ROS system.
*/
//回调函数
void imu_callback(const sensor_msgs::Imu::ConstPtr& imu_raw)
{
ROS_INFO_STREAM("Imu raw data publish working : "<<imu_raw->header.stamp);
ROS_INFO_STREAM("Data samples orientation: " <<imu_raw->orientation);
}
int main(int argc, char *argv[])
{
ros::init(argc, argv, "imu_raw_pub"); // node
/**
* NodeHandle is the main access point to communications with the ROS system.
* The first NodeHandle constructed will fully initialize this node, and the last
* NodeHandle destructed will close down the node.
*/
ros::NodeHandle n;
ros::Publisher imu_raw_pub = n.advertise<sensor_msgs::Imu>("imu_data", 10, imu_callback);
// topic name -- imu_data
ros::Rate loop_rate(1);
while(ros::ok())
{
sensor_msgs::Imu imu_raw; // sensor messages - named imu_raw
imu_raw.header.stamp = ros::Time::now();
imu_raw.header.frame_id = "imu_link";
//四元数位姿,所有数据设为固定值,可以自己写代码获取IMU的数据,,然后进行传递
imu_raw.orientation.x = 0;
imu_raw.orientation.y = -1;
imu_raw.orientation.z = -5;
imu_raw.orientation.w = 6;
//线加速度
imu_raw.linear_acceleration.x = 0.01;
imu_raw.linear_acceleration.y = 0.02;
imu_raw.linear_acceleration.z = 0.03;
//角速度
imu_raw.angular_velocity.x = 0.05;
imu_raw.angular_velocity.y = 0.06;
imu_raw.angular_velocity.z = 0.07;
imu_raw_pub.publish(imu_raw); //imu_raw_pub 节点发布消息至imu_data topic
}
ros::spinOnce();
loop_rate.sleep();
return 0;
}
修改CMakeLists.txt文件:
cmake_minimum_required(VERSION 2.8.3)
project(imu_raw_pub)
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
sensor_msgs
tf)
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES imu_raw_pub
# CATKIN_DEPENDS other_catkin_pkg
# DEPENDS system_lib
)
include_directories(
include
${catkin_INCLUDE_DIRS}
)
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_executable(imu_raw_pub src/imu_raw_pub.cpp)
${catkin_EXPORTED_TARGETS})
## Specify libraries to link a library or executable target against
target_link_libraries(imu_raw_pub
${catkin_LIBRARIES}
)
修改package.xml描述文件:
<?xml version="1.0"?>
<package format="2">
<name>imu_raw_pub</name>
<version>0.0.0</version>
<description>The imu_raw_pub package</description>
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="[email protected]">Jane Doe</maintainer> -->
<maintainer email="[email protected]">haowang</maintainer>
<!-- One license tag required, multiple allowed, one license per tag -->
<!-- Commonly used license strings: -->
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
<license>BSD</license>
<!-- Url tags are optional, but multiple are allowed, one per tag -->
<!-- Optional attribute type can be: website, bugtracker, or repository -->
<!-- Example: -->
<!-- <url type="website">http://wiki.ros.org/imu_raw_pub</url> -->
<!-- Author tags are optional, multiple are allowed, one per tag -->
<!-- Authors do not have to be maintainers, but could be -->
<!-- Example: -->
<!-- <author email="[email protected]">Jane Doe</author> -->
<!-- The *depend tags are used to specify dependencies -->
<!-- Dependencies can be catkin packages or system dependencies -->
<!-- Examples: -->
<!-- Use depend as a shortcut for packages that are both build and exec dependencies -->
<!-- Note that this is equivalent to the following: -->
<!-- <exec_depend>roscpp</exec_depend> -->
<!-- Use build_depend for packages you need at compile time: -->
<!-- <build_depend>message_generation</build_depend> -->
<!-- Use build_export_depend for packages you need in order to build against this package: -->
<!-- <build_export_depend>message_generation</build_export_depend> -->
<!-- Use buildtool_depend for build tool packages: -->
<!-- <buildtool_depend>catkin</buildtool_depend> -->
<!-- Use exec_depend for packages you need at runtime: -->
<!-- <exec_depend>message_runtime</exec_depend> -->
<!-- Use test_depend for packages you need only for testing: -->
<!-- <test_depend>gtest</test_depend> -->
<!-- Use doc_depend for packages you need only for building documentation: -->
<!-- <doc_depend>doxygen</doc_depend> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>std_msgs</build_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>sensor_msgs</exec_depend>
<exec_depend>std_msgs</exec_depend>
<!-- The export tag contains other, unspecified, tags -->
<export>
<!-- Other tools can request additional information be placed here -->
</export>
</package>
运行结果:
查看topic和node信息
简单的IMU消息类型的发布测试,下一节试验串口接收IMU数据并发布至imu_data topic中去。
文章浏览阅读1.4w次,点赞10次,收藏134次。从CSV读取数据(逗号分隔值)是数据科学的基本需求。 通常,我们从各种来源获取数据,这些数据可以导出为CSV格式,以便其他系统可以使用这些数据。 Pandas库提供了一些功能函数,我们可以使用该功能完整地读取CSV文件,也可以只读取选定的一组列和行。CSV文件作为输入 csv文件是一个文本文件,其中,列中的值由逗号分隔。假设有一个名称为 input.csv 的文件中的具有以下数据。i..._python对cvs某一列数据求百分比
文章浏览阅读2.4k次,点赞3次,收藏15次。Opencv-python对视频帧的读取和保存源码奉上!_抽取视频帧生成新的视频opencv+python
文章浏览阅读6k次,点赞3次,收藏4次。npy数据的保存与读取保存 利用这种方法,保存文件的后缀名字一定会被置为.npyx = 10numpy.save("data_x.npy",x)读取 data = numpy.load("data_x.npy")创建一个tensora = torch.arange(10)'''tensor([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])device(type='cpu') 默认在cpu上'''1. CPU tensor转..._保存模型输出 npy
文章浏览阅读1k次。近年来,汽车行业发展迅猛,车载网络与通信协议不断革新,车型的平台化和改版升级不可避免地产生了大量相似通信数据库,如何维护数据库的正确唯一,保证报文信号在不同车型、网段之间的同步成为了急需解决的问题。同时总线工程师在开发阶段要维护管理多个版本的数据库,高效的版本管控、多人协作、审核发布等都成为了总线工程师的痛点。 为解决上述问题及总线工程师的痛点,经纬恒润自主..._can fd位序转矩阵表工具
文章浏览阅读2.3w次,点赞4次,收藏36次。上篇说到将excel中的一个工作表按照某列拆分成多个sheet工作表,那么如何把excel中的多个工作表sheet合成一个工作表呢?接下来就继续利用VBA工具来解决这个问题。工作表合成前:工作表合成后:**第一步:**在文件中新建一个工作表sheet,用来存放合成后的数据,如图所示:第二步:点击“开发工具—>查看代码”命令,如图所示:第三步在sheet1(sheet2)中输入代码,如图所示:具体代码如下:Private Sub sheets()Application.Scree_excel中多个sheet合并成一个表
文章浏览阅读1.3k次。从程序员开始,到架构师一路走来,经历过太多的系统和应用。做过手机游戏,写过编程工具;做过大型Web应用系统,写过公司内部CRM;做过SOA的系统集成,写过基于Hadoop的大数据工具;做过外包,做过电商,做过团购,做过支付,做过SNS,也做过移动SNS。以前只用Java,然后学了PHP,现在用R和Javascript。最后跳出IT圈,进入金融圈,研发量化交易软件。架构设计就是定义一套完整的程序_你最感兴趣的it技术是什么?如何运用到金融行业?
文章浏览阅读1.2k次,点赞128次,收藏91次。这里写目录标题导读????第一款效果展示????当然这个也可以用于表白源码????第二款处理结果导读中秋赏月,民间一直流传着多个不同的传说和美丽的神话故事,当然最为人们熟悉的是《嫦娥奔月》了。在多民族的我国,有二十多个民族也在欢庆中秋节,虽然庆祝方式各异,但其寓意,也都是在祁求国泰民安,丰衣足食,团团圆圆,平平安安。这次良辰佳节何不让我们来个吟诗作对岂不美哉!!????第一款特点:根据唐诗数据集设计一款循环神经网络模型,实现你只要输入任意 4 个字和相应的风格,即可以实现一首古诗。赶紧为你的 _自动写诗 链接保留一年
文章浏览阅读933次。一、概述之前写了个okhttputils的工具类,然后有很多同学询问这个工具类和retrofit什么区别,于是上了下官网,发现其底层对网络的访问默认也是基于okhttp,不过retrofit非常适合于restful url格式的请求,更多使用注解的方式提供功能。既然这样,我们本篇博文首先研究其所提供的常用的用法:一般的get请求(如何通过注解携带参数,拼接url)一般的_okhttpclient retrofit2
文章浏览阅读1.1k次。经过三天的学习,算是了解了程序的90%,在这里做个记录。游戏实现:鼠标控制球拍左右移动,球每次碰到顶部得一分,碰左右反弹,一共3条命,有音效。附件内容:游戏代码,图片及声音文件import pygameimport sys#利用动画精灵创建球类并定义move方法class MyBallCalss(pygame.sprite.Sprite): def __init__..._pygame的sprite如何画球
文章浏览阅读1.2w次,点赞11次,收藏8次。出现这个问题是由于下面两种情况其中得一项造成的,大家可以逐个排查,试一下1,版本兼容问题截止到 2020.10左右,Tensorflow 社区可支持的 Python 版本从 3.6-3.8,且在 windows 中Python 需是 64位(Tensorflow 暂不支持 32 位)查看自己 Python 版本及位数方法,打开命令行,直接在命令行中输入 python 命令即可,如下:版本不符或位数不符的,需要重新下载关于 Tensorflow 兼容 python 版本具体细节,可参考官方手册h_error: could not find a version that satisfies the requirement tensorflow (f
文章浏览阅读537次。layui对于一些前端小白来说,例如我,真的非常的好用,不用去花很多很多的心思在前端美化中,并且提高了很大的工作效率。所以建议一些觉得自己前端技术不是很强,但是想让前端美化一点的可以使用layui。layui有开发文档,不用自己去刻意去记一些语法,用的多了,自然就记住了。开发文档链接:https://www.layui.com/doc/layui是一款我比较喜欢的框架,它的界面风格和颜色搭..._layui js 多文件上传table循环遍历回显
文章浏览阅读1k次。在做自动化测试的时候,我们需要通过测试报告来展示验证结果。但是目前主流的testng报告比较不美观,所以这里推荐使用reportng来打造测试报告,下面是使用方法。一. 执行单个测试套件(需手动执行,不推荐)1,添加pom文件 <dependency> <groupId>org.uncommons</groupId> <artifactId>reportng</artifactId> <version>1.1.4&._reportng