您的位置:首页 > 编程语言

ROS学习笔记------ROS机器人系统设计-----基础编程 day 8 2019/3/7 帅某(Kinect的安装,xarco模型,xarco---urdf模型,gazebo物理仿真环境的搭建)

2019-03-07 07:57 856 查看
版权声明:转载请注释出处,帅某不胜感激。严禁利用本博客进行商业或从事利益方面工作!! https://blog.csdn.net/weixin_43262513/article/details/88089121

一 Kinect的安装

步骤如下:

sudo apt-get install ros-kinetic-freenect-*       (*意思是通配符,只要前缀是ros-kinetic-freenect-的都安装,zsh不支持)
git clone https://github.com/avin2/SensorKinect.git
cd SensorKinect/Bin
tar xvf SensorKinect093-Bin-Linux-x64-v5.1.2.1.tar.bz2         (64位的,32 位的把64换成86)
cd Sensor-Bin-Linux-x64-v5.1.2.1                               (64位的,32 位的把64换成86)
sudo ./install.sh

二 机器人urdf模型的优化-----xacro模型

1.常量的定义

2.数学计算
注:所有的运算都会先转换为浮点数运行,以保证精度

3.宏定义(类似于C语言中的函数模块)

4.文件包含(类似于C语言中的#include“”头文件“”)

5.优化后的文件

<?xml version="1.0"?>
<robot name="mbot" xmlns:xacro="http://www.ros.org/wiki/xacro">

<!-- PROPERTY LIST -->
<xacro:property name="M_PI" value="3.1415926"/>
<xacro:property name="base_radius" value="0.20"/>
<xacro:property name="base_length" value="0.16"/>

<xacro:property name="wheel_radius" value="0.06"/>
<xacro:property name="wheel_length" value="0.025"/>
<xacro:property name="wheel_joint_y" value="0.19"/>
<xacro:property name="wheel_joint_z" value="0.05"/>

<xacro:property name="caster_radius" value="0.015"/> <!-- wheel_radius - ( base_length/2 - wheel_joint_z) -->
<xacro:property name="caster_joint_x" value="0.18"/>

<!-- Defining the colors used in this robot -->
<material name="yellow">
<color rgba="1 0.4 0 1"/>
</material>
<material name="black">
<color rgba="0 0 0 0.95"/>
</material>
<material name="gray">
<color rgba="0.75 0.75 0.75 1"/>
</material>

<!-- Macro for robot wheel -->
<xacro:macro name="wheel" params="prefix reflect">
<joint name="${prefix}_wheel_joint" type="continuous">
<origin xyz="0 ${reflect*wheel_joint_y} ${-wheel_joint_z}" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="${prefix}_wheel_link"/>
<axis xyz="0 1 0"/>
</joint>

<link name="${prefix}_wheel_link">
<visual>
<origin xyz="0 0 0" rpy="${M_PI/2} 0 0" />
<geometry>
<cylinder radius="${wheel_radius}" length = "${wheel_length}"/>
</geometry>
<material name="gray" />
</visual>
</link>
</xacro:macro>

<!-- Macro for robot caster -->
<xacro:macro name="caster" params="prefix reflect">

三 模型显示

方法一-------把xarco文件转换为urdf文件:

方法二----------直接调用xacro文件你解析器
在对应的launch文件中加入:

<arg name="model" default="$(find xacro)/xacro --inorder '$(find mbot_description)/urdf/xacro/mbot.xacro'" />
<arg name="gui" default="true" />

<param name="robot_description" command="$(arg model)" />

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐