-
Notifications
You must be signed in to change notification settings - Fork 0
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
Created estop #10
base: master
Are you sure you want to change the base?
Created estop #10
Conversation
@hardikparwana tested, it works. Ready to merge. |
@hardikparwana can you confirm whether this is ready to be merged in? |
It takes a few moment for the ROS2 node discovery and connect to the drone node. Therefore I think we can spin it at background and have it setup the connection between each drone and wait for a user input to trigger the estop command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having the node connection setup is more robust in the complex network environment, I would suggest these changes.
|
||
rclcpp::init(argc, argv); | ||
|
||
rclcpp::spin(std::make_shared<Estop>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to
auto estop_node = std::make_shared<Estop>();
rclcpp::executors::MultiThreadedExecutor server_exec;
server_exec.add_node(estop_node);
auto server_spin_exec = [&server_exec]() {
server_exec.spin();
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok good idea, ill make these changes, but we should wait only merge them after weve tested to see that it works.
timer_ = this->create_wall_timer( | ||
200ms, std::bind(&Estop::timer_callback, this)); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void estop() {
this->estop = true;
}
} | ||
|
||
private: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool estop = false;
rclcpp::init(argc, argv); | ||
|
||
rclcpp::spin(std::make_shared<Estop>()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Block by
int n;
std::cin >> n;
estop_node.estop();
while(rclcpp::ok()) {
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok we can do something like this. are you sure the std::cin
trick works in multithreaded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think it should work.
No description provided.