Ask Your Question

Revision history [back]

I am assuming you have already created a workspace with a package that has a CMakeList.txt file and package.xml file with std_msgs specified where necessary.

To answer your question: 1. bag.open() takes a string of type std::string const &filename as its first paramter, so change from using ' ' to using " " when specifying a file name. 2. As this is just an exercise, I would put the hard path to file so you know exactly where the bag file will be saved. 3. 'catkin build <package_name>'' the package that you created. 4. Create a launch file with the node that has the type as the executable that you just created and place in launch directory (you will have to create this directory). 5. Launch the launch file, by using roslaunch.

I am assuming you have already created a workspace with a package that has a CMakeList.txt file and package.xml file with std_msgs specified where necessary.

To answer your question: 1. question:

  1. bag.open() takes a string of type std::string const &filename as its first paramter, so change from using ' ' to using " " when specifying a file name. 2. name.
  2. As this is just an exercise, I would put the hard path to file so you know exactly where the bag file will be saved. 3. saved.
  3. 'catkin build <package_name>'' <package_name>' the package that you created. 4. created.
  4. Create a launch file with the node that has the type as the executable that you just created and place in launch directory (you will have to create this directory). 5. directory).
  5. Launch the launch file, by using roslaunch.

I am assuming you have already created a workspace with a package that has a CMakeList.txt file and package.xml file with std_msgs specified where necessary.

To answer your question:

  1. bag.open() takes a string of type std::string const &filename as its first paramter, parameter, so change from using ' ' to using " " when specifying a file name.
  2. As this is just an exercise, I would put the hard path to file so you know exactly where the bag file will be saved.
  3. 'catkin build <package_name>' the package that you created.
  4. Create a launch file with the node that has the type as the executable that you just created and place in launch directory (you will have to create this directory).
  5. Launch the launch file, by using roslaunch.

EDIT: For step 3., use catkin_make --pkg <package_name> as per @chwimmer point in the comments.