I don't think there is a specific way to do that using the existing sync policies. To handle your case you would have to implement a new sync policy https://github.com/ros/ros_comm/tree/...
A simpler way would probably to only sync the two high frequency topics, buffer messages on the third topic and dequeue messages from the buffer in the two-topic callback, with some timestamp checking of course.
Edit: Here is some pseudocode to get you started but you need to put some effort into solving your problem instead of searching for an existing implementation. Please mark this question as answered if this has helped.
void processTwo(const T1 &t1, const T2 &t2);
void processThree(const T1 &t1, const T2 &t2, const T3 &t3);
std::deque<T3> buffer_t3;
const double sync_tolerance_seconds = 0.1; // Some window of tolerance
void callbackTwoTopics(const T1 &t1, const T2 &t2) {
if (buffer_t3.empty()) {
// You could also do timestamp checks here and decide to buffer your
// messages and wait for t3
processTwo(t1, t2);
return;
}
auto&& t3 = buffer_t3.front();
ros::Time&& stamp1 = t1.header.stamp;
ros::Time&& stamp3 = t3.header.stamp;
double time_diff_seconds = stamp1.toSeconds() - stamp3.toSeconds();
if (abs(time_diff_seconds) < sync_tolerance_seconds) {
// t3 is usable
buffer_t3.pop_front();
processThree(t1, t2, t3);
} else if (time_diff_seconds > 0) {
// t3 is too far in the future, leave it in the buffer for later
} else if (time_diff_seconds < 0) {
// t3 is too far in the past, drop it
buffer_t3.pop_front();
}
}
void callbackOtherTopic(const T3 &t3) {
buffer_t3.push_back(t3);
process();
}