资源简介
基于ROS环境,开发针对pioneer 3 先锋多机器人控制的程序。内容包括如何构建ROS、RosAria环境,及针对Pioneer 3的单个、多个机器人控制程序,并附带简单例程。
代码片段和文件信息
/**************************************************************************
Date: 16 Feb. 2014
File: android_teleop.cpp
Function: use your Android phone to control the robot
Description:
1) http://wiki.ros.org/ROSARIA/Tutorials/iPhone%20Teleop%20with%20ROSARIA/Android%20teleop%20Pioneer%203at
2) you need to download ROS Sensor Drive to your phone
**************************************************************************/
#include
#include “geometry_msgs/Twist.h“
#include “rosaria/BumperState.h“
#include “sensor_msgs/Imu.h“
#include
#include
using geometry_msgs::Twist;
using namespace std;
ros::Publisher vel_pub;
ros::Time t1;
Twist vel;
int kfd = 0;
struct termios cooked raw;
unsigned int temp=0;
float x;
float y;
float z;
void quit(int sig)
{
tcsetattr(kfd TCSANOW &cooked);
ros::shutdown();
exit(0);
}
void anCallback(const sensor_msgs::Imu::ConstPtr& ansmsg)
{
x=ansmsg->angular_velocity.x;
y=ansmsg->angular_velocity.y;
z=ansmsg->angular_velocity.z;
}
int main(int argc char** argv)
{
int ther=3;
ros::init(argc argv “android_teleop“);
ros::NodeHandle n;
vel_pub = n.advertise(“/RosAria/cmd_vel“ 1);
signal(SIGINTquit);
ros::Rate r(5);
char c;
bool dirty=false;
t1=ros::Time::now();
tcgetattr(kfd &cooked);
memcpy(&raw &cooked sizeof(struct termios));
raw.c_lflag &=~ (ICANON | ECHO);
raw.c_cc[VEOL] = 1;
raw.c_cc[VEOF] = 2;
tcsetattr(kfd TCSANOW &raw);
//subscribe to android imu sensor msgs
ros::Subscriber imu_pub = n.subscribe(“/android/imu“ 1 anCallback);
while (ros::ok())
{
if(x > ther)
{
vel.linear.x = 0.2;
vel.linear.y=0;
vel.linear.z=0;
vel.angular.x = 0;
vel.angular.y = 0;
vel.angular.z = 0;
ROS_INFO(“forward“);
}
if(x < -ther)
{
vel.linear.x = -0.2;
vel.linear.y=0;
vel.linear.z=0;
vel.angular.x = 0;
vel.angular.y = 0;
vel.angular.z = 0;
ROS_INFO(“Backward“);
}
if(z > ther)
{
vel.linear.x = 0;
vel.linear.y=0;
vel.linear.z=0;
vel.angular.x = 0;
vel.angular.y = 0;
vel.angular.z = 0.5;
ROS_INFO(“Turnleft“);
}
if(z < -ther)
{
vel.linear.x = 0;
vel.linear.y=0;
vel.linear.z=0;
vel.angular.x = 0;
vel.angular.y = 0;
vel.angular.z = -0.5;
ROS_INFO(“Turnright“);
}
if(y < -ther)
{
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3609 2014-08-18 08:28 pioneer3_control_ros-master\android_teleop.cpp
文件 27591 2014-08-18 08:28 pioneer3_control_ros-master\AriaRobot.h
文件 1179 2014-08-18 08:28 pioneer3_control_ros-master\cfg\RosAria.cfg
文件 5055 2014-08-18 08:28 pioneer3_control_ros-master\CMakeLists.txt
....... 56 2014-08-18 08:28 pioneer3_control_ros-master\msg\BumperState.msg
文件 2255 2014-08-18 08:28 pioneer3_control_ros-master\p3_kinect.cpp
文件 4550 2014-08-18 08:28 pioneer3_control_ros-master\p3_sonar.cpp
文件 11307 2017-10-18 11:35 pioneer3_control_ros-master\p3_sonar_following_moving_ob
文件 2094 2014-08-18 08:28 pioneer3_control_ros-master\package.xm
文件 487293 2014-08-18 08:28 pioneer3_control_ros-master\pioneer3_control_ros_18AUG14.pdf
文件 1295 2014-08-18 08:28 pioneer3_control_ros-master\readme.txt
文件 738 2014-08-18 08:28 pioneer3_control_ros-master\robotDemo.cpp
文件 913 2014-08-18 08:28 pioneer3_control_ros-master\robotWander.cpp
文件 2365 2014-08-18 08:28 pioneer3_control_ros-master\rob_key.cpp
文件 13451 2014-08-18 08:28 pioneer3_control_ros-master\rob_key_multi_robot_con_separately.cpp
文件 622 2014-08-18 08:28 pioneer3_control_ros-master\RosAria.cpp
文件 22962 2014-08-18 08:28 pioneer3_control_ros-master\RosAria_original.cpp
文件 2642 2014-08-18 08:28 pioneer3_control_ros-master\rosRemoteTest.launch
文件 972 2014-08-18 08:28 pioneer3_control_ros-master\test_cmd.cpp
文件 1443 2014-08-18 08:28 pioneer3_control_ros-master\test_record_data.cpp
目录 0 2014-08-18 08:28 pioneer3_control_ros-master\cfg
目录 0 2014-08-18 08:28 pioneer3_control_ros-master\msg
目录 0 2017-03-27 11:17 pioneer3_control_ros-master\pioneer3_control_ros-master
目录 0 2017-03-27 11:17 pioneer3_control_ros-master
----------- --------- ---------- ----- ----
592392 24
- 上一篇:STM32数字示波器制作资料PCB原理图源程序
- 下一篇:用于已知卫星坐标的定位
相关资源
- ROS开源机器人控制基础-源程序-百度云
- ROS的indigo最新 smartcar代码
- ROS下同时存储Kinect 深度和RGB图 代码包
- probability-sheldon-ross-solution-manual.pdf
- ROS 6.x+7.x L6 授权
- 在ROS中与其他器件使用十六进制串口
- 镭神激光雷达驱动LS01C_ROS完整文件包
- Microsoft Loopback Adapter Cracked x64 AMD64
- 多机器人编队控制
- Microsoft.Practices.ServiceLocation
- 最简单方便的ROSDDNS动态域名脚本
- Bentley Microstation V8i (SELECTSeries 4)
- RationalRose2007 直接使用版
- 新建 Microsoft Word 文档.docx
- 常见wifi电路设计
- 基于欧几里德聚类的障碍物检测ROS实
- 推荐的ros学习方法和较好教程书籍.
- Microsoft Root Certification 2010&2011解决VS
- ROS读取键盘通过串口控制电机例程
- Microsoft.Office.Interop.Graph.dll
- 机器人在ros下的KCF跟踪算法实现
- 基于 ROS 与 Kinect 的移动机器人同时定
- ZeroServer_2
- ZeroServer_1 界面图标
- ZeroServer_01
- 用于rosserial-stm32的库RosLibs
- Microsoft ACPI Source Language (ASL) Compi
- HOKUYO日本北洋URG-04LX激光雷达用户手册
- Microsoft.ReportViewer.WebForms.dll (11.0)
- org.eclipse.cdt.cross.arm.gnu_0.5.3.2010073118
评论
共有 条评论