19#include <carma_utils/CARMAUtils.h>
37 boost::shared_ptr<ros::CARMANodeHandle>
cnh_;
64 pub.pub =
cnh_->advertise<
decltype(comm->getTemplateType())>(comm->getTopic(), comm->getQueueSize());
65 pub.base_topic_name = comm->getTopic();
77 comm->getTopic(), comm->getQueueSize(), &
ROSComms<
decltype(comm->getTemplateType())>
::callback, comm));
88 comm->getTopic(), &
ROSComms<
decltype(comm->getReqType()),
decltype(comm->getResType())>
::callback, comm));
93 void spin(
double rate)
const;
107 template <
typename T>
115 throw std::invalid_argument(
"Attempted to publish to topic " + topic +
" but no publisher was found");
116 pub->pub.publish(msg);
131 template <
typename T>
139 throw std::invalid_argument(
"Attempted to publish to topic " + topic +
" but no publisher was found");
140 pub->pub.publish(msg);
Node class which connects to the ROS network.
std::vector< ros::Time > getTimeStamps()
Returns a vector of all the time stamps of the data that would be published (only when it is a dummy ...
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.
std::vector< ros::Time > time_stamps_
void addSub(T comm)
Function to add a subscriber from a ROSComms object.
std::vector< std::string > getTopics()
Returns a vector of all the topics that the node would publish to (only when it is a dummy node)....
std::vector< ros::Subscriber > subscribers_
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 addSrv(T comm)
Function to add a service from a ROSComms object.
std::vector< ros::ServiceServer > services_
std::vector< PublisherWapper > publishers_
std::vector< std::string > topics_
void publishData(std::string topic, T msg)
Publish data on a desired topic.
void addPub(T comm)
Function to add a publisher from a ROSComms object.
boost::shared_ptr< ros::CARMANodeHandle > cnh_
bool isDummy()
Returns if the node is a dummy node. Used for testing.
This class is used to transfer all the information required to initialize ros topics/services.
bool callback(cav_srvs::PlanTrajectory::Request &req, cav_srvs::PlanTrajectory::Response &res)
Wrapper for publishers which allow their base topic name to be extracted.
std::string base_topic_name