Subscribe to custom message

Hi Hubert,

Here is the main.cpp file:

#include "hFramework.h"
#include "hCloudClient.h"
#include "ros.h"
#include "VehicleControl.h"

#include <stdio.h>


using namespace hFramework;


ros::NodeHandle nh;

int publish_counter = 0;

void vehicleControlCallback(const &msg) {
   
}

void initVehicleControlSubscriber() {
    ros::Subscriber vehicle_control_sub = nh.subscribe("/VehicleControl",vehicleControlCallback);
}


void hMain() {
    /* Initializes communication with the Raspberry Pi */
    RPi.init(500000);
    platform.begin(&RPi);
    nh.getHardware()->initWithDevice(&platform.LocalSerial);
    nh.initNode();
	
	uint32_t t = sys.getRefTime();
	sys.setLogDev(&Serial);
	
	/* INIT PUBLISHERS */
	
	/* INIT SUBSCRIBERS */
	initVehicleControlSubscriber();

	/* CREATE TASKS */

	while(true)	{
		nh.spinOnce();
		publish_counter++;
		if (publish_counter > 10) {
		    /* Execute simple code here, but rather in their specific tasks */
		    
		    
			publish_counter = 0;
		}

		sys.delaySync(t, 10);
	}
}

This is on one of the CORE2.

(I put the error code in here, but it was totally not relevant so I deleted it for future readers of this topic, to prevent confusion)

I honestly don’t know:

  • How can I create a custom message on the CORE2, so a node on the Raspberry Pi 3 of the same CORE2-ROS for example can read that?
  • How can the CORE2 read the message of a topic on the Raspberry Pi 3 of the same CORE2-ROS?