ROS机器人项目开发11例-ROS Robotics Projects(5)深度学习

本文介绍在ROS中集成深度学习算法的方法,重点讨论了物体识别应用。涵盖了多种深度学习框架(如TensorFlow、Theano等)与ROS结合的技术细节,并通过三个实际案例展示了如何在机器人系统中实现深度学习的应用。
部署运行你感兴趣的模型镜像

这是本书的第7章,主要介绍在ROS集成深度学习算法,用于物体识别等。

首先给出一些参考资料:

1 如何自学深度学习并少走弯路:https://www.leiphone.com/news/201611/cWf2B23wdy6XLa21.html

2 八大深度学习的开源框架:https://www.leiphone.com/news/201608/5kCJ4Vim3wMjpBPU.html

这里简单介绍4种,书中介绍了TensorFlow的详细配置和基本使用。

1. TensorFlow

参考:

1 使用ROS和TensorFlow:http://blog.exbot.net/archives/3074

2 Tensorflow_in_ROS:https://github.com/shunchan0677/Tensorflow_in_ROS

3 Cherry-Autonomous-Racecar:https://github.com/DJTobias/Cherry-Autonomous-Racecar

4 jetson-car:https://github.com/dat-ai/jetson-car 

 

2. theano

参考:

1 A package for ROS that performs semantic segmentation on NYU dataset using Theano framework:

https://github.com/amanrajdce/ROS-package-for-Semantic-Segmentation

 

3. torch

参考:

1 torch-ros:https://github.com/Xamla/torch-ros

2 torch-moveit:https://github.com/Xamla/torch-moveit

3 torch-swarm:https://github.com/RobbieHolland/SwarmbotGazebo-DQN

 

4. Caffe

之前的博文也提到过类似的使用笔记,可以参考。

参考:

1 ros-caffe:https://github.com/tzutalin/ros_caffe

2 web-caffe-ros:https://github.com/ykoga-kyutech/caffe_web

 

最后,分享三个使用ROS和深度学习的有趣的开源案例:

----https://github.com/yao62995/AS_6Dof_Arm

robot arm by ROS & Moveit, Train Deep Reinforcement Algorithms

 

Gazebo 展示

Gazebo

Real环境展示

Real Environment

URDF描述文件

  • 机械臂相关描述文件位于 as_arm_description/urdf 目录中
    • as_arm.xacro 为机械臂描述文件
    • camera.xacro 摄像机和机架描述文件
    • sink.xacro 物品槽描述文件

Launch启动相关命令:

  • 启动gazebo仿真环境:

    • roslaunch as_arm_gazebo as_arm_bringup.launch
  • 启动moveit Demo:

    • roslaunch as_arm_moveit_config demo.launch
  • 启动grasp 生成器

    • roslaunch as_arm_gazebo grasp_generator_server.launch
  • 查看摄像头图像:

    • rosrun image_view image_view image:=/camera/image_raw
  • 控制某个joint移动角度:

    • rostopic pub -1 /rrbot/joint1_position_controller/command std_msgs/Float64 "data: 1.5"
  • 获取cube位置

    • rostopic echo -n 1 /gazebo/cubes
  • 获取joint位置:

    • rostopic echo -n 1 /as_arm/joint_states
  • 获取某个link(如end effector)的世界坐标

    • rosrun tf tf_echo /world /grasp_frame_link

碰撞检测相关

  • 碰撞检测包含self-collision和environment-collision两种,相关文件如下:
    • Service描述文件: as_arm_description/srv/CheckCollisionValid.srv
    • Service服务文件(需要在catkin环境编译): as_arm_control/src/check_collision.cpp

仿真环境运行:

  • 相关控制脚本位于 _as_arm_control/test/_目录中

    • 抓取脚本: pick_and_place.py
    • moveit运动规划: test_planner.py
  • 控制gazebo joint角度:

      rostopic pub -1 /as_arm/joint1_position_controller/command std_msgs/Float64 "data: 0"
      rostopic pub -1 /as_arm/joint2_position_controller/command std_msgs/Float64 "data: 0.2834"
      rostopic pub -1 /as_arm/joint3_position_controller/command std_msgs/Float64 "data: -0.9736"
      rostopic pub -1 /as_arm/joint4_position_controller/command std_msgs/Float64 "data: -1.4648"
      rostopic pub -1 /as_arm/joint5_position_controller/command std_msgs/Float64 "data: 0"
      rostopic pub -1 /as_arm/joint6_position_controller/command std_msgs/Float64 "data: -0.015"
      rostopic pub -1 /as_arm/joint7_position_controller/command std_msgs/Float64 "data: 0.015"
    
  • 控制gazebo cube位置:

      rostopic pub -1 /gazebo/set_link_state gazebo_msgs/LinkState "{link_name: cube1, pose: {position: {x: -0.2, y: 0, z: 1.0}, orientation: {x: 0,y: 0, z: 0, w: 1.0}}, twist: {}, reference_frame: world}"
    

真实环境运行:

  • arduino 文件在 as_arm_real/data/servo_v4.0.ino
  • 启动real节点,控制真实机械臂运动:
    • roslaunch as_arm_real servo_bringup_real.launch
  • 启动gazebo仿真环境后,运行控制脚本 as_arm_real/scripts/
    • 真实环境与仿真环境机械臂同步随机运动: random_run_drive.py
    • 真实环境与仿真环境机械手同步运动: run_gripper_driver.py
    • 抓取脚本(调用ompl IK算法): pick_and_place.py

深度增强学习训练:

  • 训练脚本位于 as_arm_control/scripts/ 目录中
    • gazebo仿真环境控制和状态获取脚本: simulate_state.py
    • DDPG算法脚本(TF实现): ddpg.py
    • 仿真环境Agent接口: asm_env.py
    • 训练脚本:learning.py

更新日志 2016-11-24

  • 更改actor 网络的输出层:
    • 目前actor网络的输出的5个joint的移动角度值,增加一个输出表示cube是否在gripper的抓取范围
    • 更改actor网络输出层范围区间为[-4, 4]之间的整数
  • 更改reward计算函数 = exp(-1 * γ * dist(cube, gripper))
  • 调整摄像头视野,增加摄像头数量,组成双目摄像头
    • 提高距离感知,同时避免cube被机械臂遮挡
  • 更改噪音生成函数OuNoice的参数,防止过拟合,探索更多运动空间。
  • 训练阶段:
    • 第一阶段:一个cube,且cube初始位置不变,gripper初始位置为PreGrasp
    • 第二阶段:一个cube,且cube初始位置可变,gripper初始位置为PreGrasp
    • 第三阶段:多个cube,且cube初始位置可变,gripper初始位置为UpRight

更新日志 2016-11-17

  • 碰撞处理
    • 产生碰撞时每个关节随机选择某个(-4,4)的角度范围,并检测碰撞,直到没有检测到碰撞时执行该action
  • ddpg actor网络处理
    • 输出层更新为action_dim * 3,再reshape为(action_dim, 3),执行arg_max操作得到5个范围在[0, 2]的整数,再-1得到[-1, 1]的整数作为机械臂的输出action
  • arm 和 gripper分开处理
    • 5个arm joint 和 2个gripper joint,训练网络时只控制5个arm joint。当检测到gripper_frame和cube_pose的距离小于最小阈值时视为到达目标,执行抓取任务,并将cube物体attach到gripper上。
  • 针对gazebo中机械臂执行操作的震荡问题处理
    • 调整joint的PID参数保证快速平滑性
    • 调整link的质量属性和惯性属性,减少惯性
  • 针对gazebo joint command在话题队列中丢失的处理:
    • 增加joint command的queue队列大小,同时调整训练速度,协调与joint command执行速度的频率
  • gazebo/ros/moveit的交互通信
    • gazebo 回传摄像头图片,moveit检测碰撞,ros协调通信。涉及end effector、cube、arm_joints、gripper_joints的控制和状态信息。
    • joint相关的话题:"/joint_states"设置rviz的joints角度,"as_arm/joint_states"获取当前joints角度,"as_arm/joints_position_controller/command"设置gazebo的joints角度
    • cube相关的话题:"/gazebo/cubes"获取cube位姿, "/gazebo/set_link_state"设置cube位姿。
    • cube在moveit中使用scene.add_box()生成并与gazebo中的cube同步
  • 摄像头视野和位置的调整
  • 更改actor 网络的输出层:(Todo)
    • 目前actor网络的输出的5个joint的移动角度值,增加一个输出表示cube是否在gripper的抓取范围

 

 

 

----https://github.com/AbhiRP/Autonomous-Robot-Navigation-using-Deep-Learning-Vision-Landmark-Framework

Autonomous Robot Navigation using Tensorflow Incpetion V3 Image Recognition Engine and Robot Operating System (ROS)

 

Autonomous-Robot-Navigation-using-Deep-Learning-Vision-Landmark-Framework

Abstract:

 

Robot navigation requires specific techniques for guiding a mobile robot to a desired destination. In general, a desired path is required in an environment described by different terrain and a set of distinct objects, such as obstacles and particular landmarks. In this project, a new approach for autonomous navigation is presented using machine learning techniques such as Convolutional Neural Network to identifymarkers from images and Robot Operating System and Object Position Discovery system to navigate towards these markers.

Hardware:

  1. Yujin Robot Kobuki TurtleBot 2 http://kobuki.yujinrobot.com/
  2. Asus Xtion PRO RGB-D Camera https://www.asus.com/3D-Sensor/Xtion_PRO/
  3. ODROID-XU4 Octa Core ARM Microcomputer http://www.hardkernel.com/main/main.php

Software:

  1. Ubuntu 14.04 Trusty Tahr http://releases.ubuntu.com/14.04/
  2. Robot Operating System (ROS) Indigo http://wiki.ros.org/indigo/Installation
  3. TensorFlow https://www.tensorflow.org/install/
  4. ImageNet Dataset http://www.image-net.org/

ROS Package:

  1. openni2_launch http://wiki.ros.org/openni2_launch
  2. depthimage_to_laserscan http://wiki.ros.org/depthimage_to_laserscan

Documentation:

This project is documented as follows:

  1. Project Overview
  2. Algorithm
  3. Experimental Setup
  4. Project Implementation
  5. Experimental Results

Video of this project is available at https://youtu.be/UOC4PvreTG4

 

----https://github.com/elggem/tensorflow_node

 

Tensorflow based ROS node for evaluating deep learning algorithms.

 

tensorflow_node

 

<hidden..Build Status>

This is a tensorflow based framework for evaluating deep learning algorithms and streaming internal believe states out via ROS. It aims to be a flexible implemention that can be modified and inspected during runtime on live stream data. Eventually it will be used in conjunction with the OpenCog framework for integrated Artificial General Intelligence.

  • This code is under heavy development and used for research purposes, so handle with care!

Documentation

You can find documentation on the wiki tab. There are references for the network architecture and some high-level descriptions on how it works.

Participate

I've put todos and remaining tasks in the projects tab on Github. Feel free to collaborate or contact me if you have any suggestions!

I want to run it!

Clone the repo into your catkin workspace, make it and run

roslaunch tensorflow_node mnist.launch

TF summaries are being written to outputs/summaries, if enabled in the config file, and they can be inspected via this command:

rosrun tensorflow_node tensorboard

 

----

 

您可能感兴趣的与本文相关的镜像

TensorFlow-v2.15

TensorFlow-v2.15

TensorFlow

TensorFlow 是由Google Brain 团队开发的开源机器学习框架,广泛应用于深度学习研究和生产环境。 它提供了一个灵活的平台,用于构建和训练各种机器学习模型

### 关于ROS机器人项目开发中的送货机器人教程 在ROS机器人开发中,送货机器人是一个常见的应用场景。这类机器人通常涉及自主导航、路径规划、避障以及与环境交互等功能。以下是基于提供的参考资料和专业知识的回答。 #### 自主导航与路径规划 送货机器人需要具备自主导航能力,这可以通过使用`move_base`包实现[^2]。该包集成了全局路径规划器和局部路径规划器,能够帮助机器人避开障碍物并到达目标位置。具体来说: - **地图创建**:通过SLAM(Simultaneous Localization and Mapping)技术生成室内环境的地图。常用的SLAM算法有GMapping和 Hector SLAM。 - **路径规划**:利用Dijkstra或A*等算法计算最优路径。这些功能由`navfn`或`global_planner`插件提供支持[^3]。 ```bash # 启动导航节点 roslaunch turtlebot_navigation amcl_demo.launch map_file:=/path/to/map.yaml ``` #### 避障与传感器融合 为了实现实时避障,送货机器人通常配备激光雷达(Lidar)、超声波传感器或深度摄像头。数据处理流程如下: - 使用`laser_scan_matcher`将二维激光扫描转换为三维点云。 - 将点云输入至`costmap_2d`模块,动态更新代价地图以反映当前环境中存在的障碍物。 ```yaml local_costmap: plugins: - {name: obstacle_layer, type: "costmap_2d::ObstacleLayer"} - {name: inflation_layer, type: "costmap_2d::InflationLayer"} ``` #### 用户交互界面 为了让人类用户更方便地控制送货机器人,可以设计图形化用户接口(GUI)或者语音命令系统。如,在Qt Creator中编写自定义的应用程序来显示机器人的状态信息,并允许发送目的地坐标给导航堆栈[^4]。 ```cpp // Qt信号槽机制示 connect(ui->sendButton, &QPushButton::clicked, this, [=]() { std_msgs::String msg; msg.data = ui->destinationLineEdit->text().toStdString(); pub.publish(msg); }); ``` #### 综合案推荐 根据上述知识点,《ROS Robotics By Example》一书提供了多个实用的子,其中包括如何搭建完整的移动平台和服务型机器人解决方案[^1]。此外,“Robotics Academy”网站也分享了一些免费课程资源,涵盖了从基础概念到高级主题的内容。 ---
评论 7
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

zhangrelay

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值