Error: Invalid Arguments
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);
ros::spin();
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
For ROS::ERROR();
error: Invalid arguments '
Candidates are:
void initializeLogLocation(ros::console::LogLocation *, const ? &, enum ros::console::levels::Level)
For nH_.advertise()
error1:
Couldnot resolve advertise
error2:
template argument 1 is invalid
For, nH_.subscribe()
error:
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.");
ros::requestShutdown();
}
twistPublisher_=nH_.advertise<geometry_msgs::Twist>(twistTopic_,10);
subscriber_ = nH_.subscribe(scanTopic_, 10, &HuskyHighlevelController::scanCallback, this);
}
HuskyHighlevelController::~HuskyHighlevelController()
{
}
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 */