0
$\begingroup$

I've been working with ros2 for a few months now, and pretty much nobody at my university has used it in the past ten years. I'm doing control on a quadrupedal robot, and I need to write a state estimator. For the sake of realtime stability, and because the process will be pretty lightweight, I want to keep it within ros2_control. I don't quite know how best to do this, though, and I'm having trouble finding much information on the internet. Ideally, the state estimator would be a process which takes information from joint and IMU state interfaces, and does some sensor fusion and kinematics to output new state interfaces representing things like the contact state of each foot, or the cartesian position of certain frames. I can see a few options:

  1. Make a regular ControllerInterface
  2. Make a ChainableControllerInterface
  3. Make a HardwareInterface

Option 1 is pretty much ruled out by this page in the docs, which says that a standard ControllerInterface cannot export state interfaces.

Option 2 seems reasonable, but in my attempts to implement I'm running into an issue about publishing reference interfaces. If I attempt to export no reference interfaces, I get an error saying that a ChainableController must export at least one reference interface. If I attempt to export a dummy reference interface, I get an error saying:

[gazebo-3] [FATAL] [1731706720.361814705] [controller_manager]: Creation of the reference interfaces failed with following error: The internal storage for reference values 'reference_interfaces_' variable has size '0', but it is expected to have the size '1' equal to the number of exported reference interfaces. Please correct and recompile the controller with name 'state_estimator' and try again.

regardless of how many reference interfaces are returned by the on_export_reference_interfaces() function (confirmed with some logging). The info I've found on the ChainableControllerInterface type, and reference interfaces in general, is sparse. I like this option, though, because it feels the most philosophically in-line with how this should be implemented.

Option 3 feels wrong to me, because as I understand the HardwareInterface, it's supposed to represent a physical piece of hardware. I have HardwareInterfaces for all of my motors, sensors, etc, but a state estimator feels like it doesn't belong here. This option would export state interfaces without any sort of dummy interface workarounds, though, so I might be wrong about that.

So, my questions are:

  • Assuming the state estimator process is lightweight, is it reasonable to keep it contained within ros2_control?
  • If it is reasonable, what would be the best way of implementing it in ros2_control?
  • What are some resources I could use to understand this part of ros2_control?

I'm using ros2 Jazzy in a Docker container.

$\endgroup$

1 Answer 1

0
$\begingroup$

Yes, it is reasonable to implement this in ros2_control. Even if the estimator process is not lightweight, you could implement it as an asynchronous controller with a lower update rate.

The possibility of chaining state interfaces is rather new, and there are not a lot of examples unfortunately. But have a look at this years workshop at ROSCon(repo). The chained filter is exactly what you are looking for.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.