Setting up a High-level and a Mid-level controller to pass commands to Low-level controller

Hello fellow Control-enthusiasts,

I have a set-up that I want to implement, and I was wondering if any experts here could donate some wisdom regarding how to implement it.

So, I have a High-level controller (let’s call it HLC) (runs at 2 Hz) that gives me the end-effector poses, and a Mid-level-controller (let’s call it MLC) (runs at 20 Hz) which takes this and performs Differential-Ik to give joint-velocities of the manipulator. These calculated joint-velocities are then sent over to their respective joint-velocity-controller topics to be dealt-with by Ros’s Low-level controllers.

Now, some hurdles that I foresee are as follows:

  1. Both the HLC and the MLC need to be provided by the current system-state at the time of their execution. So, if the system-state ros-topics are being published at 200-messages a sec and we start at the 0th-message, then the HLC must receive the 100th and 200th message, while the MLC must receive the 10th, 20th,…, 190th, 200th message.
  2. This act of rejecting the 1st, 2nd, …, and 4th message and then choosing the 5th message to send to the MLC needs to be done by (one) worker, while another chooses the messages for the HLC.

So, all-in-all, I need 4 workers for this job:

  • Worker A: One worker to sort messages for the HLC,
  • Worker B: One worker to carry-out the task of the HLC,
  • Worker C: One worker to sort messages for the MLC,
  • Worker D: One worker to carry-out the task of the MLC.

Now, I am planning to use the multiprocessing-package of python to ensure that the timing is maintained:

  1. Workers A and C will be receiving a queue each, which will be populated at 200 Hz. Every time they receive a message, they will check if it is time to accept the current message or not. If it is time, they will pass it on to their out-going queue (A is outputting at 2 Hz | B is outputting at 20 Hz).
  2. Worker B will be receiving data at a single-rate (2 Hz), and will be sending out data at 2 Hz.
  3. Worker D will be receiving data at two-different rates: 2 Hz and 20 Hz. Before starting its work, it will compare the current-time with the expected time-of-arraival of each message.

Now, I was wondering if there is a better way of doing this, especially in regards to having two workers A and C for sorting messages. Any suggestions are welcome.

Regards,

Arnab007

Hi @arnab007 ,

Interesting situation that you have got there, but I guess the solution could be quite simple (at least in my opinion). But before I suggest you any solutions / hints, I need a bit more clarity on your problem.

Is your HLC a message transmitter or a reciver? As in, HLC only sends the current state to ROS or sends and receives “state” messages to and fro from ROS?
Similarly, is your MLC a message transmitter or a message receiver or both?

Could you provide a rough flow-chart of your system communication?

From this line, I am assuming that your HLC is only a message receiver.

From this line I am assuming that your MLC is a transmitter and a receiver, receives HLC end effector poses and outputs joint velocities.

From where are the workers receiveing the messages? From ROS or from HLC and MLC?

Worker B receives data from ROS and outputs to HLC? Or receives from HLC and outputs back to HLC after processing? Similarly for Worker D?

Just provide an image flow-chart showing the system communications so your problem can be better understood.

Regards,
Girish