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

fborok's profile - activity

2021-09-11 17:42:33 -0500 received badge  Student (source)
2016-05-08 14:52:06 -0500 received badge  Famous Question (source)
2015-08-12 10:08:10 -0500 received badge  Notable Question (source)
2015-08-12 10:08:10 -0500 received badge  Popular Question (source)
2015-08-11 13:04:15 -0500 received badge  Famous Question (source)
2015-07-22 19:28:43 -0500 received badge  Notable Question (source)
2015-07-20 13:16:02 -0500 received badge  Popular Question (source)
2015-04-26 22:27:50 -0500 received badge  Scholar (source)
2015-04-26 22:27:47 -0500 received badge  Supporter (source)
2015-04-26 19:26:58 -0500 received badge  Organizer (source)
2015-04-26 19:25:56 -0500 asked a question Can't find correct sytax for ros::nodehandle::advertise

I have just started learning ROS and I have written a publisher node based on the following tutorials:

https://support.clearpathrobotics.com... ------ ROS 101: Drive a Husky

http://wiki.ros.org/ROS/Tutorials/Wri...

I can't get it to compile, and after checking the tutorials and trying to understand the correct syntax I have been left completely baffled. I have no idea how to fix the problem.

The problem is on line 28: ros::Publisher velocity_pub = node.advertise<geometry_msgs twist="">(topic_name, 1000);

I am very new to ROS. Can someone explain how to correctly write a ros::nodehandle::advertise statement?

Here is the console output:

[100%] Building CXX object drive_husky/CMakeFiles/drive_husky.dir/src/drive.cpp.o
/home/francis/husky_cws/src/drive_husky/src/drive.cpp: In function ‘int main(int, char**)’:
/home/francis/husky_cws/src/drive_husky/src/drive.cpp:28:37: error: parse error in template argument list
  ros::Publisher velocity_pub = node.advertise<geometry_msgs/Twist>(topic_name, 1000);
                                     ^
/home/francis/husky_cws/src/drive_husky/src/drive.cpp:28:84: error: no matching function for call to ‘ros::NodeHandle::advertise(const string&, int)’
  ros::Publisher velocity_pub = node.advertise<geometry_msgs/Twist>(topic_name, 1000);
                                                                                    ^
/home/francis/husky_cws/src/drive_husky/src/drive.cpp:28:84: note: candidates are:
In file included from /opt/ros/indigo/include/ros/ros.h:45:0,
                 from /home/francis/husky_cws/src/drive_husky/src/drive.cpp:1:
/opt/ros/indigo/include/ros/node_handle.h:236:15: note: template<class M> ros::Publisher ros::NodeHandle::advertise(const string&, uint32_t, bool)
     Publisher advertise(const std::string& topic, uint32_t queue_size, bool latch = false)
               ^
/opt/ros/indigo/include/ros/node_handle.h:236:15: note:   template argument deduction/substitution failed:
/home/francis/husky_cws/src/drive_husky/src/drive.cpp:28:84: error: template argument 1 is invalid
  ros::Publisher velocity_pub = node.advertise<geometry_msgs/Twist>(topic_name, 1000);
                                                                                    ^
In file included from /opt/ros/indigo/include/ros/ros.h:45:0,
                 from /home/francis/husky_cws/src/drive_husky/src/drive.cpp:1:
/opt/ros/indigo/include/ros/node_handle.h:300:13: note: template<class M> ros::Publisher ros::NodeHandle::advertise(const string&, uint32_t, const SubscriberStatusCallback&, const SubscriberStatusCallback&, const VoidConstPtr&, bool)
   Publisher advertise(const std::string& topic, uint32_t queue_size,
             ^
/opt/ros/indigo/include/ros/node_handle.h:300:13: note:   template argument deduction/substitution failed:
/home/francis/husky_cws/src/drive_husky/src/drive.cpp:28:84: error: template argument 1 is invalid
  ros::Publisher velocity_pub = node.advertise<geometry_msgs/Twist>(topic_name, 1000);
                                                                                    ^
make[2]: *** [drive_husky/CMakeFiles/drive_husky.dir/src/drive.cpp.o] Error 1
make[1]: *** [drive_husky/CMakeFiles/drive_husky.dir/all] Error 2
make: *** [all] Error 2

And here are my files: drive.cpp:

#include <ros/ros.h>
//#include "std_msgs/String.h"
#include <geometry_msgs/Twist.h>

#include <string>
#include <cstring>

/*** Make the Husky drive forwards and backwards three times, and then come to a halt ***/

int main(int argc, char **argv) //argc and argv required for ros::init to create node
{
    ros::init(argc, argv, "Driver");    //Must call ros::init, requires argc and argv and the name of the node to be initiated

    ros ...
(more)
2015-04-12 22:08:21 -0500 asked a question Unable to get ROS Husky Simulation Tutorial to Work

I have just started using ROS, and have been using the Clearpath Robotics tutorials to get my head around it.

They have a tutorial 'Drive a Husky' https://support.clearpathrobotics.com...

I have installed the components and I can load up the Gazebo simulator and RViz, however when I get to the line

rostopic pub /husky/cmd_vel geometry_msgs/Twist -r 100 '[0.5,0,0]' '[0,0,0]'

nothing happens. According to the tutorial this is supposed to make the robot in the simulation move forwards.

This may be something trivial that I have overlooked but I am very new to ROS and have no idea how to troubleshoot the problem. All the answers I have come accross so far just say that entering the command into a new terminal window will work - but it doesn't.

I am using ROS Indigo on Mint 17.1 Rebecca.