当前位置: 首页 > news >正文

多个域名URL转发到一个网站湖州网站建设制作

多个域名URL转发到一个网站,湖州网站建设制作,哪里有营销型网站,哪些网站的数据库做的好最近在做AGV改造项目,其中涉及到了odom—>base_link的坐标转换,那么odom即里程计信息主要由伺服电机自带的增量式编码器求取。 void ROSTCP::cal_pulse(int &current , int &receive , int &delta) {delta (receive - current);//* M_P…

最近在做AGV改造项目,其中涉及到了odom—>base_link的坐标转换,那么odom即里程计信息主要由伺服电机自带的增量式编码器求取。

void ROSTCP::cal_pulse(int &current , int &receive , int &delta)
{delta = (receive - current);//* M_PI * 0.2 / 200000.0;current = receive;
}
void ROSTCP::handle_speed_msg()
{cal_pulse(cur_left_ , recv_left_ , delta_left);      //左轮移动距离cal_pulse(cur_right_ , recv_right_ , delta_right);   //右轮移动距离   cout << "left: " << delta_left << "right: " << delta_right << endl;now_ = ros::Time::now();if(start_flag_){accumulation_x_ = accumulation_y_ = accumulation_th_ = 0.0;last_time_ = now_;start_flag_ = false;return; }delta_time = (now_ - last_time_).toSec();double dxy_ave = (delta_left + delta_right) * M_PI * wheel_diameter_/(2.0  * 200000);   // dxy_ave为左右轮的移动距离均值,认为是中心点的移动距离double dth = (delta_left - delta_right) / (wheel_track_ * 200000);      // dth 为通过为中心点的转动角度,通过弧长公式 θ = l / R double vxy = dxy_ave / delta_time;                  // V=vxy 为位移对时间的微分double vth = dth / delta_time;                      // vth 为角速度,为转动角度对时间的倒数cout << "dxy_ave: " << dxy_ave << "dth: " << dth << endl;double dx = cos(dth) * dxy_ave;                     //dx中心点处的位移在base_link坐标系xoy轴上的投影double dy = -sin(dth) * dxy_ave;                   //dy中心点处的位移在base_link坐标系xoy轴上的投影cout << "dx: " << dx << "  dy: " << dy << endl;cout << "cos(accumulation_th_) * dx - sin(accumulation_th_) * dy:" << cos(accumulation_th_) * dx - sin(accumulation_th_) * dy << endl;accumulation_x_ += (cos(accumulation_th_) * dx - sin(accumulation_th_) * dy); //将base_link坐标系转换到odom坐标系accumulation_y_ += (sin(accumulation_th_) * dx + cos(accumulation_th_) * dy);accumulation_th_ += dth;geometry_msgs::Quaternion odom_quat = tf::createQuaternionMsgFromYaw(accumulation_th_);transformStamped_.header.stamp = ros::Time::now();transformStamped_.header.frame_id = odom_frame_;transformStamped_.child_frame_id = base_frame_;transformStamped_.transform.translation.x = accumulation_x_;transformStamped_.transform.translation.y = accumulation_y_;transformStamped_.transform.translation.z = 0.0;//tf2::Quaternion q;//q.setRPY(0, 0, accumulation_th_);transformStamped_.transform.rotation = odom_quat;br_.sendTransform(transformStamped_);odom_.header.frame_id = odom_frame_;odom_.child_frame_id = base_frame_;odom_.header.stamp = now_;odom_.pose.pose.position.x = accumulation_x_;odom_.pose.pose.position.y = accumulation_y_;odom_.pose.pose.position.z = 0;//odom_.pose.pose.orientation = odom_quat;odom_.pose.pose.orientation.x = odom_quat.x;odom_.pose.pose.orientation.y = odom_quat.y;odom_.pose.pose.orientation.z = odom_quat.z;odom_.pose.pose.orientation.w = odom_quat.w;odom_.twist.twist.linear.x = vxy;odom_.twist.twist.linear.y = 0;odom_.twist.twist.angular.z = vth;odom_pub_.publish(odom_);cout<<"accumulation_x: " << accumulation_x_ << "; accumulation_y: " << accumulation_y_ <<"; accumulation_th: " << accumulation_th_<<endl;//}last_time_ = now_;
}


首先求取两个编码器的增量,用当前时刻收到的脉冲数减去上一时刻收到的脉冲数,delta_left为左轮脉冲增量,delta_right为右轮脉冲增量。

cal_pulse(cur_left_ , recv_left_ , delta_left);      //左轮移动距离
cal_pulse(cur_right_ , recv_right_ , delta_right);   //右轮移动距离  

设置初始值,假设odom初始时刻x方向移动0,y方向移动0,转动角度为0

if(start_flag_){accumulation_x_ = accumulation_y_ = accumulation_th_ = 0.0;last_time_ = now_;start_flag_ = false;return; }

计算时间间隔,用来求取速度等信息

delta_time = (now_ - last_time_).toSec();

求取左右轮中心点移动距离,根据两轮差速模型v = (vl + vr) / 2,即左轮速度加上右轮速度除2,

代码中wheel_diameter为车轮直径,M_PI*wheel_diameter为轮子周长,200000为轮子走一圈,编码器输出的脉冲数,所以M_PI*wheel_diameter/200000为编码器转动一个脉冲,轮子前进多少米。最后dxy_ave为左编码器增量脉冲与右编码器增量脉冲求取的中心点前进了多少米

double dxy_ave = (delta_left + delta_right) * M_PI * wheel_diameter_/(2.0  * 200000); 

http://www.tj-hxxt.cn/news/7682.html

相关文章:

  • 在猪八戒上做网站要注意什么微博推广
  • 三网合一网站怎么做站长工具忘忧草社区
  • 鲅鱼圈做网站国内最新新闻消息今天的
  • wordpress 不能换主题seo课
  • 一站式外贸服务平台网站设计需要什么
  • 东至网站制作百度推广代运营
  • 门户网站建设为企业带来的好处网站seo标题是什么意思
  • 合肥专业手机网站制作价格关键词搜索网站
  • 如何给网站做真实搜索点击seo网络公司
  • 网站建设后怎样发信息网站运营主要做什么工作
  • 怎么做网站赚钱seo站点
  • 网站优化方式旅游新闻热点
  • 用html制作简单购物网页seo外链友情链接
  • 凯里做网站的公司百度荤seo公司
  • 深圳做企业网站多少钱关键词怎么优化到百度首页
  • 民宿网站建设下载百度app到手机上
  • 搭建租号网的网站兰州网络推广关键词优化
  • 网站开发好学嘛网站seo优化技巧
  • 微商各种软件拿码渠道宁波好的seo外包公司
  • 做网站官网花生壳免费域名注册
  • 海南做网站电话制作小程序的软件
  • 织梦素材网站模板专门开发小程序的公司
  • html怎么设置网站吗互联网品牌的快速推广
  • 大街网企业招聘官网百度seo点击器
  • 网站视差滚动网络公司名字
  • 化妆品网站栏目策划seo关键词外包
  • 做外贸需要网站吗站长之家音效
  • 哪些网站可以做问卷国内十大搜索引擎
  • 网站和管理系统的区别seo顾问
  • 微信二维码网站建设百度收录时间