DIT168 Group9  0.9
Miniature remote-controlled vehicle using OpenDavinci and Libcluon
V2VService Class Reference

Public Member Functions

 V2VService (std::string ip, std::string id, std::string partnerIp, std::string partnerId, std::string speed_after, std::string left, std::string right, uint16_t queue_max)
 
void announcePresence ()
 
void followRequest ()
 
void followResponse ()
 
void stopFollow (std::string vehicleIp)
 
void leaderStatus (float speed, float steeringAngle, uint8_t distanceTraveled)
 
void followerStatus ()
 

Public Attributes

std::map< std::string, std::string > presentCars
 

Detailed Description

Definition at line 34 of file V2VService.hpp.

Constructor & Destructor Documentation

◆ V2VService()

V2VService::V2VService ( std::string  ip,
std::string  id,
std::string  partnerIp,
std::string  partnerId,
std::string  speed_after,
std::string  left,
std::string  right,
uint16_t  queue_max 
)

Implementation of the V2VService class as declared in V2VService.hpp

Definition at line 88 of file V2VService.cpp.

Member Function Documentation

◆ announcePresence()

void V2VService::announcePresence ( )

This function sends an AnnouncePresence (id = 1001) message on the broadcast channel. It will contain information about the sending vehicle, including: IP, port and the group identifier.

Definition at line 246 of file V2VService.cpp.

◆ followerStatus()

void V2VService::followerStatus ( )

This function sends a FollowerStatus (id = 3001) message on the leader channel.

Parameters
speed- current velocity
steeringAngle- current steering angle
distanceFront- distance to nearest object in front of the car sending the status message
distanceTraveled- distance traveled since last reading

Definition at line 331 of file V2VService.cpp.

◆ followRequest()

void V2VService::followRequest ( )

This function sends a FollowRequest (id = 1002) message to the IP address specified by the parameter vehicleIp. And sets the current leaderIp field of the sending vehicle to that of the target of the request.

Definition at line 264 of file V2VService.cpp.

◆ followResponse()

void V2VService::followResponse ( )

This function send a FollowResponse (id = 1003) message and is sent in response to a FollowRequest (id = 1002). This message will contain the NTP server IP for time synchronization between the target and the sender.

Definition at line 281 of file V2VService.cpp.

◆ leaderStatus()

void V2VService::leaderStatus ( float  speed,
float  steeringAngle,
uint8_t  distanceTraveled 
)

This function sends a LeaderStatus (id = 2001) message on the follower channel.

Parameters
speed- current velocity
steeringAngle- currentFREQ steering angle
distanceTraveled- distance traveled since last reading

Definition at line 346 of file V2VService.cpp.

◆ stopFollow()

void V2VService::stopFollow ( std::string  vehicleIp)

This function sends a StopFollow (id = 1004) request on the ip address of the parameter vehicleIp. If the IP address is neither that of the follower nor the leader, this function ends without sending the request message.

Parameters
vehicleIp- IP of the target for the request

Definition at line 300 of file V2VService.cpp.


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