|
@@ -19,6 +19,7 @@
|
|
|
#include <nav_msgs/Odometry.h>
|
|
|
|
|
|
#include "autoware_msgs/VehicleCmd.h"
|
|
|
+#include "autoware_msgs/ControlCommandStamped.h"
|
|
|
#include "lgsvl_msgs/VehicleControlData.h"
|
|
|
#include "lgsvl_msgs/VehicleStateData.h"
|
|
|
|
|
@@ -27,6 +28,7 @@
|
|
|
#include "rawpic.pb.h"
|
|
|
#include "odom.pb.h"
|
|
|
#include "decition.pb.h"
|
|
|
+#include "autowarectrlcmd.pb.h"
|
|
|
|
|
|
static std::string _point_topic = "/points_raw";
|
|
|
static std::string _point_msgname = "lidarpc_ros";
|
|
@@ -39,14 +41,20 @@ static std::string _odom_msgname = "odom_ros";
|
|
|
|
|
|
static std::string _twistraw_topic = "/twist_raw";
|
|
|
|
|
|
+static std::string _ctrlcmd_topic = "/ctrl_raw";
|
|
|
+static std::string _ctrlcmd_msgname = "ctrlcmd";
|
|
|
+static bool _buse_autowarectrlcmd = true;
|
|
|
+
|
|
|
ros::Subscriber points_sub;
|
|
|
ros::Subscriber odom_sub;
|
|
|
|
|
|
ros::Subscriber twist_sub;
|
|
|
+ ros::Subscriber ctrlcmd_sub;
|
|
|
|
|
|
void * gpa_lidar;
|
|
|
void * gpa_image;
|
|
|
void * gpa_odom;
|
|
|
+ void * gpa_ctrlcmd;
|
|
|
|
|
|
|
|
|
ros::Publisher test_cmd_pub;
|
|
@@ -214,6 +222,25 @@ void twistrawCalllback(const geometry_msgs::TwistStampedConstPtr & msg)
|
|
|
xcmd.twist_cmd.twist = msg->twist;
|
|
|
test_cmd_pub.publish(xcmd);
|
|
|
}
|
|
|
+
|
|
|
+void ctrlrawCallback(const autoware_msgs::ControlCommandStampedConstPtr & msg)
|
|
|
+{
|
|
|
+ iv::autoware::autowarectrlcmd xcmd;
|
|
|
+ xcmd.set_linear_acceleration(msg->cmd.linear_acceleration);
|
|
|
+ xcmd.set_linear_velocity(msg->cmd.linear_velocity);
|
|
|
+ xcmd.set_steering_angle(msg->cmd.steering_angle);
|
|
|
+ int nbytesize = (int)xcmd.ByteSize();
|
|
|
+ std::shared_ptr<char> str_ptr = std::shared_ptr<char>(new char[nbytesize]);
|
|
|
+ if(xcmd.SerializeToArray(str_ptr.get(),nbytesize))
|
|
|
+ {
|
|
|
+ iv::modulecomm::ModuleSendMsg(gpa_ctrlcmd,str_ptr.get(),nbytesize);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::cout<<" ctrlrawCallback Serialize fail."<<std::endl;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
void UpdateDecition(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
|
{
|
|
|
|
|
@@ -304,6 +331,13 @@ int main(int argc, char *argv[])
|
|
|
private_nh.getParam("autoware_twist_raw",_twistraw_topic);
|
|
|
std::cout<<" _twist_topic : "<<_twistraw_topic<<std::endl;
|
|
|
|
|
|
+ private_nh.getParam("_ctrlcmd_node",_ctrlcmd_topic);
|
|
|
+ private_nh.getParam("_ctrlcmd_msgname",_ctrlcmd_msgname);
|
|
|
+ private_nh.getParam("useautowrectrl",_buse_autowarectrlcmd);
|
|
|
+ std::cout<<" ctrlcmd_topic: "<<_ctrlcmd_topic<<std::endl;
|
|
|
+ std::cout<<" ctrlcmd_msgname: "<<_ctrlcmd_msgname<<std::endl;
|
|
|
+ std::cout<<" buseautowrectrl: "<<_buse_autowarectrlcmd<<std::endl;
|
|
|
+
|
|
|
test_cmd_pub = private_nh.advertise<autoware_msgs::VehicleCmd>(
|
|
|
"/vehicle_cmd", 10);
|
|
|
lgsvl_state_pub = private_nh.advertise<lgsvl_msgs::VehicleStateData>("/vehicle_state",10);
|
|
@@ -312,6 +346,7 @@ int main(int argc, char *argv[])
|
|
|
gpa_lidar = iv::modulecomm::RegisterSend(_point_msgname.data(),20000000,1);
|
|
|
gpa_image = iv::modulecomm::RegisterSend(_image_msgname.data(),20000000,1);
|
|
|
gpa_odom = iv::modulecomm::RegisterSend(_odom_msgname.data(),10000,1);
|
|
|
+ gpa_ctrlcmd = iv::modulecomm::RegisterSend(_ctrlcmd_msgname.data(),1000,1);
|
|
|
|
|
|
points_sub = private_nh.subscribe(_point_topic, 1, points_callback);
|
|
|
|
|
@@ -321,6 +356,7 @@ int main(int argc, char *argv[])
|
|
|
odom_sub = private_nh.subscribe(_odom_topic,1,odomCalllback);
|
|
|
|
|
|
twist_sub = private_nh.subscribe(_twistraw_topic,1,twistrawCalllback);
|
|
|
+ctrlcmd_sub = private_nh.subscribe(_ctrlcmd_topic,1,ctrlrawCallback);
|
|
|
|
|
|
void * pdecition = iv::modulecomm::RegisterRecv("deciton",UpdateDecition);
|
|
|
// std::thread * pnew = new std::thread(testvh);
|