|
@@ -19,6 +19,8 @@
|
|
#include <nav_msgs/Odometry.h>
|
|
#include <nav_msgs/Odometry.h>
|
|
|
|
|
|
#include "autoware_msgs/VehicleCmd.h"
|
|
#include "autoware_msgs/VehicleCmd.h"
|
|
|
|
+#include "lgsvl_msgs/VehicleControlData.h"
|
|
|
|
+#include "lgsvl_msgs/VehicleStateData.h"
|
|
|
|
|
|
#include "rawpic.pb.h"
|
|
#include "rawpic.pb.h"
|
|
#include "odom.pb.h"
|
|
#include "odom.pb.h"
|
|
@@ -43,6 +45,8 @@ static std::string _odom_msgname = "odom_ros";
|
|
|
|
|
|
|
|
|
|
ros::Publisher test_cmd_pub;
|
|
ros::Publisher test_cmd_pub;
|
|
|
|
+ros::Publisher lgsvl_state_pub;
|
|
|
|
+ros::Publisher lgsvl_cmd_pub;
|
|
|
|
|
|
|
|
|
|
static void points_callback(const sensor_msgs::PointCloud2::ConstPtr& input)
|
|
static void points_callback(const sensor_msgs::PointCloud2::ConstPtr& input)
|
|
@@ -179,20 +183,17 @@ void testvh()
|
|
int x = 0;
|
|
int x = 0;
|
|
while(1)
|
|
while(1)
|
|
{
|
|
{
|
|
- autoware_msgs::VehicleCmd xcmd;
|
|
|
|
-
|
|
|
|
- xcmd.header.seq = x;
|
|
|
|
|
|
|
|
-
|
|
|
|
- xcmd.ctrl_cmd.linear_acceleration =0.1;
|
|
|
|
- xcmd.ctrl_cmd.linear_velocity = 30.0;
|
|
|
|
- xcmd.ctrl_cmd.steering_angle =0.0;
|
|
|
|
- xcmd.gear_cmd.gear = xcmd.gear_cmd.DRIVE;
|
|
|
|
- xcmd.lamp_cmd.l = 0;
|
|
|
|
- xcmd.lamp_cmd.r = 0;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- test_cmd_pub.publish(xcmd);
|
|
|
|
|
|
+ lgsvl_msgs::VehicleStateData xstate;
|
|
|
|
+ xstate.blinker_state = lgsvl_msgs::VehicleStateData::BLINKERS_LEFT;
|
|
|
|
+ xstate.headlight_state = lgsvl_msgs::VehicleStateData::HEADLIGHTS_OFF;
|
|
|
|
+ xstate.wiper_state = lgsvl_msgs::VehicleStateData::WIPERS_HIGH;
|
|
|
|
+ xstate.current_gear = lgsvl_msgs::VehicleStateData::GEAR_PARKING;
|
|
|
|
+ xstate.vehicle_mode = lgsvl_msgs::VehicleStateData::VEHICLE_MODE_COMPLETE_AUTO_DRIVE;
|
|
|
|
+ xstate.hand_brake_active = true;
|
|
|
|
+ xstate.horn_active = true;
|
|
|
|
+ xstate.autonomous_mode_active = true;
|
|
|
|
+ lgsvl_state_pub.publish(xstate);
|
|
x++;
|
|
x++;
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
|
}
|
|
}
|
|
@@ -209,41 +210,58 @@ void UpdateDecition(const char * strdata,const unsigned int nSize,const unsigned
|
|
std::cout<<" UpdateDecition Parse error."<<std::endl;
|
|
std::cout<<" UpdateDecition Parse error."<<std::endl;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- //ServiceCarStatus.mfAcc = xdecition.accelerator(); //
|
|
|
|
|
|
+ /*
|
|
autoware_msgs::VehicleCmd xcmd;
|
|
autoware_msgs::VehicleCmd xcmd;
|
|
-
|
|
|
|
- xcmd.header.seq = x;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- std::cout<<" acc : "<<xdecition.accelerator()<<std::endl;
|
|
|
|
- //xcmd.ctrl_cmd.linear_acceleration =0.1;
|
|
|
|
xcmd.twist_cmd.twist.linear.x = xdecition.speed()/3.6;
|
|
xcmd.twist_cmd.twist.linear.x = xdecition.speed()/3.6;
|
|
xcmd.twist_cmd.twist.angular.z = 3.0* xdecition.wheelangle() /600.0;
|
|
xcmd.twist_cmd.twist.angular.z = 3.0* xdecition.wheelangle() /600.0;
|
|
xcmd.ctrl_cmd.linear_velocity = 30.0;
|
|
xcmd.ctrl_cmd.linear_velocity = 30.0;
|
|
- //xcmd.ctrl_cmd.steering_angle = xdecition.wheelangle() * (-1.0)/600.0;
|
|
|
|
- //xcmd.gear_cmd.gear = 1;//autoware_msgs::VehicleCmd::_gear_cmd_type::NONE;
|
|
|
|
- xcmd.mode = 1;
|
|
|
|
- if(xdecition.leftlamp() == true)
|
|
|
|
- {
|
|
|
|
- xcmd.lamp_cmd.l = 1;
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- xcmd.lamp_cmd.l = 0;
|
|
|
|
- }
|
|
|
|
|
|
+ test_cmd_pub.publish(xcmd);
|
|
|
|
+ */
|
|
|
|
+ lgsvl_msgs::VehicleStateData xstate;
|
|
|
|
+ lgsvl_msgs::VehicleControlData xctrl;
|
|
|
|
+ if(xdecition.leftlamp() == true)
|
|
|
|
+ {
|
|
|
|
+ xstate.blinker_state = lgsvl_msgs::VehicleStateData::BLINKERS_LEFT;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
if(xdecition.rightlamp() == true)
|
|
if(xdecition.rightlamp() == true)
|
|
- {
|
|
|
|
- xcmd.lamp_cmd.r = 1;
|
|
|
|
|
|
+ {
|
|
|
|
+ xstate.blinker_state = lgsvl_msgs::VehicleStateData::BLINKERS_RIGHT;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
- {
|
|
|
|
- xcmd.lamp_cmd.r = 0;
|
|
|
|
- }
|
|
|
|
- // xcmd.lamp_cmd.l = 0;
|
|
|
|
- //xcmd.lamp_cmd.r = 0;
|
|
|
|
|
|
+ xstate.blinker_state = lgsvl_msgs::VehicleStateData::BLINKERS_OFF;
|
|
|
|
+ }
|
|
|
|
+ xstate.headlight_state = lgsvl_msgs::VehicleStateData::HEADLIGHTS_OFF;
|
|
|
|
+ xstate.wiper_state = lgsvl_msgs::VehicleStateData::WIPERS_OFF;
|
|
|
|
+ xstate.current_gear = lgsvl_msgs::VehicleStateData::GEAR_DRIVE;
|
|
|
|
+ xstate.vehicle_mode = lgsvl_msgs::VehicleStateData::VEHICLE_MODE_COMPLETE_AUTO_DRIVE;
|
|
|
|
+ xstate.hand_brake_active = false;
|
|
|
|
+ xstate.horn_active = true;
|
|
|
|
+ xstate.autonomous_mode_active = true;
|
|
|
|
+
|
|
|
|
+ if(xdecition.brake() < 0.00001)
|
|
|
|
+ {
|
|
|
|
+ xctrl.acceleration_pct = xdecition.accelerator() /5.0;
|
|
|
|
+ if(xctrl.acceleration_pct >1.0)xctrl.acceleration_pct = 1.0;
|
|
|
|
+ if(xctrl.acceleration_pct<0.0)xctrl.acceleration_pct = 0.0;
|
|
|
|
+ xctrl.braking_pct = 0.0;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ xctrl.acceleration_pct = 0.0;
|
|
|
|
+ xctrl.braking_pct = xdecition.brake()/100.0;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ // xctrl.acceleration_pct = 0.05;
|
|
|
|
+ // xctrl.braking_pct = 0;
|
|
|
|
+ xctrl.target_gear = lgsvl_msgs::VehicleControlData::GEAR_DRIVE;
|
|
|
|
+ xctrl.target_wheel_angle = 0.1 * (-1)* xdecition.wheelangle() *M_PI/180.0;
|
|
|
|
+ xctrl.target_wheel_angular_rate = 300 * M_PI/180.0;
|
|
|
|
+
|
|
|
|
+ lgsvl_state_pub.publish(xstate);
|
|
|
|
+ lgsvl_cmd_pub.publish(xctrl);
|
|
|
|
|
|
- test_cmd_pub.publish(xcmd);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
int main(int argc, char *argv[])
|
|
@@ -270,6 +288,8 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
test_cmd_pub = private_nh.advertise<autoware_msgs::VehicleCmd>(
|
|
test_cmd_pub = private_nh.advertise<autoware_msgs::VehicleCmd>(
|
|
"/vehicle_cmd", 10);
|
|
"/vehicle_cmd", 10);
|
|
|
|
+ lgsvl_state_pub = private_nh.advertise<lgsvl_msgs::VehicleStateData>("/vehicle_state",10);
|
|
|
|
+ lgsvl_cmd_pub = private_nh.advertise<lgsvl_msgs::VehicleControlData>("/vehicle_ctrl",10);
|
|
|
|
|
|
gpa_lidar = iv::modulecomm::RegisterSend(_point_msgname.data(),20000000,1);
|
|
gpa_lidar = iv::modulecomm::RegisterSend(_point_msgname.data(),20000000,1);
|
|
gpa_image = iv::modulecomm::RegisterSend(_image_msgname.data(),20000000,1);
|
|
gpa_image = iv::modulecomm::RegisterSend(_image_msgname.data(),20000000,1);
|
|
@@ -282,8 +302,8 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
odom_sub = private_nh.subscribe(_odom_topic,1,odomCalllback);
|
|
odom_sub = private_nh.subscribe(_odom_topic,1,odomCalllback);
|
|
|
|
|
|
- void * pdecition = iv::modulecomm::RegisterRecv("deciton",UpdateDecition);
|
|
|
|
- // std::thread * pnew = new std::thread(testvh);
|
|
|
|
|
|
+ void * pdecition = iv::modulecomm::RegisterRecv("deciton",UpdateDecition);
|
|
|
|
+ // std::thread * pnew = new std::thread(testvh);
|
|
|
|
|
|
ros::spin();
|
|
ros::spin();
|
|
/*
|
|
/*
|