|
@@ -67,13 +67,17 @@ pub_steer_ = create_publisher<SteeringReport>("/vehicle/status/steering_status",
|
|
|
pub_acc_ = create_publisher<AccelWithCovarianceStamped>("/localization/acceleration", durable_qos);
|
|
|
|
|
|
sub_cmd_ = create_subscription<AckermannControlCommand>(
|
|
|
- "/vehicle/command/manual_control_cmd", 1, [this](const AckermannControlCommand::SharedPtr msg) { mpcmd_ptr = msg; std::cout<<"new cmd. "<<std::endl;});
|
|
|
+ "/control/command/control_cmd", 1, [this](const AckermannControlCommand::SharedPtr msg) { mpcmd_ptr = msg;mbcmdupdate = true; std::cout<<"new cmd. "<<std::endl;});
|
|
|
|
|
|
mptimer= create_wall_timer(100ms,std::bind(&pilot_autoware_bridge::callbackTimer, this));
|
|
|
|
|
|
+
|
|
|
+
|
|
|
ModuleFun fungpsimu =std::bind(&pilot_autoware_bridge::UpdateGPSIMU,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
|
mpagpsimu = iv::modulecomm::RegisterRecvPlus("hcp2_gpsimu",fungpsimu);
|
|
|
|
|
|
+ mpactrlcmd = iv::modulecomm::RegisterSend("ctrlcmd",1000,1);
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -209,6 +213,31 @@ void pilot_autoware_bridge::callbackTimer()
|
|
|
{
|
|
|
std::cout<<" testpose. "<<std::endl;
|
|
|
|
|
|
+
|
|
|
+ if(mbcmdupdate == true)
|
|
|
+ {
|
|
|
+ const auto steer = mpcmd_ptr->lateral.steering_tire_angle;
|
|
|
+ const auto vel = mpcmd_ptr->longitudinal.speed;
|
|
|
+ const auto accel = mpcmd_ptr->longitudinal.acceleration;
|
|
|
+ iv::autoware::autowarectrlcmd xcmd;
|
|
|
+ xcmd.set_linear_acceleration(accel);
|
|
|
+ xcmd.set_linear_velocity(vel);
|
|
|
+ xcmd.set_steering_angle(steer);
|
|
|
+ int ndatasize = xcmd.ByteSizeLong();
|
|
|
+ std::shared_ptr<char> pstr_ptr = std::shared_ptr<char>(new char[ndatasize]);
|
|
|
+ if(xcmd.SerializeToArray(pstr_ptr.get(),ndatasize))
|
|
|
+ {
|
|
|
+ iv::modulecomm::ModuleSendMsg(mpactrlcmd ,pstr_ptr.get(),ndatasize);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::cout<<" cmd serialize fail."<<std::endl;
|
|
|
+ }
|
|
|
+ std::cout<<" stear: "<<steer<<" vel: "<<vel<<" accel: "<<accel<<std::endl;
|
|
|
+ mbcmdupdate = false;
|
|
|
+ }
|
|
|
+ return;
|
|
|
+
|
|
|
double pitch,roll,yaw;
|
|
|
pitch = 0;
|
|
|
roll = 0;
|