Hi,
In the execercise 6.1 solution. you have created a new template variable ( CallBackROSMessageType) for CallbackToTopic function. But, you never used it inside the function. I am wondering is it a type or is there any explanation for that. I have pasted the related lines of code below
template <typename CallBackROSMessageType>
void CallbackToTopic(const typename ROSMessageType::ConstPtr &msg) {
// the uint8 is an alias of unsigned char, therefore needs casting to int
ROS_INFO_STREAM(
"Call Back Topic Image Data[0]=" << static_cast<int>(msg->data[0]));
};
In the CallbackToTopic, we NEED to declare a NEW template header. And it has a different name because otherwise it would shadow the one declared at the top of the class. Also because the CallbackToTopic doesn’t necessarily need the same number of template type variables. It mght need more!
We use another name so it doesn’t shadow the ROSMessageType. Its that the only reason why we put it like this. But its true that inside ewe are still using the ROSMessageType. If you place the same one, it will give issues.