|
@@ -13,32 +13,18 @@
|
|
|
|
|
|
#include "gnss_coordinate_convert.h"
|
|
|
|
|
|
-static std::string _point_topic = "/points_raw";
|
|
|
-static std::string _point_msgname = "lidar_pc";
|
|
|
-
|
|
|
-static std::string _image_topic = "/image_raw";
|
|
|
-static std::string _image_msgname = "picfront";
|
|
|
-
|
|
|
-static std::string _odom_topic = "/odom";
|
|
|
-static std::string _odom_msgname = "odom";
|
|
|
-
|
|
|
-static std::string _waypoints_topic = "/final_waypoints";
|
|
|
-static std::string _waypoints_msgname = "waypoints";
|
|
|
-
|
|
|
static std::string _pose_topic = "/current_pose";
|
|
|
static std::string _twist_topic = "/current_velocity";
|
|
|
|
|
|
static std::string gstrserialportname = "/dev/ttyUSB0";
|
|
|
|
|
|
-ros::Publisher pose_pub;
|
|
|
-ros::Publisher twist_pub;
|
|
|
-
|
|
|
+static int gnBaudRate = 230400;
|
|
|
static double glon0 = 117;
|
|
|
static double glat0 = 39;
|
|
|
static double ghead0 = 0;
|
|
|
|
|
|
-static bool _use_rtk_odom = true; //if use rtk , use_rtk_odom is true;
|
|
|
-static bool _use_pilot_waypoints = true; //if use pilot to calculate waypoints, this is true
|
|
|
+ros::Publisher pose_pub;
|
|
|
+ros::Publisher twist_pub;
|
|
|
|
|
|
QString mstrHCP2;
|
|
|
|
|
@@ -305,7 +291,7 @@ void SerialGPSDecodeSen(QString strsen)
|
|
|
|
|
|
msg.twist.twist.linear.x = sqrt(pow(vn,2)+pow(ve,2));
|
|
|
|
|
|
- geometry_msgs::PoseStamped xPose;
|
|
|
+ geometry_msgs::PoseStamped xPose;
|
|
|
xPose.pose = msg.pose.pose;
|
|
|
geometry_msgs::TwistStamped xtwist;
|
|
|
xtwist.twist = msg.twist.twist;
|
|
@@ -313,15 +299,13 @@ void SerialGPSDecodeSen(QString strsen)
|
|
|
pose_pub.publish(xPose);
|
|
|
twist_pub.publish(xtwist);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
void ThreadRecvRTK()
|
|
|
{
|
|
|
QSerialPort *m_serialPort_GPS;
|
|
|
+ m_serialPort_GPS = new QSerialPort();
|
|
|
m_serialPort_GPS->setPortName(gstrserialportname.data());
|
|
|
m_serialPort_GPS->setBaudRate(230400);
|
|
|
m_serialPort_GPS->setParity(QSerialPort::NoParity);
|
|
@@ -364,30 +348,28 @@ int main(int argc, char *argv[])
|
|
|
ros::init(argc, argv, "pilottoros");
|
|
|
// ros::NodeHandle n;
|
|
|
ros::NodeHandle private_nh("~");
|
|
|
- ros::Rate loop_rate(1);
|
|
|
+ ros::Rate loop_rate(100);
|
|
|
|
|
|
|
|
|
- private_nh.getParam("points_node",_point_topic);
|
|
|
- private_nh.getParam("points_msgname",_point_msgname);
|
|
|
- std::cout<<"_point_topic is "<<_point_topic<<std::endl;
|
|
|
- std::cout<<"_point_msgname : "<<_point_msgname<<std::endl;
|
|
|
+ private_nh.getParam("pose_topic",_pose_topic);
|
|
|
+ private_nh.getParam("twist_topic",_twist_topic);
|
|
|
+ std::cout<<"pose_topic is "<<_pose_topic<<std::endl;
|
|
|
+ std::cout<<"twist_topic : "<<_twist_topic<<std::endl;
|
|
|
|
|
|
- private_nh.getParam("image_node",_image_topic);
|
|
|
- private_nh.getParam("image_msgname",_image_msgname);
|
|
|
- std::cout<<"_image_topic is "<<_image_topic<<std::endl;
|
|
|
- std::cout<<"_image_msgname : "<<_image_msgname<<std::endl;
|
|
|
+ private_nh.getParam("PortName",gstrserialportname);
|
|
|
+ std::cout<<"Port Name : "<<gstrserialportname<<std::endl;
|
|
|
|
|
|
- private_nh.getParam("waypoints_node",_waypoints_topic);
|
|
|
- private_nh.getParam("waypoints_msgname",_waypoints_msgname);
|
|
|
- std::cout<<"_waypoints_topic is "<<_waypoints_topic<<std::endl;
|
|
|
- std::cout<<"_waypoints_msgname : "<<_waypoints_msgname<<std::endl;
|
|
|
+ private_nh.getParam("BaudRate",gnBaudRate);
|
|
|
+ std::cout<<"BaudRate : "<<gnBaudRate<<std::endl;
|
|
|
|
|
|
- private_nh.getParam("use_rtk_odom",_use_rtk_odom);
|
|
|
- private_nh.getParam("use_pilot_waypoints",_use_pilot_waypoints);
|
|
|
+ private_nh.getParam("Lon0",glon0);
|
|
|
+ std::cout<<"Lon0 : "<<glon0<<std::endl;
|
|
|
|
|
|
+ private_nh.getParam("Lat0",glat0);
|
|
|
+ std::cout<<"Lat0 : "<<glat0<<std::endl;
|
|
|
|
|
|
- pose_pub = private_nh.advertise<geometry_msgs::PoseStamped>(_pose_topic,10);
|
|
|
- twist_pub = private_nh.advertise<geometry_msgs::TwistStamped>(_twist_topic,10);
|
|
|
+ pose_pub = private_nh.advertise<geometry_msgs::PoseStamped>(_pose_topic,10);
|
|
|
+ twist_pub = private_nh.advertise<geometry_msgs::TwistStamped>(_twist_topic,10);
|
|
|
|
|
|
|
|
|
std::thread * pthread = new std::thread(ThreadRecvRTK);
|