电控船驱动程序(2)

测试船体运动正常与否,先设计一个遥控船的运动模型。

1. 通过订阅键盘的遥控信息。

2. 通过串口向stm32向下发送速度信息使船完成遥控运动。

serail包 https://github.com/wjwwood/serial

//xx  20190407
#include <ros/ros.h>
#include <geometry_msgs/Twist.h>

#include "serial/serial.h"
#include<unistd.h>    //延时  
//xx
#include <xx_msgs/Flag.h>


float linear_vel=0.0,angular_vel=0.0;
union floatData  //用于char数组与float之间的转换
{
  float f;  
  unsigned char data[4];
}chaun_linear_vel_send,chuan_angular_vel_send,tuolian_state_send;

  // 0x0d   "/r" 字符
  // 0x0a   "/n" 字符
  //{0x0,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x0d,0x0a};
unsigned char send_buf[14]={0x00,0x00,0x00,0x00,   //线速度 4个字节
                            0x00,0x00,0x00,0x00,   //角速度
                            0x00,0x00,0x00,0x00,   //拖链标志
                            0x0d,0x0a};   // "/r/n"

void chuan_vel_callback(const geometry
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值