在RVIZ中启动移动机器人模型,并实现横向移动

(转载请注明作者和出处:https://yangningbocn.github.io 未经允许请勿用于商业用途)
本博客只是个人学习记录使用,瞎写写,内容比较粗糙。编写过程中,借鉴了古月居大神的smartcar和ROS-WIKI以及其它一些大神的内容。

引入古月居大神的链接使用smartcar进行仿真smartcar源码上传

下面我针对自己的机器人编写的代码和文件。

launch文件

<launch>  

    <param name="/use_sim_time" value="false" />  

 

    <!-- Load the URDF/Xacro model of our robot -->  

    <arg name="urdf_file" default="$(find xacro)/xacro.py '$(find smartcar_description)/urdf/smartcar.urdf.xacro'" />  

    <arg name="gui" default="true" />  
    <param name="robot_description" command="$(arg urdf_file)" />  
    <param name="use_gui" value="$(arg gui)"/>  
    <node name="arbotix" pkg="arbotix_python" type="arbotix_driver" output="screen">  
        <rosparam file="$(find smartcar_description)/config/smartcar_arbotix.yaml" command="load" /> 
        <param name="sim" value="true"/>  
    </node>  

    <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" >  

    </node>  

    <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher">  

        <param name="publish_frequency" type="double" value="20.0" />  

    </node>  

 

     <!-- We need a static transforms for the wheels -->  

     <node pkg="tf" type="static_transform_publisher" name="odom_left_wheel_broadcaster" args="0 0 0 0 0 0 /base_link /left_front_link 100" />  

     <node pkg="tf" type="static_transform_publisher" name="odom_right_wheel_broadcaster" args="0 0 0 0 0 0 /base_link /right_front_link 100" />  
 

    <node name="rviz" pkg="rviz" type="rviz" args="-d $(find smartcar_description)/urdf.rviz" />  

</launch>

xacro文件包括三部分:

  1. smartcar_body
<?xml version="1.0"?>  
<robot name="smartcar" xmlns:xacro="http://ros.org/wiki/xacro">  
  <xacro:property name="M_PI" value="3.14159"/>    
  <!-- Macro for SmartCar body. Including Gazebo extensions, but does not include Kinect -->  
  <xacro:include filename="$(find smartcar_description)/urdf/gazebo.urdf.xacro"/>  
  <xacro:property name="base_x" value="0.33" />  
  <xacro:property name="base_y" value="0.33" />  
  <xacro:macro name="smartcar_body">  
    <link name="base_footprint">
      <inertial>
        <mass value="0.0001" />
        <origin xyz="0 0 0" />
        <inertia ixx="0.0001" ixy="0.0" ixz="0.0"
            iyy="0.0001" iyz="0.0" 
            izz="0.0001" />
      </inertial>
      <visual>
          <origin xyz="0 0 0" rpy="0 0 0" />
          <geometry>
              <box size="0.001 0.001 0.001" />
          </geometry>
      </visual>
    </link>


    <joint name="base_footprint_joint" type="fixed">
      <origin xyz="0 0 0" rpy="0 0 0" />
      <parent link="base_footprint"/>
      <child link="base_link" />
    </joint>


    <link
    name="base_link">
    <inertial>
      <origin
        xyz="0.0032273 -0.060593 1.3595E-05"
        rpy="0 0 0" />
      <mass
        value="4.2623" />
      <inertia
        ixx="0.04568"
        ixy="-0.00094545"
        ixz="-8.9814E-06"
        iyy="0.11402"
        iyz="5.3399E-06"
        izz="0.11035" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0.23"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://smartcar_description/meshes/base_link.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="1 1 1 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0.23"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://smartcar_description/meshes/base_link.STL" />
      </geometry>
    </collision>
  </link>
  <link
    name="left_front_wheel">
    <inertial>
      <origin
        xyz="0 -1.98217916108356E-05 0"
        rpy="0 0 0" />
      <mass
        value="0.176438810476987" />
      <inertia
        ixx="8.8965933887671E-05"
        ixy="-1.27636183461175E-23"
        ixz="8.0831821149659E-23"
        iyy="8.89898462049031E-05"
        iyz="2.16519665002917E-23"
        izz="0.000130905430632044" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geome
  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
CREATE TABLE `boshi_personalcenter` ( `PersonalCenterId` int(11) NOT NULL COMMENT '(id)', `PersonalCenterIntegral` int(11) DEFAULT NULL COMMENT '(个人积分)', `PersonalCenterSZ` varchar(300) DEFAULT NULL COMMENT '(身份证正面)', `PersonalCenterSF` varchar(300) DEFAULT NULL COMMENT '(身份证反面)', `PersonalCenterXZ` varchar(300) DEFAULT NULL COMMENT '(学生证正面)', `PersonalCenterXF` varchar(300) DEFAULT NULL COMMENT '(学生证反面)', `PersonalCenterCredit` int(11) DEFAULT NULL COMMENT '(信用度)', KEY `PersonalCenterId` (`PersonalCenterId`), CONSTRAINT `boshi_personalcenter_ibfk_2` FOREIGN KEY (`PersonalCenterId`) REFERENCES `user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Data for the table `boshi_personalcenter` */ insert into `boshi_personalcenter`(`PersonalCenterId`,`PersonalCenterIntegral`,`PersonalCenterSZ`,`PersonalCenterSF`,`PersonalCenterXZ`,`PersonalCenterXF`,`PersonalCenterCredit`) values (1,10,'tu','tu','tu','tu',100),(2,20,'tu','tu','tu','tu',100),(3,30,'tu','tu','tu','tu',100),(1,50,'身份证正面','身份证反面','学生证正面','学生证反面',10),(1,50,'身份证正面','身份证反面','学生证正面','学生证反面',10),(1,50,'身份证正面','身份证反面','学生证正面','学生证反面',10); /*Table structure for table `boshi_profile` */ DROP TABLE IF EXISTS `boshi_profile`; CREATE TABLE `boshi_profile` ( `ProfilePeoId` int(11) DEFAULT NULL COMMENT '(用户ID信息) 外键', `ProfileName` varchar(300) DEFAULT NULL COMMENT '(姓名)', `ProfilePhp` varchar(300) DEFAULT NULL COMMENT '(联系方式)', `ProfileAddress` varchar(300) DEFAULT NULL COMMENT '(地址)', `ProfileId` int(11) NOT NULL AUTO_INCREMENT COMMENT '(地址id)', PRIMARY KEY (`ProfileId`), KEY `ProfilePeoId` (`ProfilePeoId`), CONSTRAINT `boshi_profile_ibfk_1` FOREIGN KEY (`ProfilePeoId`) REFERENCES `user` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; /*Data for the table `boshi_profile` */ insert into `boshi_profile`(`ProfilePeoId`,`ProfileName`,`ProfilePhp`,`ProfileAddress`,`ProfileId`) values (2,'赵六','1366663435','合肥',2),(2,'斩三','13214326346','合肥',5),(2,'李四','12334453654','北大青鸟',6),(2,'李四','1888555555','包河区',7),(2,'赵六','1366663435','合肥',8),(2,'赵六','12354697883','上海市',9),(2,'赵六','12354697883','上海市',10),(2,'赵六','12354697883','上海市',11),(1,'张三','17776462665','合肥市包河区',12),(1,'王五','1423534534654','合肥市',13),(2,'赵六','1366663435','合肥',14),(1,'赵六','17776462665','北大青鸟',20); /*Table structure for table `boshi_putaway` */ DROP TABLE IF EXISTS `boshi_putaway`;

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值