16 std::string steering_stick_string;
19 if (nodeH->
getParam(
"steering_stick", steering_stick_string))
21 ROS_INFO(
"Got steering_stick: %s", steering_stick_string.c_str());
23 if (steering_stick_string ==
"LEFT")
27 else if (steering_stick_string ==
"RIGHT")
33 ROS_ERROR(
"steering_stick is invalid. Exiting.");
39 ROS_ERROR(
"Parameter steering_stick is missing. Exiting.");
49 std::string vehicle_type_string;
50 int vehicle_type = -1;
52 if (nodeH->
getParam(
"pacmod_vehicle_type", vehicle_type_string))
54 ROS_INFO(
"Got pacmod_vehicle_type: %s", vehicle_type_string.c_str());
56 if(vehicle_type_string ==
"POLARIS_GEM")
58 else if(vehicle_type_string ==
"POLARIS_RANGER")
60 else if(vehicle_type_string ==
"LEXUS_RX_450H")
62 else if(vehicle_type_string ==
"INTERNATIONAL_PROSTAR_122")
64 else if(vehicle_type_string ==
"VEHICLE_4")
66 else if(vehicle_type_string ==
"VEHICLE_5")
68 else if(vehicle_type_string ==
"VEHICLE_6")
72 ROS_ERROR(
"pacmod_vehicle_type is invalid");
78 ROS_ERROR(
"Parameter pacmod_vehicle_type is missing. Exiting.");
91 PublishControl::vehicle_type = vehicle_type;
98 std::string controller_string;
101 if (nodeH->
getParam(
"controller_type", controller_string))
103 ROS_INFO(
"Got controller_type: %s", controller_string.c_str());
105 if (controller_string ==
"LOGITECH_F310" || controller_string ==
"XBOX_ONE")
115 PublishControl::axes[
DPAD_LR] = 6;
116 PublishControl::axes[
DPAD_UD] = 7;
121 PublishControl::btns[
TOP_BTN] = 3;
129 else if (controller_string ==
"HRI_SAFE_REMOTE")
137 PublishControl::axes[
DPAD_LR] = 6;
138 PublishControl::axes[
DPAD_UD] = 7;
142 PublishControl::btns[
TOP_BTN] = 2;
145 else if (controller_string ==
"LOGITECH_G29")
150 PublishControl::max_rot_rad = 7.85;
161 PublishControl::axes[
DPAD_LR] = 4;
162 PublishControl::axes[
DPAD_UD] = 5;
167 PublishControl::btns[
TOP_BTN] = 3;
177 else if (controller_string ==
"NINTENDO_SWITCH_WIRED_PLUS")
185 PublishControl::axes[
DPAD_LR] = 4;
186 PublishControl::axes[
DPAD_UD] = 5;
191 PublishControl::btns[
TOP_BTN] = 3;
203 ROS_ERROR(
"Provided controller_type is invalid. Exiting.");
209 ROS_ERROR(
"Parameter controller_type is missing. Exiting.");
220 if (nodeH->
getParam(
"steering_max_speed", PublishControl::steering_max_speed))
222 ROS_INFO(
"Got steering_max_speed: %f", PublishControl::steering_max_speed);
224 if (PublishControl::steering_max_speed <= 0)
226 ROS_ERROR(
"Parameter steering_max_speed is invalid. Exiting.");
232 ROS_ERROR(
"Parameter steering_max_speed_scale_val is missing. Exiting.");
236 if (nodeH->
getParam(
"max_veh_speed", PublishControl::max_veh_speed))
238 ROS_INFO(
"Got max_veh_speed: %f", PublishControl::max_veh_speed);
240 if (PublishControl::max_veh_speed <= 0)
242 ROS_ERROR(
"Parameter max_veh_speed is invalid. Exiting.");
248 ROS_ERROR(
"Parameter max_veh_speed is missing. Exiting.");
252 if (nodeH->
getParam(
"accel_scale_val", PublishControl::accel_scale_val))
254 ROS_INFO(
"Got accel_scale_val: %f", PublishControl::accel_scale_val);
256 if (PublishControl::accel_scale_val <= 0 ||
257 PublishControl::accel_scale_val > 1.0)
259 ROS_ERROR(
"Parameter accel_scale_val is invalid. Exiting.");
265 ROS_ERROR(
"Parameter accel_scale_val is missing. Exiting.");
269 if (nodeH->
getParam(
"brake_scale_val", PublishControl::brake_scale_val))
271 ROS_INFO(
"Got brake_scale_val: %f", PublishControl::brake_scale_val);
273 if (PublishControl::brake_scale_val <= 0 ||
274 PublishControl::brake_scale_val > 1.0)
276 ROS_ERROR(
"Parameter brake_scale_val is invalid. Exiting.");
282 ROS_ERROR(
"Parameter brake_scale_val is missing. Exiting.");
291 bool willExit =
false;
bool check_steering_stick_left_right(ros::NodeHandle *)
bool check_scale_values(ros::NodeHandle *nodeH)
bool check_controller_type(ros::NodeHandle *nodeH)
static const float MAX_ROT_RAD_VEHICLE4
static const float MAX_ROT_RAD_VEHICLE6
static const float MAX_ROT_RAD_VEHICLE2
bool run_startup_checks_error(ros::NodeHandle *nodeH)
bool check_vehicle_type(ros::NodeHandle *nodeH)
bool getParam(const std::string &key, std::string &s) const
static const float MAX_ROT_RAD_VEHICLE5