debug 18
This commit is contained in:
parent
6821837465
commit
bd147b7b58
@ -1,32 +1,30 @@
|
|||||||
#ifndef _AG_Pbox_HPP_
|
#ifndef _AG_Pbox_HPP_
|
||||||
#define _AG_Pbox_HPP_
|
#define _AG_Pbox_HPP_
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <vector>
|
|
||||||
#include <memory>
|
|
||||||
#include <cstring>
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <netinet/in.h>
|
||||||
#include <sys/time.h>
|
|
||||||
#include <serial/serial.h>
|
#include <serial/serial.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "rclcpp/rclcpp.hpp"
|
#include <cmath>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "protocol_asensing.h"
|
|
||||||
#include "TinyLog.h"
|
#include "TinyLog.h"
|
||||||
|
#include "protocol_asensing.h"
|
||||||
|
#include "rclcpp/rclcpp.hpp"
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
using namespace serial;
|
using namespace serial;
|
||||||
|
|
||||||
|
#define UART_PORT "/dev/ttyTHS1"
|
||||||
#define UART_PORT "/dev/ttyUSB0"
|
|
||||||
#define UART_BAUDRATE (115200)
|
#define UART_BAUDRATE (115200)
|
||||||
|
|
||||||
class AGPbox : public rclcpp::Node
|
class AGPbox : public rclcpp::Node
|
||||||
@ -34,6 +32,7 @@ class AGPbox : public rclcpp::Node
|
|||||||
public:
|
public:
|
||||||
AGPbox();
|
AGPbox();
|
||||||
void init_pbox_node();
|
void init_pbox_node();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void timer_callback();
|
void timer_callback();
|
||||||
void openSerialPort();
|
void openSerialPort();
|
||||||
@ -41,6 +40,7 @@ class AGPbox : public rclcpp::Node
|
|||||||
|
|
||||||
void bindUdp();
|
void bindUdp();
|
||||||
void readUdp();
|
void readUdp();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* serial port info */
|
/* serial port info */
|
||||||
serial::Serial imu_ser;
|
serial::Serial imu_ser;
|
||||||
|
|||||||
@ -21,7 +21,7 @@ def generate_launch_description():
|
|||||||
# 连接类型:serial port:0 , UDP:1
|
# 连接类型:serial port:0 , UDP:1
|
||||||
# default: 0 serial port
|
# default: 0 serial port
|
||||||
{"ConnectionType": 0},
|
{"ConnectionType": 0},
|
||||||
# 串口设备串 defaule: /dev/ttyUSB0
|
# 串口设备串 defaule: /dev/ttyTHS1
|
||||||
{"UART_Port": "/dev/ttyTHS1"},
|
{"UART_Port": "/dev/ttyTHS1"},
|
||||||
# 串口波特率 default: 115200
|
# 串口波特率 default: 115200
|
||||||
{"UART_Baudrate": 115200},
|
{"UART_Baudrate": 115200},
|
||||||
|
|||||||
@ -59,7 +59,6 @@ void AGPbox::init_pbox_node()
|
|||||||
|
|
||||||
this->get_parameter("LogInfo",logInfo);
|
this->get_parameter("LogInfo",logInfo);
|
||||||
this->get_parameter("LogLevel",logLevel);
|
this->get_parameter("LogLevel",logLevel);
|
||||||
timer_ = this->create_wall_timer(1ms, std::bind(&AGPbox::timer_callback, this));
|
|
||||||
std::string path = "./ImuDebug.log";
|
std::string path = "./ImuDebug.log";
|
||||||
|
|
||||||
TinyLog::info("LogPathInfo: %s",logInfo.c_str());
|
TinyLog::info("LogPathInfo: %s",logInfo.c_str());
|
||||||
@ -84,6 +83,9 @@ void AGPbox::init_pbox_node()
|
|||||||
{
|
{
|
||||||
bindUdp();
|
bindUdp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 创建定时器(在串口/UDP打开之后)
|
||||||
|
timer_ = this->create_wall_timer(1ms, std::bind(&AGPbox::timer_callback, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AGPbox::timer_callback()
|
void AGPbox::timer_callback()
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
## pbox_node_dirve ROS2 使用方法
|
## pbox_node_dirve ROS2 使用方法
|
||||||
|
|
||||||
### 编译
|
### 编译
|
||||||
@ -35,7 +34,7 @@ ros2 topic echo /Imu04
|
|||||||
| 参数 | 说明 | 默认值 |
|
| 参数 | 说明 | 默认值 |
|
||||||
| ------------------ | ---------------------- | ------------- |
|
| ------------------ | ---------------------- | ------------- |
|
||||||
| `ConnectionType` | 0=串口, 1=UDP | 1 |
|
| `ConnectionType` | 0=串口, 1=UDP | 1 |
|
||||||
| `UART_Port` | 串口设备 | /dev/ttyUSB0 |
|
| `UART_Port` | 串口设备 | /dev/ttyTHS1 |
|
||||||
| `UART_Baudrate` | 波特率 | 230400 |
|
| `UART_Baudrate` | 波特率 | 230400 |
|
||||||
| `UDP_Addr` | UDP地址 | 192.168.225.2 |
|
| `UDP_Addr` | UDP地址 | 192.168.225.2 |
|
||||||
| `UDP_Port` | UDP端口 | 12300 |
|
| `UDP_Port` | UDP端口 | 12300 |
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user