|
EtherCAT Client Library Code 0.0.1
EtherCAT Client library that uses different communication protocols with EtherCAT Master server.
|

Classes | |
| struct | homing_par_t |
| struct | period_par_t |
| struct | smooth_par_t |
Public Types | |
| typedef std::shared_ptr< EcReplCmd > | Ptr |
| using | m_ref_t |
| using | motors_ref_map = std::map<int32_t,m_ref_t> |
Public Member Functions | |
| EcReplCmd (std::string zmq_uri, int timeout) | |
| Constructor of EcReplCmd Class. It needs of zmq uri (TCP/UDP) and of a timeout. | |
| ~EcReplCmd () | |
| Destructor of EcReplCmd Class-. | |
| EcReplFault | Ecat_Master_cmd (iit::advr::Ecat_Master_cmd_Type type, std::map< std::string, std::string > args, std::string &msg) |
| EtherCAT Master command for stopping, starting the EtherCAT Master Server and GET EtherCAT information of the slaves. | |
| EcReplFault | FOE_Master (std::string filename, unsigned long int password, std::string mcu_type, long int slave_pos, long int board_id, std::string &msg) |
| FOE Master command for flash a new firmare for a specific slave. | |
| EcReplFault | Slave_SDO_info (iit::advr::Slave_SDO_info_Type type, long int board_id, std::string &msg) |
| Slave SDO Information is a command to get the SDO datas of a specific slave. | |
| EcReplFault | Slave_SDO_cmd (long int board_id, std::vector< std::string > rd_sdo, std::map< std::string, std::string > wr_sdo, std::string &msg) |
| The slave SDO command is typical used to read the values of SDO of specific slave in pre-operational and operational state of the EtherCAT Master Server. This command is also used to write the values of the SDO in calibration phase ("pre-operational"). | |
| EcReplFault | Flash_cmd (iit::advr::Flash_cmd_Type type, long int board_id, std::string &msg) |
| Flash command for save, load and load default sdo of the FLASH. | |
| EcReplFault | Ctrl_cmd (iit::advr::Ctrl_cmd_Type type, long int board_id, float value, std::vector< float > gains, std::string &msg) |
| Control command is used to control the motors or start the auto-calibration mechanisms. | |
| EcReplFault | Trajectory_Cmd (iit::advr::Trajectory_cmd_Type type, std::string name, long int board_id, homing_par_t homing_par, period_par_t period_par, smooth_par_t smooth_par, std::string &msg) |
| Command to send a trajectory to the slave. | |
| EcReplFault | Trj_queue_cmd (iit::advr::Trj_queue_cmd_Type type, std::vector< std::string > trj_names, std::string &msg) |
| Command to start or clear a trajectoy using its name. | |
| EcReplFault | PDOs_aux_cmd (std::vector< aux_cmd_message_t > aux_cmds, std::string &msg) |
| Command to release or engage motors brake. | |
| EcReplFault | Motors_PDO_cmd (motors_ref_map motors_references) |
| Command to send references. | |
| std::string | get_zmq_uri () |
| Return ZMQ URI for the ZMQ communication. | |
| int | get_zmq_timeout () |
| Return timeout of ZMQ communication. | |
| void | set_zmq_timeout (int timeout) |
| set timeout of ZMQ communication. | |
| void | set_motor_type_map (std::map< int32_t, std::string > motor_type_map) |
Private Member Functions | |
| void | check_advrf_motor_gains (iit::advr::Gains_Type ctrl_type, std::vector< float > &gains) |
| void | zmq_do_cmd (iit::advr::Repl_cmd pb_cmd, std::string &msg, int timeout, EcReplFault &fault) |
| This method is responsible to perform the ZMQ commad to EtherCAT Server. | |
| void | zmq_cmd_recv (std::string &msg, iit::advr::CmdType cmd_sent, zmq::socket_t &socket, EcReplFault &fault) |
| bool | zmq_cmd_send (iit::advr::Repl_cmd pb_cmd, zmq::socket_t &socket, EcReplFault &fault) |
Private Attributes | |
| std::string | _zmq_uri |
| int | _timeout |
| std::map< int32_t, std::string > | _advrf_motor_map |
| using EcReplCmd::m_ref_t |
| EcReplCmd::EcReplCmd | ( | std::string | zmq_uri, |
| int | timeout ) |
Constructor of EcReplCmd Class. It needs of zmq uri (TCP/UDP) and of a timeout.
| zmq_uri | p_zmq_uri: ZMQ URI to create the communication. |
| timeout | p_timeout: Timeout for the communication. |
| EcReplFault EcReplCmd::Ctrl_cmd | ( | iit::advr::Ctrl_cmd_Type | type, |
| long int | board_id, | ||
| float | value, | ||
| std::vector< float > | gains, | ||
| std::string & | msg ) |
Control command is used to control the motors or start the auto-calibration mechanisms.
| type | p_type: Type of control command, i.e position: send a position to the slave. |
| board_id | p_board_id: Board Id of the slave. |
| value | p_value: value to send (rad, rad/s, Nm or ON/OFF or nothing). |
| gains | p_gains: Optional value to set the gains of the slave. |
| msg | p_msg: return feedback message from ZMQ communication. |
| EcReplFault EcReplCmd::Ecat_Master_cmd | ( | iit::advr::Ecat_Master_cmd_Type | type, |
| std::map< std::string, std::string > | args, | ||
| std::string & | msg ) |
EtherCAT Master command for stopping, starting the EtherCAT Master Server and GET EtherCAT information of the slaves.
| type | Ecat_Master_cmd_Type: START_MASTER, STOP_MASTER, GET_SLAVES_DESCR. |
| args | std::map of string : for istance start the master with some parameters... ({‘app_mode’:’run_mode’,’use_ecat_pos_as_id’:’false’}). |
| msg | string msg: return feedback message from ZMQ communication. |
| EcReplFault EcReplCmd::Flash_cmd | ( | iit::advr::Flash_cmd_Type | type, |
| long int | board_id, | ||
| std::string & | msg ) |
Flash command for save, load and load default sdo of the FLASH.
| type | p_type: Save, Load and Load default SDO parameters of the flash. |
| board_id | p_board_id: Board Id of the slave. |
| msg | p_msg: return feedback message from ZMQ communication. |
| EcReplFault EcReplCmd::FOE_Master | ( | std::string | filename, |
| unsigned long int | password, | ||
| std::string | mcu_type, | ||
| long int | slave_pos, | ||
| long int | board_id, | ||
| std::string & | msg ) |
FOE Master command for flash a new firmare for a specific slave.
| filename | p_filename: Filename to use to flah. |
| password | p_password: Password for flashing (0xDAD0 [c28] 0xA550 [m3]) |
| mcu_type | p_mcu_type: Microcontroller type m3 or c28. |
| slave_pos | p_slave_pos: Slave position on the EtherCAT Network. |
| board_id | p_board_id: Board Id of the slave. |
| msg | p_msg: return feedback message from ZMQ communication. |
| int EcReplCmd::get_zmq_timeout | ( | ) |
Return timeout of ZMQ communication.
| std::string EcReplCmd::get_zmq_uri | ( | ) |
Return ZMQ URI for the ZMQ communication.
| EcReplFault EcReplCmd::Motors_PDO_cmd | ( | motors_ref_map | motors_references | ) |
Command to send references.
| refs | : references motors map. |
| EcReplFault EcReplCmd::PDOs_aux_cmd | ( | std::vector< aux_cmd_message_t > | aux_cmds, |
| std::string & | msg ) |
Command to release or engage motors brake.
| aux_cmds | aux_cmds: vector of aux cmd setting slave id and release or engage brakes. |
| msg | p_msg: return feedback message from ZMQ communication. |
| void EcReplCmd::set_zmq_timeout | ( | int | timeout | ) |
set timeout of ZMQ communication.
| timeout | p_timeout:... |
| EcReplFault EcReplCmd::Slave_SDO_cmd | ( | long int | board_id, |
| std::vector< std::string > | rd_sdo, | ||
| std::map< std::string, std::string > | wr_sdo, | ||
| std::string & | msg ) |
The slave SDO command is typical used to read the values of SDO of specific slave in pre-operational and operational state of the EtherCAT Master Server. This command is also used to write the values of the SDO in calibration phase ("pre-operational").
| board_id | p_board_id: Board Id of the slave. |
| rd_sdo | p_rd_sdo: read sdo vector to read the values specified in this structure. |
| wr_sdo | p_wr_sdo: write sdo map to write, using the mechanism of Key-Value (map of SDO type-value), the values of the SDO specified in this structure. |
| msg | p_msg: return feedback message from ZMQ communication. |
| EcReplFault EcReplCmd::Slave_SDO_info | ( | iit::advr::Slave_SDO_info_Type | type, |
| long int | board_id, | ||
| std::string & | msg ) |
Slave SDO Information is a command to get the SDO datas of a specific slave.
| type | p_type: It's possible to get the SDO information with the NAME or OBJECT DICTIONARY. |
| board_id | p_board_id: Board Id of the slave. |
| msg | p_msg: return feedback message from ZMQ communication. |
| EcReplFault EcReplCmd::Trajectory_Cmd | ( | iit::advr::Trajectory_cmd_Type | type, |
| std::string | name, | ||
| long int | board_id, | ||
| homing_par_t | homing_par, | ||
| period_par_t | period_par, | ||
| smooth_par_t | smooth_par, | ||
| std::string & | msg ) |
Command to send a trajectory to the slave.
| type | p_type: Homing, Sine, Smooth Trajectory. |
| name | p_name: Name of trajectory. |
| board_id | p_board_id: Board Id of the slave. |
| homing_par | p_homing_par: Structure of homing trajectory that has the time values to perform the hominh position. |
| period_par | p_period_par: Structure of periodic trajectory, in this case, a sine wave with frequency, amplitude, theta (offset), and time, |
| smooth_par | p_smooth_par: Structure of smooth trajectory having like x the time and y the position in radians. |
| msg | p_msg: return feedback message from ZMQ communication. |
| EcReplFault EcReplCmd::Trj_queue_cmd | ( | iit::advr::Trj_queue_cmd_Type | type, |
| std::vector< std::string > | trj_names, | ||
| std::string & | msg ) |
Command to start or clear a trajectoy using its name.
| type | p_type: Push (start) or clear the trajectory. |
| trj_names | p_trj_names: Name of Trajectory. |
| msg | p_msg: return feedback message from ZMQ communication. |
|
private |
This method is responsible to perform the ZMQ commad to EtherCAT Server.
| pb_cmd | protobuf command |
| msg | return feedback message from ZMQ communication. |
| timeout | timeout |
| fault | fault detected. |