raulmur/BagFromImages

In Which ROS_PACKAGE_PATH

zyffse opened this issue · 14 comments

Thanks for your work. But I met some problems when I install it.Hope you could me help:
My echo $ROS_PACKAGE_PATH:
/opt/ros/fuerte/share:/opt/ros/fuerte/stacks:/home/yifei/ORB_SLAM
Then I fellow the steps in the floder:/home/yifei/ORB_SLAM
But when I do : cmake ..
It show some errors:
[rosbuild] Building package BagFromImages
CMake Error at /opt/ros/fuerte/share/ros/core/rosbuild/private.cmake:99 (message):
[rosbuild] rospack found package "BagFromImages" at "", but the current
directory is "/home/yifei/ORB_SLAM/Thirdparty/BagFromImages". You should
double-check your ROS_PACKAGE_PATH to ensure that packages are found in the
correct precedence order.
Call Stack (most recent call first):
/opt/ros/fuerte/share/ros/core/rosbuild/public.cmake:177 (_rosbuild_check_package_location)
CMakeLists.txt:6 (rosbuild_init)
I have searched this kind of errors but without result, Please help me where is the fault. Thank you very much.

I think you should add sth like "~/rosbuild_ws/package_dir" in your ROS_PACKAGE_PATH.

Hi peter, did you get the package running? Which ROS version are you using?

Thanks!

Yeah I did with Indigo. Haven't try other versions yet.

I have some problem in running it in indigo. Although it seems I got it compiled.

The following is how I compile it:

  1. Create a ROS workspace:
    mkdir ~/image2bag
    cd ~/image2bag
    rosws init . opt/ros/indigo
  2. Clone the code
    git clone https://github.com/raulmur/BagFromImages.git BagFromImages
  3. Set workspace
    rosws set BagFromImages -t .

source setup.bash

rosmake BagFromImages

Am I right?

When I tried to run the code, it gives me error like:
Images: 441
terminate called after throwing an instance of 'rosbag::BagIOException'
what(): Error opening file: /home/xinke/Documents/
Aborted (core dumped)

So is the command line looks like:
rosrun BagFromImages BagFromImages DirectoryofImages .jpg 30 DirectoryofBag
?

Thank you peter!

Here is what I added to my bash:

. /opt/ros/indigo/setup.bash
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:~/rosbuild_ws/package_dir

"~/rosbuild_ws/package_dir" is where I cloned and compiled the bagfromimages at.

Apart from that, I run the same command as yours to generate the bag file.

So actually you did not use the rosmake command right?

Thanks!

No I didn't. Just ran "make" on it.

It works!

Thanks Peter! I really appreciated you help!

Good to know that :)

Hi there, I have a similar issue to XinkeAE that doesn't seem to be fixed following the previous solution. The package builds, but throws the following error:

~/ws_temp/BagFromImages$ rosrun BagFromImages BagFromImages /home/cavusa/TestImages/bb2_left_1 .png 15 /home/cavusa/Documents
Images: 38
terminate called after throwing an instance of 'rosbag::BagIOException'
what(): Error opening file: /home/cavusa/Documents
Aborted (core dumped)

ROS version Indigo and did the following to build after following the install instructions lead to the same error:

mkdir ~/ws_temp
rosws init ~/ws_temp /opt/ros/indigo
cd ws_temp
git clone https://github.com/raulmur/BagFromImages.git BagFromImages
rosws set BagFromImages -t .
mkdir build
cd build
edited .bashrc and restarted terminal, echo $ROS_PACKAGE_PATH = /opt/ros/indigo/share:/opt/ros/indigo/stacks:/home/cavusa/ws_temp/BagFromImages
cmake ..
make
And ran with rosrun (see top)

Any help would be appreciated.

Cheers!

The path to the output file must include the file name.
rosrun BagFromImages BagFromImages /home/cavusa/TestImages/bb2_left_1 .png 15 /home/cavusa/Documents/filename.bag

Thanks, that was it! It makes sense, now it's been pointed out.

Thanks again, for the speed of your reply and for putting the time in to create to package in the first place! Much appreciated!

Similarly I did the following:

  1. mkdir ~/ws_temp
  2. rosws init ~/ws_temp /opt/ros/kinetic/
  3. cd ws_temp/
  4. git clone https://github.com/raulmur/BagFromImages.git
  5. rosws set BagFromImages -t .
  6. cd BagFromImages/
  7. add the following line: target_link_libraries (${PROJECT_NAME} console_bridge) in the end of the file BagFromImages/CMakeLists.txt (keep the OpenCV as is).
  8. mkdir build
  9. cd build
  10. export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:~/ws_temp/BagFromImages
  11. cmake ..
  12. make

When using the code, remember to run the following command again:

export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:~/ws_temp/BagFromImages

alternatively you can permanently add it to the .bashrc.

Add these lines in CMakeList.txt, add lines like below (replace {{target_name}} to your own):

find_package(Boost COMPONENTS system filesystem REQUIRED)
target_link_libraries(${PROJECT_NAME} ${Boost_FILESYSTEM_LIBRARY})
target_link_libraries(${PROJECT_NAME} ${Boost_SYSTEM_LIBRARY}))

Originally posted by @BoyuanYan in cdcseacave/openMVS#346 (comment)