ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Error: Invalid Arguments

asked 2018-06-10 09:17:16 -0500

Swag10 gravatar image

Hello, I am a beginner and so have been posting very small types of issues. Today i am facing error in my coding.

Below code line provides an invalid argument error for ros::init function

error: Invalid arguments

Candidates are:

void init(const ? &, const ? &, ?)

void init(int &, char * *, const ? &, ?)

#include <ros/ros.h>

#include "husky_highlevel_controller/HuskyHighlevelController.hpp"

int main(int argc, char** argv)
  ros::init(argc, argv, "husky_highlevel_controller");
  ros::NodeHandle nodeHandle("~");

  husky_highlevel_controller::HuskyHighlevelController huskyHighlevelController(nodeHandle);

  return 0;

There may be some small thing I am missing, I have went through the entire ros::init, subscriber, publisher tutorials, but it is hard to find why these errors. Sorry for so many doubts, but I have followed all proper syntax and could not debug it any more further. Yet to start with main code. These are like basic errors before I can start anything. Other error was in ROS::ERROR(), subscribing, publishing and getting parameters


error: Invalid arguments '

Candidates are:

void initializeLogLocation(ros::console::LogLocation *, const ? &, enum ros::console::levels::Level)

For nH_.advertise()


Couldnot resolve advertise


template argument 1 is invalid

For, nH_.subscribe()


no matching function for call to ‘ros::NodeHandle::subscribe(std_msgs::String&, int, void (husky_highlevel_controller::HuskyHighlevelController::)(const ConstPtr&), husky_highlevel_controller::HuskyHighlevelController)’

#include "husky_highlevel_controller/HuskyHighlevelController.hpp"
#include <ros/ros.h>
#include <sensor_msgs/LaserScan.h>
#include <geometry_msgs/Twist.h>
#include <ros/console.h>

namespace husky_highlevel_controller {

HuskyHighlevelController::HuskyHighlevelController(ros::NodeHandle& nH) : nH_(nH)
    if (!readParameters()) {
        ROS_ERROR("Could not read parameters.");
    subscriber_ = nH_.subscribe(scanTopic_, 10, &HuskyHighlevelController::scanCallback, this);

bool HuskyHighlevelController::readParameters()
    if (!nH_.getParam("husky_highlevel_controller/twist_publisher_topic_name", twistTopic_))
        return false;
    if (!nH_.getParam("husky_highlevel_controller/scan_subscriber_topic_name", scanTopic_))
        return false;

void HuskyHighlevelController::scanCallback(const sensor_msgs::LaserScan::ConstPtr& msg)


} /* namespace */
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-09-15 20:06:24 -0500

Berg gravatar image

Hello, I am new to ROS also, and encountered exactly the same issue. It's not an issue with ROS (you might be able to verify this through compiling with command line, instead Eclipse). But we need IDE to make programming easier. I resolved the issue by two steps: 1. Context menu of project -> Clean Project 2. Context menu of project -> Index -> Rebuild

edit flag offensive delete link more

Question Tools



Asked: 2018-06-10 09:17:16 -0500

Seen: 826 times

Last updated: Jun 10 '18