Note that there are some explanatory texts on larger screens.

plurals
  1. POErrors while building my ROS node
    primarykey
    data
    text
    <p>I am new to ROS...and trying to create a simple random number generator, which will publish the randomly generated values. For this I created a Position class :</p> <pre><code>include "stdlib.h" namespace RandomPositionGenerator { class Position { private: double x; double y; double z; public: Position(); void setPosition(); void getPosition(double &amp;a, double &amp;b, double &amp;c); }; Position::Position(){} void Position::setPosition() { x = rand(); y = rand(); z = rand(); } void Position::getPosition(double &amp;a, double &amp;b, double &amp;c) { a=x; b=y; c=z; } } </code></pre> <p>and used this class to create my publisher :</p> <pre><code>include "ros/ros.h" include "std_msgs/String.h" include "sstream" include "Position.cpp" /** * This method generates position coordinates at random. **/ int main(int argc, char **argv) { ros::init(argc, argv, "talker"); ros::NodeHandle n; ros::Publisher position_pub = n.advertise&lt;RandomPositionGenerator:: Position&gt; ("position", 50); ros::Rate loop_rate(10); double pos_x=0; double pos_y=0; double pos_z=0; while (ros::ok()) { RandomPositionGenerator:: Position pos; pos.setPosition(); pos.getPosition(pos_x,pos_y,pos_z); ROS_INFO("The co-ordinates are : x=",pos_x); position_pub.publish(pos); ros::spinOnce(); loop_rate.sleep(); } return 0; } </code></pre> <p>And now I get the following errors:</p> <ol> <li>‘__s_getDataType’ is not a member of ‘RandomPositionGenerator::Position’ </li> <li>‘__s_getMD5Sum’ is not a member of ‘RandomPositionGenerator::Position’ </li> <li>‘const class RandomPositionGenerator::Position’ has no member named ‘__getDataType’ </li> </ol> <p>and some more similar errors...Please correct me...I am not sure where am I going wrong, or if there is anything that I did right in this small bit of code !</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload