42 int return_val =
onRun();
44 if (return_val != 0) {
65 cav_msgs::DriverStatus discovery_msg;
75 discovery_msg.can =
true;
78 discovery_msg.radar =
true;
81 discovery_msg.gnss =
true;
84 discovery_msg.lidar =
true;
87 discovery_msg.roadway_sensor =
true;
90 discovery_msg.comms =
true;
93 discovery_msg.controller =
true;
96 discovery_msg.camera =
true;
99 discovery_msg.imu =
true;
102 discovery_msg.trailer_angle_sensor =
true;
105 discovery_msg.lightbar =
true;
109 std::invalid_argument(
"Unsupported DriverType provided by getDriverTypes");
DriverType
Enum defining the different possible types of drivers.
Node class which connects to the ROS network.
void spin(double rate) const
Begin the ros node.
std::string getGraphName() const
Returns the fully qualified name of this node in the ROS network graph.
void publishDataNoHeader(std::string topic, T msg)
Publish data with no header on a desired topic.
void setSpinCallback(std::function< bool()> cb) const
Set the spin callback for the ros node.
void init()
Initialize the CARMA Node Handle pointer for the MockDriverNode (must be called before spin)
void addPub(T comm)
Function to add a publisher from a ROSComms object.
MockDriverNode getMockDriverNode() const
Returns the mock driver node for the mock driver (used for testing)
virtual int onRun()=0
Pure virtual method which must be implemented by child classes. This method will be run once at start...
virtual bool onSpin()
Virtual method which child classes can override to add functionality which will occur during each spi...
ros::Time last_discovery_pub_
const std::string driver_discovery_topic_
ROSCommsPtr< cav_msgs::DriverStatus > driver_discovery_pub_ptr_
MockDriverNode mock_driver_node_
void driverDiscovery()
Helper function to publish the driver discovery message.
bool spinCallback()
Callback which will be triggered at the rate specified by getRate(). This callback will also trigger ...
int run()
A function to initialize the publishers and subsricers and start the node. In child classes,...
virtual unsigned int getRate()=0
Pure virtual method that returns the desired operational rate of a child class.
virtual std::vector< DriverType > getDriverTypes()=0
Pure Virtual method which child classes must override that returns the list of all driver types that ...
virtual uint8_t getDriverStatus()=0
Pure Virtual method. Returns an integer value which corresponds to the cav_msgs/DriverStatus enum fel...