Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Como podria editar el codigo de follow_color #3

Open
josueom18 opened this issue Oct 24, 2018 · 7 comments
Open

Como podria editar el codigo de follow_color #3

josueom18 opened this issue Oct 24, 2018 · 7 comments
Labels

Comments

@josueom18
Copy link

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
Copy link
Owner

TOTON95 commented Oct 24, 2018

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
Copy link
Author

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
Copy link
Owner

TOTON95 commented Oct 24, 2018

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
Copy link
Author

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
Copy link
Owner

TOTON95 commented Oct 24, 2018 via email

@josueom18
Copy link
Author

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
Copy link
Owner

TOTON95 commented Oct 26, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants