Codelet receive multiple messages

Is there any methods to tick by one message in a codelet while receiving multiple messages from several channels?

You mean ticking on just one of the received channels?

You can use tickOnMessage(rx_specific_channel())

1 Like

Hello 15652964830, any update?

I would like to know how can we receive multiple channels in the same codelet. Since tickOnMessage(rx_specific_channel()) ticks on one channel. How does one have different callbacks for the different channels. I have a specific case that needs debugging. I have added the header and source files as well.
charge.hpp

namespace isaac {
class Charge : public alice::Codelet {
 public:
  void start() override;
  void tick() override;
 ISAAC_PROTO_RX(RangeScanProto, trigger_tim_6);
 ISAAC_PROTO_RX(ImuProto, trigger_imu);
};

}  // namespace isaac

ISAAC_ALICE_REGISTER_CODELET(isaac::Charge);

charge.cpp

namespace isaac {
void Charge::start() {
    tickOnMessage(rx_trigger_imu());
    // tickOnMessage(rx_trigger_tim_6());
}
void Charge::tick() {
  auto reader = rx_trigger_tim_6().getProto();
  if (reader.hasIntensities()){
    LOG_INFO("scan reader: true");
  } 

  auto imu_reader = rx_trigger_imu().getProto();
  LOG_INFO("IMU reader: %f",imu_reader.getLinearAccelerationX());
  LOG_INFO("Hi tick");
}

}  // namespace isaac

Having both the proto readers in the same tick() function results in the following error.

2021-06-28 18:14:41.785 PANIC external/com_nvidia_isaac_engine/engine/alice/hooks/message_hook.hpp@205: No message available

Is there a workaround for using multiple receiver channels in the same codelet? @shrinv @TeresaC

That is correct. Codelet has one callback for tick regardless of channel. You can tick when multiple channels all have messages available at the same time using Codelet::synchronize(), or you can call tickOnMessage() multiple times to add to the list of triggers for tick(). Within tick(), you can check rx_XXX().available() to see if that channel actually has a message pending or not.

Thanks! Yes calling tickOnMessage() multiple times with rx_XX().available() works for me. While the individual channels got the codelet ticking, when I tried to synchronize two different channels the codelet didn’t tick.

void start() {
tickOnMessage(rx_XX());
synchronize(rx_XX(), rx_YY());
}
void tick() {
  if(rx_XX().available()) {
     LOG_INFO("XX");
  } 
  if(rx_YY().available()) {
    LOG_INFO("YY");
  } 
}

I then set the same tick_period for both the codelets transmitting through those channels, which resulted in no difference. Am I missing something here? When does synchronize fail?

If you use synchronize(), then the messages it receives have to have almost the exact same timestamp before you get a callback. Setting the transmitting codelets to the same tick frequency wouldn’t mean they are in phase. You could try having one transmitter broadcast at some multiple of the frequency of the other to make this work perhaps.

@hemals I have experimented with different frequency combinations. (f,2f), (2f, 3f), etc. I don’t understand what does “in phase” here mean in Isaac transmitters. Also, the channels I am trying to fuse are the outputs of ROS bridges. ( I made sure all the input frequencies of ROS nodes, tick frequencies are the same).