diff --git a/include/ur_modern_driver/ur/state_parser.h b/include/ur_modern_driver/ur/state_parser.h index 48eda1d9..146d93c9 100644 --- a/include/ur_modern_driver/ur/state_parser.h +++ b/include/ur_modern_driver/ur/state_parser.h @@ -75,7 +75,7 @@ class URStateParser : public URParser if (!packet->parseWith(sbp)) { - LOG_ERROR("Sub-package parsing of type %d failed!", type); + LOG_ERROR("Sub-package parsing of type %d failed!", static_cast(type)); return false; } @@ -83,7 +83,7 @@ class URStateParser : public URParser if (!sbp.empty()) { - LOG_ERROR("Sub-package of type %d was not parsed completely!", type); + LOG_ERROR("Sub-package of type %d was not parsed completely!", static_cast(type)); sbp.debug(); return false; } @@ -95,4 +95,4 @@ class URStateParser : public URParser typedef URStateParser URStateParser_V1_X; typedef URStateParser URStateParser_V3_0__1; -typedef URStateParser URStateParser_V3_2; \ No newline at end of file +typedef URStateParser URStateParser_V3_2; diff --git a/src/ros/action_server.cpp b/src/ros/action_server.cpp index 380acd3a..494d9329 100644 --- a/src/ros/action_server.cpp +++ b/src/ros/action_server.cpp @@ -145,7 +145,11 @@ bool ActionServer::validateJoints(GoalHandle& gh, Result& res) return true; res.error_code = Result::INVALID_JOINTS; - res.error_string = "Invalid joint names for goal"; + res.error_string = "Invalid joint names for goal\n"; + res.error_string += "Expected: "; + std::for_each(goal_joints.begin(), goal_joints.end(), [&res](std::string joint){res.error_string += joint + ", ";}); + res.error_string += "\nFound: "; + std::for_each(joint_set_.begin(), joint_set_.end(), [&res](std::string joint){res.error_string += joint + ", ";}); return false; } @@ -183,7 +187,7 @@ bool ActionServer::validateTrajectory(GoalHandle& gh, Result& res) } if (std::fabs(velocity) > max_velocity_) { - res.error_string = "Received a goal with velocities that are higher than " + std::to_string(max_velocity_); + res.error_string = "Received a goal with velocities that are higher than max_velocity_ " + std::to_string(max_velocity_); return false; } } @@ -338,4 +342,4 @@ void ActionServer::trajectoryThread() has_goal_ = false; lk.unlock(); } -} \ No newline at end of file +} diff --git a/src/ros/trajectory_follower.cpp b/src/ros/trajectory_follower.cpp index 18ca6912..bec6db77 100644 --- a/src/ros/trajectory_follower.cpp +++ b/src/ros/trajectory_follower.cpp @@ -111,11 +111,11 @@ bool TrajectoryFollower::start() return false; } - LOG_DEBUG("Awaiting incomming robot connection"); + LOG_DEBUG("Awaiting incoming robot connection"); if (!server_.accept()) { - LOG_ERROR("Failed to accept incomming robot connection"); + LOG_ERROR("Failed to accept incoming robot connection"); return false; } @@ -240,4 +240,4 @@ void TrajectoryFollower::stop() server_.disconnectClient(); running_ = false; -} \ No newline at end of file +} diff --git a/src/ros_main.cpp b/src/ros_main.cpp index 4f266343..8d74e3e8 100644 --- a/src/ros_main.cpp +++ b/src/ros_main.cpp @@ -60,6 +60,7 @@ bool parse_args(ProgArgs &args) } ros::param::param(REVERSE_PORT_ARG, args.reverse_port, int32_t(50001)); ros::param::param(MAX_VEL_CHANGE_ARG, args.max_vel_change, 15.0); // rad/s + ros::param::param(MAX_VEL_CHANGE_ARG, args.max_velocity, 10.0); ros::param::param(ROS_CONTROL_ARG, args.use_ros_control, false); ros::param::param(PREFIX_ARG, args.prefix, std::string()); ros::param::param(BASE_FRAME_ARG, args.base_frame, args.prefix + "base_link"); @@ -84,6 +85,10 @@ int main(int argc, char **argv) return EXIT_FAILURE; } + //Add prefix to joint names + std::transform (args.joint_names.begin(), args.joint_names.end(), args.joint_names.begin(), + [&args](std::string name){return args.prefix + name;}); + std::string local_ip(getLocalIPAccessibleFromHost(args.host)); URFactory factory(args.host); @@ -155,4 +160,4 @@ int main(int argc, char **argv) LOG_INFO("Pipelines shutdown complete"); return EXIT_SUCCESS; -} \ No newline at end of file +} diff --git a/src/ur/server.cpp b/src/ur/server.cpp index be19ae07..cbdaa5b2 100644 --- a/src/ur/server.cpp +++ b/src/ur/server.cpp @@ -60,10 +60,14 @@ bool URServer::accept() struct sockaddr addr; socklen_t addr_len; - int client_fd = ::accept(getSocketFD(), &addr, &addr_len); + int client_fd = -1; - if (client_fd <= 0) - return false; + int retry = 0; + while((client_fd = ::accept(getSocketFD(), &addr, &addr_len)) == -1){ + LOG_ERROR("Accepting socket connection failed. (errno: %d)", errno); + if(retry++ >= 5) + return false; + } setOptions(client_fd); @@ -81,4 +85,4 @@ void URServer::disconnectClient() bool URServer::write(const uint8_t* buf, size_t buf_len, size_t& written) { return client_.write(buf, buf_len, written); -} \ No newline at end of file +}