Skip to content

Commit

Permalink
Merge pull request #37 from nikhil-sethi/service_testing
Browse files Browse the repository at this point in the history
Test and fix all services
  • Loading branch information
aashish-tud authored Oct 16, 2024
2 parents 6e3fb66 + 48b2462 commit f17b836
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions micro_epsilon_scancontrol_driver/src/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ namespace scancontrol_driver
point_cloud_msg.reset(new point_cloud_t);
point_cloud_msg->header.frame_id = config_.frame_id;
point_cloud_msg->height = 1;
point_cloud_msg->width = config_.resolution;
for (int i=0; i<config_.resolution; i++){
point_cloud_msg->width = resolution;
for (int i=0; i<resolution; i++){
pcl::PointXYZI point(1.0);
point_cloud_msg->points.push_back(point);
}
Expand Down Expand Up @@ -419,23 +419,29 @@ namespace scancontrol_driver
const std::shared_ptr<micro_epsilon_scancontrol_msgs::srv::SetResolution::Request> request,
std::shared_ptr<micro_epsilon_scancontrol_msgs::srv::SetResolution::Response> response)
{
if (response->return_code = StopProfileTransfer() < GENERAL_FUNCTION_OK){
// return true;
response->return_code = StopProfileTransfer();
if (response->return_code < GENERAL_FUNCTION_OK){
RCLCPP_WARN_STREAM(LOGGER, "Error while stopping transmission! Code: " << response->return_code);
return;
}
if (response->return_code = device_interface_ptr->SetResolution(request->resolution) < GENERAL_FUNCTION_OK){
response->return_code = device_interface_ptr->SetResolution(request->resolution);
if (response->return_code < GENERAL_FUNCTION_OK){
RCLCPP_WARN_STREAM(LOGGER, "Error while setting device resolution! Code: " << response->return_code);
// return true;
}
int temp_resolution = request->resolution;
if (response->return_code = SetPartialProfile(temp_resolution) < GENERAL_FUNCTION_OK){
response->return_code = SetPartialProfile(temp_resolution);
if (response->return_code < GENERAL_FUNCTION_OK){
RCLCPP_WARN_STREAM(LOGGER, "Error while setting partial profile. Code: " << response->return_code);
// return true;
return;
}
if (response->return_code = StartProfileTransfer() < GENERAL_FUNCTION_OK){
// return true;
response->return_code = StartProfileTransfer();
if (response->return_code < GENERAL_FUNCTION_OK){
RCLCPP_WARN_STREAM(LOGGER, "Error while starting transmission! Code: " << response->return_code);
return;
}

// Change of resolution was succesull
// // Change of resolution was succesull
config_.resolution = request->resolution;
// return true;
}
Expand Down

0 comments on commit f17b836

Please sign in to comment.