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

JP's profile - activity

2021-04-20 13:06:43 -0500 received badge  Good Question (source)
2020-06-16 14:26:52 -0500 received badge  Nice Question (source)
2020-04-17 06:36:22 -0500 received badge  Famous Question (source)
2017-03-09 07:07:06 -0500 received badge  Famous Question (source)
2017-03-09 07:07:06 -0500 received badge  Notable Question (source)
2016-10-21 02:50:59 -0500 received badge  Notable Question (source)
2016-09-16 04:35:03 -0500 received badge  Nice Question (source)
2014-10-10 09:41:21 -0500 received badge  Famous Question (source)
2014-10-10 09:41:21 -0500 received badge  Notable Question (source)
2014-07-14 02:58:09 -0500 received badge  Popular Question (source)
2014-07-01 02:38:21 -0500 received badge  Famous Question (source)
2014-04-20 13:58:43 -0500 marked best answer monocular Camera calibration in ROS

Hello,

I was trying the camera calibration from the following link: link:text and my camera feed is shown in one window of the GUI (There is another window derectly below this but it is blank). The problem is that my checkerboard will not highlight.

I printed out a 7x7 checkerboard where each square is 0.024 meters. I tried the camera from my webcam but it could not detect like it does in the tutorial. I get the window but "calibrate" "save" and "commit" are hazed out and there are no "x" "y" and "size" highlighted like in the tutorial.

Thanks

2014-04-20 13:54:37 -0500 marked best answer Using openCV in ROS to stream images from AR-Drone

Hi everyone, I would like to use openCV to process images from an AR-Drone 2.0. I would like the images to be streamed into openCV from the AR-Drone 2.0 but I do not know how to set this up. I am using the ardrone_autonomy to interface the Ardrone 2.0 with ROS and that is setup already. I noticed a section on cameras link:text however it does not talk about openCV support with this image stream (I think it just shows an image feed to the computer).

Any links to this problem would be greatly appreciated!

Thanks

2014-04-20 13:54:35 -0500 marked best answer Help understanding the notation used on ar-drone tutorial

Hi everyone, for the tutorial link:https://github.com/AutonomyLab/ardrone_autonomy#cameras</a">text, under

Sending Commands to AR-Drone

It shows three highlighted commands which are: ardrone/takeoff ardrone/land and ardrone/reset. These are topics so is the full commands actually: rostopic /ardrone/takeoff rostopic /ardrone/land androstopic /ardrone/reset ?

Also, to fly the drone after takeoff, would I do something like: rostopic cmd_vel -linear.x to move the drone backwards?

I am trying to understand how to read the commands listed, sorry that this is basic.

2014-04-20 13:54:22 -0500 marked best answer Confusion when installing a supported ROS robot

Hi guys, I have finished with the basic tutorials and want to start work on an AR. Drone. From the ROS page, it has directed me to follow this tutorial:

link:text

My initial confusion is at the beginning where it says

Please make sure that this folder is in your ROS_PACKAGE_PATH environmental variable.

yet the first line of code says:

cd ~/ros/stacks

My ROS_PACKAGE_PATH does not have a stacks (/opt/ros/fuerte has a stacks folder however). Should I be installing this code in the /opt... path or should I make a new folder in my sandbox directory which is what I did for my beginner tutorials?

Thanks!

2014-04-20 13:51:09 -0500 marked best answer Confusion with ROS_PACKAGE_PATH

Hi everyone, I know this is a basic question but I require some guidance. I am new to linux and ROS so I understand this is a basic question.

I have currently installed ROS fuerte and the folder is in the /opt/ros/fuerte on my file system.

I was following the tutorial here: link:www.ros.org/wiki/ROS/Tutorials/InstallingandConfiguringROSEnvironment">text

but realised that I have not configured the ROS_ROOT or ROS_PACKAGE_PATH so I entered the commands provided. However, how do I check if I am successful with these commands? The command for the ROS_PACKAGE_PATH is: export ROS_PACKAGE_PATH=/home/user/ros/ros-pkg:/another/path

so I created a folder called rospackagepath so the line above becomes: ROS_PACKAGE_PATH=/home/user/ros/ros-pkg:/rospackagepath

However the file is empty. Also, I do not have a user folder so should I have something like? ROS_PACKAGE_PATH=/home/ros-pkg:/rospackagepath ?

Thanks for your help!

2014-04-20 06:56:21 -0500 marked best answer Print out the contents of a string using ROS_INFO

Hi all,

I have a line such as:

   std_msgs::String s;
s.data = c.c_str(); //same data as above.
pthread_mutex_lock(&send_CS);
tum_ardrone_pub.publish(s);
pthread_mutex_unlock(&send_CS);

What I would like to do is look at the contents of s that is passed into the method publish(). I tried something like:

ROS_INFO("(2) (%s) \n",s.c_str());

But that failed at compile time. Thanks!

2014-04-20 06:56:20 -0500 marked best answer rosbuild_add_executable. Where does it save this?

Hi everyone,

I used the command

rosbuild_add_executable(main_ParseStringCommand ${GUIA_SOURCE_FILES} ${GUIA_HEADER_FILES})

to my CMakeLists.txt.

I performed the:

$rosmake package_name

and ran the node by:

$rosrun package_name main_ParseStringCommand

I then changed the rosbuild_add_executable in my CMakeLists.txt to:

rosbuild_add_executable(main_ParseString ${GUIA_SOURCE_FILES} ${GUIA_HEADER_FILES})

and did: $rosmake package_name

Now, I can run the node by:

$rosrun package_name main_ParseString

but I can still run it by:

$rosrun package_name main_ParseStringCommand

Why is this the case and how can I stop this from happening?

Thanks!

2014-04-20 06:56:10 -0500 marked best answer Camera calibration problem AR.Drone 2.0

Hi guys, I installed the following driver: link:text because I noticed there were calibration files for the front and bottom camera of the AR.Drone. I downloaded this successfully so I tried the following line in terminal to see if the image quality improved:

rosrun image_view image_view image:=/ardrone/front/image_raw

However, the camera stream was still terrible. I wanted to know how people fixed the camera stream or had a similar problem on the AR.Drone 2.0 because my one is poor over ROS. Thanks!

2014-04-20 06:56:06 -0500 marked best answer Help with calling a ros method

Hi everyone, I have been trying to convert the following code on this tutorial link:text into .cpp and .h files. This is not an algorithm question as the code works when it is all in one .cpp file. Here is what I have so far in my .cpp file:

    //Code from <a href="http://siddhantahuja.wordpress.com/2011/07/20/working-with-ros-and-opencv-draft/">http://siddhantahuja.wordpress.com/2011/07/20/working-with-ros-and-opencv-draft/</a>
#include "../header/Webcam.h"
#include <iostream>

void Webcam::invertImage(cv_bridge::CvImagePtr cv_ptr){
 //Invert Image
    //Go through all the rows
    for(int i=0; i<cv_ptr->image.rows; i++)
    {
        //Go through all the columns
        for(int j=0; j<cv_ptr->image.cols; j++)
        {
            //Go through all the channels (b, g, r)
            for(int k=0; k<cv_ptr->image.channels(); k++)
            {
                //Invert the image by subtracting image data from 255               
                cv_ptr->image.data[i*cv_ptr->image.rows*4+j*3 + k] = 255-cv_ptr->image.data[i*cv_ptr->image.rows*4+j*3 + k];
            }
        }
    }
}

 void Webcam::imageCallback(const sensor_msgs::ImageConstPtr& camera_image)
{

//Store all constants for image encodings in the enc namespace to be used later.
namespace enc = sensor_msgs::image_encodings;

//Declare a string with the name of the window that we will create using OpenCV where processed images will be displayed.
static const char WINDOW[] = "Image Processed";

//Use method of ImageTransport to create image publisher
image_transport::Publisher pub;

    //Convert from the ROS image message to a CvImage suitable for working with OpenCV for processing
    cv_bridge::CvImagePtr cv_ptr;
    try
    {
        //Always copy, returning a mutable CvImage
        //OpenCV expects color images to use BGR channel order.
        cv_ptr = cv_bridge::toCvCopy(camera_image, enc::BGR8);
    }
    catch (cv_bridge::Exception& e)
    {
        //if there is an error during conversion, display it
        ROS_ERROR("camera::main.cpp::cv_bridge exception: %s", e.what());
        return;
    }

   //modify the image
   Webcam wc;
   wc.invertImage(cv_ptr);


    //Display the image using OpenCV
    cv::imshow(WINDOW, cv_ptr->image);
    //Add some delay in miliseconds. The function only works if there is at least one HighGUI window created and the window is active. If there are several HighGUI windows, any of them can be active.
    cv::waitKey(3);
    /**
    * The publish() function is how you send messages. The parameter
    * is the message object. The type of this object must agree with the type
    * given as a template parameter to the advertise<>() call, as was done
    * in the constructor in main().
    */
    //Convert the CvImage to a ROS image message and publish it on the "camera/image_processed" topic.
        pub.publish(cv_ptr->toImageMsg());
}

Here is the .h file:

//Includes all the headers necessary to use the most common public pieces of the ROS system.
#include <ros/ros.h>
//Use image_transport for publishing and subscribing to images in ROS
#include <image_transport/image_transport.h>
//Use cv_bridge to convert between ROS and OpenCV Image formats
#include <cv_bridge/cv_bridge.h>
//Include some useful constants for image encoding. Refer to: <a href="http://www.ros.org/doc/api/sensor_msgs/html/namespacesensor__msgs_1_1image__encodings.html">http://www.ros.org/doc/api/sensor_msgs/html/namespacesensor__msgs_1_1image__encodings.html</a> for more info.
#include <sensor_msgs/image_encodings.h>
//Include headers for ...
(more)
2014-04-20 06:56:03 -0500 marked best answer Why do vectors not work in ROS?

H everyone, I can compile the following code in Xcode but I cannot do the same when using rosmake. Here is my .h file:

#ifndef __AStartAlgorithm__AStarAlgorithm__
#define __AStartAlgorithm__AStarAlgorithm__

#include <iostream>
#include <vector>

class AStarAlgorithm{

public:

AStarAlgorithm();
void astar();

 void printmap(std::vector < std::vector<int> >map);

 private:

 };
#endif /* defined(__AStartAlgorithm__AStarAlgorithm__) */

Here is my .cpp:

#include "../header/AStarAlgorithm.h"
#include <iostream>
#include <vector>
AStarAlgorithm::AStarAlgorithm(){


}



void AStarAlgorithm::astar(){

   std::vector<std::vector<int> > map  = {{8,8,8,8,8,8,8},{8,0,0,0,0,0,8},{8,0,0,0,0,0,8},{8,0,1,0,0,2,8},{8,0,0,0,0,0,8},{8,0,0,0,0,0,8},{8,8,8,8,8,8,8}};

   // printmap(map);  
}

/*
void AStarAlgorithm::printmap(std::vector < std::vector<int> >map){

    for(int i = 0; i < map.size(); i++){
        for(int j = 0; j < map[i].size(); j++){
            if(map[i][j] <10){
                std::cout << "|"<<map[i][j] << " |";
            }else{
                std::cout << "|"<<map[i][j] << "|";
            }

        }
        std::cout << std::endl;
    }
    std::cout << std::endl;
}
*/

I want to print out the vector with the commented out code but the problem at the moment is just initialising the vector. Here is my error in ROS:

/home/jay/fuerte/sandbox/ucl_drone/src/trajectory/AStarAlgorithm.cpp: In member function ‘void AStarAlgorithm::astar()’:
/home/jay/fuerte/sandbox/ucl_drone/src/trajectory/AStarAlgorithm.cpp:17:154: error: in C++98 ‘map’ must be initialised by constructor, not by ‘{...}’
/home/jay/fuerte/sandbox/ucl_drone/src/trajectory/AStarAlgorithm.cpp:17:154: error: deducing from brace-enclosed initialiser, list requires #include <initializer_list>
/home/jay/fuerte/sandbox/ucl_drone/src/trajectory/AStarAlgorithm.cpp:17:154: error: deducing from brace-enclosed initialiser, list requires #include <initializer_list>
/home/jay/fuerte/sandbox/ucl_drone/src/trajectory/AStarAlgorithm.cpp:17:154: warning: extended initialiser lists only available with -std=c++0x or -std=gnu++0x [enabled by default] /home/jay/fuerte/sandbox/ucl_drone/src/trajectory/AStarAlgorithm.cpp:17:154: error: could not convert ‘{{8, 8, 8, 8, 8, 8, 8}, {8, 0, 0, 0, 0, 0, 8}, {8, 0, 0, 0, 0, 0, 8}, {8, 0, 1, 0, 0, 2, 8}, {8, 0, 0, 0, 0, 0, 8}, {8, 0, 0, 0, 0, 0, 8}, {8, 8, 8, 8, 8, 8, 8}}’ from ‘<brace-enclosed initializer="" list="">’ to ‘std::vector<std::vector<int> >’

Any help will be much appreciated! Thank you.

2014-04-20 06:55:56 -0500 marked best answer unidentified reference issue when having .h and .cpp files

Hi everyone, I am trying to have .h and .cpp files in my ros package. All my code is in the src file and I have the following code. The code works fine when I run through xcode so the syntax is okay however ros does not like it for some unknown reason: Here is the .h file

#include <iostream>
class DroneCommands{

public:

DroneCommands();
void Land(int time);



 };
  #endif /* defined(__helloworld__DroneCommands__) */

Here is the .cpp file:

#include "DroneCommands.h"
#include <iostream>


DroneCommands::DroneCommands(){
std::cout << "object created" << std::endl;
}




void DroneCommands::Land(int time){
std::cout << "Landing!!" << std::endl;

}

Finally, here is main.cpp: #include <iostream> #include "DroneCommands.h"

int main(int argc, char **argv)
{
DroneCommands dc; 
dc.Land(3);

}

The command prompt error is: undefined reference to `DroneCommands::DroneCommands()'

Please let me know why this does not work even though I can get it to run on Xcode successfully. Thanks :)

2014-04-20 06:55:53 -0500 marked best answer Using two roscreate-pkg packages and being able to read the src file code

Hi everyone,

I have one package (lets call it a) and inside this is the CMakeLists.txt file, manifest.xml and a few .h and .cpp files of code that talk to each other in the src folder. My src file is starting to get a little big so ideally I want to have more than one package (such as one called b) that has its own CMakeLists.txt file, manifest.xml and src file. What I want is the code in the src folder for package a to be able to communicate with the src folder for package b. I added the line: <depend package="a"/> to the manifest.xml in package b but I am unable to read the src code from package a.

Perhaps my way of thinking is wrong. If so, could you explain to me the best way to partition the code would be? If I am on the right track, what have I missed out?

Thanks in advance.