Plc communication and control class. More...
#include <plc.h>
Public Member Functions | |
Mandatory common functions | |
These functions are mandatory to all low level classes in the atlacar_base namespace. All these must operate in a similar fashion across class. The constructor must only initialize variable values, all major initializations must be done in the init() function, setupMessaging() subscribes and advertises command messages and status (in that order). The loop() function will block the program in a constant loop relaying information to the hardware. The loop() function can operate in two fashions: setting a spin rate and calling ros::spinOnce() or calling directly ros::spin() if the command callback has been setup properly. In this class (Plc) it works by calling the ros::spinOnce() at a predefined rate.
| |
Plc (const ros::NodeHandle &nh, std::string ip, std::string port) | |
Class constructor. More... | |
~Plc () | |
Class destructor. More... | |
void | init () |
Initialize the class. More... | |
void | setupMessaging () |
Start ros message subscribing and advertising. More... | |
void | loop () |
Start main control loop. More... | |
Private Member Functions | |
void | commandCallback (const atlascar_base::PlcCommandPtr &command) |
Command message handler. More... | |
void | diagnostics (diagnostic_updater::DiagnosticStatusWrapper &stat) |
Diagnostics function handler. More... | |
void | newData (string data) |
This function will be called (asynchronously) upon arrival of new data. More... | |
int | sendCommand (void) |
Send a global command down to the plc. More... | |
int | sendMessage (char *message_string) |
Send a message. More... | |
Private Attributes | |
Class variables | |
The class variables can be both public or private. They should preferably be private whenever possible. | |
SimpleCalibration | steering_wheel_calibration_ |
Calibration of the steering wheel from the plc. More... | |
SimpleCalibration | steering_wheel_to_plc_calibration_ |
Calibration of the steering wheel to the plc. More... | |
SimpleCalibration | brake_calibration_ |
Calibration of the brake pedal. More... | |
SimpleCalibration | clutch_calibration_ |
Calibration of the clutch pedal. More... | |
std::string | server_ip_ |
Ip of the Plc server. More... | |
std::string | server_port_ |
Port of the Plc server. More... | |
ros::NodeHandle | nh_ |
Ros node handler. More... | |
ros::Subscriber | command_sub_ |
Ros command subscriber. More... | |
ros::Publisher | status_pub_ |
Ros status publisher. More... | |
TopicQueuePriority < atlascar_base::PlcCommandPtr > | command_queue_ |
Command queue holding class. More... | |
int | connection_status_ |
Current connection status. More... | |
bool | verbose_ |
Verbose mode. More... | |
char | received_message_ [1024] |
Message received. More... | |
atlascar_base::PlcCommandPtr | command_ |
Command message pointer. More... | |
atlascar_base::PlcCommandPtr | safety_command_ |
Safety command message pointer. More... | |
atlascar_base::PlcStatus | status_ |
Status message. More... | |
diagnostic_updater::Updater | updater_ |
Diagnostics class. More... | |
diagnostic_updater::HeaderlessTopicDiagnostic | status_freq_ |
Frequency diagnostics tool. More... | |
double | status_max_frequency_ |
Maximum admissible frequency. More... | |
double | status_min_frequency_ |
Minimum admissible frequency. More... | |
boost::asio::io_service | io_service_ |
Input/Output communication service. More... | |
AsyncClient | comm_ |
Asynchronous tcp/ip communication object. More... | |
Plc communication and control class.
This class implements the Ethernet and Plc communication protocol in order to establish a communication with it. The communication is maintained and a status message is continuously published.
atlascar_base::Plc::Plc | ( | const ros::NodeHandle & | nh, |
std::string | ip, | ||
std::string | port | ||
) |
|
private |
|
inlineprivate |
void atlascar_base::Plc::init | ( | ) |
void atlascar_base::Plc::loop | ( | ) |
|
private |
|
private |
|
private |
void atlascar_base::Plc::setupMessaging | ( | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |