Hi @all,
I want to control a robot via ros2 topics with high frequency. I managed to implement the publishing of message via dyamics_callback functions. However, my current implementation uses the simROS2 subscriber callback. I could not figure out when these callbacks are called.
Are simROS2 callbacks triggered by the main script? How can I trigger them by the physics engine?
Kind regards,
Heiko
Are simROS2 subscriber callback dependend on simulation dt or dynamics dt?
Re: Are simROS2 subscriber callback dependend on simulation dt or dynamics dt?
Hello,
as far as I can tell, you can't directly influence when the spin function is called internally: it is automatically called before each simulation step (among other). The only possibility you have would be to reduce the simulation dt to the same value as the dynamics dt. That will slow down everything, since every script will be called more often. Let me know how that works.
Cheers
as far as I can tell, you can't directly influence when the spin function is called internally: it is automatically called before each simulation step (among other). The only possibility you have would be to reduce the simulation dt to the same value as the dynamics dt. That will slow down everything, since every script will be called more often. Let me know how that works.
Cheers
Re: Are simROS2 subscriber callback dependend on simulation dt or dynamics dt?
Hi,
that is the problem. I reduced the simulation dt to the dynamics dt, but this makes the simulation too slow.
This gives me exactly the opposite of what I want to achieve. The message frequency is thus reduced.
Where is the scubscriber call handled in simROS2? Maybe I can find a fix in the plugin.
Kind regrards,
Heiko
that is the problem. I reduced the simulation dt to the dynamics dt, but this makes the simulation too slow.
This gives me exactly the opposite of what I want to achieve. The message frequency is thus reduced.
Where is the scubscriber call handled in simROS2? Maybe I can find a fix in the plugin.
Kind regrards,
Heiko
Re: Are simROS2 subscriber callback dependend on simulation dt or dynamics dt?
You can try to add a new API function to handle that (simROS2.spinSome):
In src/sim_ros2_interface.cpp:
In meta/callbacks.xml:
If that works fine, we can make this modification permanent.
Cheers
In src/sim_ros2_interface.cpp:
Code: Select all
void spinSome(spinSome_in *in, spinSome_out *out)
{
rclcpp::spin_some(node);
}
Code: Select all
<command name="spinSome">
<description>Calls spin_some(node).</description>
<params>
</params>
<return>
</return>
</command>
Cheers