udp_com  1.1.1
Provides a flexible ROS driver for working with UDP interfaces
Public Member Functions | Private Attributes | List of all members
udp_com::UdpCom Class Reference

Implements the UDP methods for recieving and sending within the ROS ecosystem. More...

#include <udp_com.h>

Public Member Functions

 UdpCom (std::string computer_address, std::string sensor_address, uint16_t port, bool is_multicast, ros::Publisher publisher)
 
 ~UdpCom ()
 
void doReceive ()
 
size_t send (const std::vector< u_char > &data, const std::string &ip_address, const uint16_t udp_port)
 
std::string getIp ()
 Returns the src IP for the created socket.
 

Private Attributes

udp::endpoint receiver_endpoint_
 UDP endpoint receiver.
 
udp::endpoint sender_endpoint_
 UDP endpoint sender.
 
ros::Publisher udp_packet_publisher_
 ROS publisher.
 
UdpPacket udp_packet_
 UDP packet to be sent.
 
boost::asio::io_service io_service_
 UDP IO service.
 
udp::socket socket_
 UDP socket.
 
boost::thread thread_
 Thread for service.
 
std::string computer_address_
 Source (computer) IP Address.
 

Detailed Description

Implements the UDP methods for recieving and sending within the ROS ecosystem.

Constructor & Destructor Documentation

◆ UdpCom()

udp_com::UdpCom::UdpCom ( std::string  computer_address,
std::string  sensor_address,
uint16_t  port,
bool  is_multicast,
ros::Publisher  publisher 
)

Initializer constructor.

Parameters
[in]computer_addresscomputer ip address
[in]sensor_addresscamera ip address
[in]portcamera UDP port number
[in]is_multicastmulticast flag
[in]publisherROS publisher

◆ ~UdpCom()

udp_com::UdpCom::~UdpCom ( )

Destructor.

Member Function Documentation

◆ doReceive()

void udp_com::UdpCom::doReceive ( )

Recieves and publishes the UDP data.

Formats the recieved UDP data and publishes it as a ROS message.

Returns
void

◆ send()

size_t udp_com::UdpCom::send ( const std::vector< u_char > &  data,
const std::string &  ip_address,
const uint16_t  udp_port 
)

Sends data through UDP protocol.

Service send function for UDP data sending.

Parameters
[in]dataThe data to be sent.
[in]ip_addressThe devide IP address.
[in]udp_portThe device port.
Returns
size_t the number of bytes sent

The documentation for this class was generated from the following files: