TOTON95 / Bebop_ROS_Examples

Bebop Drone flying programmatically with ROS and Bebop_Driver
MIT License
15 stars 7 forks source link

Como podria editar el codigo de follow_color #3

Open josueom18 opened 5 years ago

josueom18 commented 5 years ago

Como podria hacer para que siga rectangulos negros colocados es un circuito de forma de infinito, seria algo asi como detecto el rectangulo, avanzo, detecto otro rectangulo avanzo, como le podria hacer o algun tutorial que me recomiendes

TOTON95 commented 5 years ago

I am sorry, but I have to ask you from now on to write in English since many people is using this resource and I think that we should keep the essence of Open Source and try to give the best of ourselves to the community. That aside, You are looking to write a program using an algorithm to follow shapes instead of colors, you may extract some ideas from the line follower programs used in several contests, but just applying it to a camera instead of simpler sensors. Keep in mind that you have to design some kind of tracker able to recover if it goes too fast. Now, you also mentioned me that you had problems to understand that program at the email (nothing relevant for other users, it contained the same information above), feel free to ask me any doubt that you may have.

josueom18 commented 5 years ago

Okay, I'm sorry, only English understood, I have a problem in following the color, when I click on the color I want to follow, I begin to detect other objects and the drone becomes unstable, which parameter in code should move? As I would like to know how to reduce the angle of detection, I believe this? Is the measurement me in mm or cm? Thanks in advance

const double max_obj_area = 100000; //Maximum area reference of the object const double min_obj_area = 690; //Minimum area reference of the object

TOTON95 commented 5 years ago

Well, that can be fixed using the slidebars that appear once you start the program, you have to change the position of these controls until you have a decent result, be aware that it may depend of the object's material, the environment, camera, etc....

Now, to reduce the area of detection or transform it you may add a ROI (Region Of Interest) with the special size that you want without being bigger than the image, that portion of code corresponds to the amount of pixels found at the image it is used as a filter to determine if the drone must proceed to move or stop.

josueom18 commented 5 years ago

Oh nice, I'm documenting ROI.

A question that means the number you go after takeoff? The height in mm? takeoff_bebop = nh_.advertise<std_msgs::Empty>("/bebop/takeoff",1000); //Publish data to the take-off topic

One more question, how can I move the camera so that it points to the ground? Try with

rostopic pub -r 1 /bebop/camera_control geometry_msgs/Twist -- '[0.0, 0.0, 0.0]' '[0.0,0.5,0.0]'

but it did not work

TOTON95 commented 5 years ago

You might want to take a look to the variables at the ROS wiki (Empty and Twist) also, I'd like to remind you that this repository uses Bebop Autonomy as dependency with its limits, the take off height is already set into the drone by the original firmware and also some actions may not be performed until the drone is flying (e.g. the lecture from the ultrasonic sensor)


From: josueom18 notifications@github.com Sent: Wednesday, October 24, 2018 5:10:13 PM To: TOTON95/Bebop_ROS_Examples Cc: Alexis Guijarro; Comment Subject: Re: [TOTON95/Bebop_ROS_Examples] Como podria editar el codigo de follow_color (#3)

Oh nice, I'm documenting ROI.

A question that means the number you go after takeoff? The height in mm? takeoffbebop = nh.advertise("/bebop/takeoff",1000); //Publish data to the take-off topic

One more question, how can I move the camera so that it points to the ground? Try with

rostopic pub -r 1 /bebop/camera_control geometry_msgs/Twist -- '[0.0, 0.0, 0.0]' '[0.0,0.5,0.0]'

but it did not work

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/TOTON95/Bebop_ROS_Examples/issues/3#issuecomment-432845717, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ARc4aYK96C6YdniOTNgU68UcyQTM-X1xks5uoOVFgaJpZM4X3QXl.

josueom18 commented 5 years ago

Hello friend, the state reviewing the code and every day, entering more, achieve, follow, a dotted line, in a straight line, however, the circuit has the form of 8 (finfinite), I could help implement the part of the turn in your own axis, here I will attach the modifications you make. or what would be the conditional to use?

`void move_drone(cv::Mat& image) {

if (posX >= 0 && posY >= 0)
{
    if (posX = drone_center.x)
    {
        cmd_vel_bebop.angular.x = bebop_forward;
        std::cout << "Mover enfrente" << std::endl;
    }
    if (posX < drone_center.x)
    {
        cmd_vel_bebop.angular.z = bebop_turn_velocity;                      
        std::cout << "Move Left" << std::endl;
    }
    if (posX > drone_center.x)
    {
        cmd_vel_bebop.angular.z = -bebop_turn_velocity;
        std::cout << "Move Right" << std::endl;
    }
    if (posY > drone_center.y)
    {
        cmd_vel_bebop.linear.z = -bebop_velocity;
        std::cout << "Move Downwards" << std::endl;
    }
    if (posY <  drone_center.y)
    {
        cmd_vel_bebop.linear.z = bebop_velocity;
        std::cout << "Move Upwards" << std::endl;
    }  
    if(tracking_system_armed)
    {
        cv::circle(image, cv::Point(posX, posY), 8, cv::Scalar(0, 255, 0), -1);
    }
    if(!tracking_system_armed)
    {
        cv::circle(image, cv::Point(posX, posY), 8, cv::Scalar(0, 255, 255), -1);
    }

}`
TOTON95 commented 5 years ago

So, you may want to add that modification? If so, please make a fork of this repository (Bebop_ROS_Examples, branch improvements, not the master one) , then upload your modification to your own repository and make a pull request (PR), so, in that way your contribution will be noticed by everyone.

And even add your own example if you want to release it to the community.

P.s. I know that it may be a long process but it is the way to properly recognize your contribution.

Thanks in advance.