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

Created estop #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Created estop #10

wants to merge 3 commits into from

Conversation

dev10110
Copy link
Member

No description provided.

@dev10110 dev10110 changed the title Draft: created estop Created estop Sep 15, 2022
@dev10110
Copy link
Member Author

@hardikparwana tested, it works. Ready to merge.

@dev10110
Copy link
Member Author

@hardikparwana can you confirm whether this is ready to be merged in?

@chenrc98
Copy link

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.

Copy link

@chenrc98 chenrc98 left a 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>());

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();
    };

Copy link
Member Author

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));
}

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:

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>());

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));
}

Copy link
Member Author

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?

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.

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

Successfully merging this pull request may close these issues.

2 participants