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

Compile error in cactus_rt: signal_handler.cc #117

Closed
raulordonezUD opened this issue Aug 13, 2024 · 7 comments · Fixed by #118
Closed

Compile error in cactus_rt: signal_handler.cc #117

raulordonezUD opened this issue Aug 13, 2024 · 7 comments · Fixed by #118

Comments

@raulordonezUD
Copy link

Hello, first of all thank you for this very helpful code, which I am trying to adapt for a real-time controls application.

I downloaded cactus_rt and am trying to compile it on Linux Debian 12. When 'make debug' is invoked I receive the following error:

      signal_handler.cc:34:10: error: 'ignore' is not a member of 'std'

Commenting out line 34 allows compilation, but I am confused why the compiler complains about 'ignore'?

Thanks!

-Raul

@shuhaowu
Copy link
Contributor

Not sure. Perhaps there's an issue with your compiler. std::ignore is a standard since c++11

@shuhaowu shuhaowu reopened this Aug 14, 2024
@raulordonezUD
Copy link
Author

raulordonezUD commented Aug 15, 2024 via email

@shuhaowu
Copy link
Contributor

Ah you're right, we're missing an include. I think the proper one should be <utility> according to cppreference. Will update it.

@shuhaowu
Copy link
Contributor

Thanks for reporting this. The include is a bit of a mess last time I checked and depends on a lot of implicit behavior. It really needs to be cleaned up at some point.

Maybe when we port this library to use C++ modules.

@raulordonezUD
Copy link
Author

raulordonezUD commented Aug 16, 2024 via email

@shuhaowu
Copy link
Contributor

Ah yeah it should be very simple. Unfortunately the issue is the examples are all very rudimentary and undocumented as the library has undergone some changes. Some of the examples are using practices I don't particularly like either. Let me update the simple example right now so you can maybe use it as a base.

@shuhaowu
Copy link
Contributor

I've updated the simple example with a simpler structure and more comments. Maybe this helps. The PR is here: #119. You can look at the simple_example now in the code base as I just merged it. https://github.com/cactusdynamics/cactus-rt/blob/master/examples/simple_example/main.cc

If you copy that structure, all you need to do is to fill out the Loop method inside the ExampleRTThread (although you probably want to rename that). The way I do it is like:

bool Loop(int65_t elapsed_ns) noexcept override {
  auto data = ReadEncoder();
  auto output = RunPid(data);
  WriteToMotor(output);
  return false;
}

Of course, then in the same ExampleRTThread you would have to implement the functions of ReadEncoder, RunPid, and WriteToMotor.

You can debug with the built-in logger that we have. I have an example with LOG_INFO_LIMIT, but in the Loop function you an also just use LOG_INFO(Logger(), "hello world {}", my_value) as well.

Hope that helps!

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 a pull request may close this issue.

2 participants