EtherCAT Client Library Code 0.0.1
EtherCAT Client library that uses different communication protocols with EtherCAT Master server.
Loading...
Searching...
No Matches
EcReplCmd Class Reference
Collaboration diagram for EcReplCmd:
Collaboration graph

Classes

struct  homing_par_t
struct  period_par_t
struct  smooth_par_t
struct  aux_cmd_message_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

Member Typedef Documentation

◆ m_ref_t

using EcReplCmd::m_ref_t
Initial value:
std::tuple<int32_t,
float, float, float,
float, float, float, float, float,
uint32_t, uint32_t, float>

Constructor & Destructor Documentation

◆ EcReplCmd()

EcReplCmd::EcReplCmd ( std::string zmq_uri,
int timeout )

Constructor of EcReplCmd Class. It needs of zmq uri (TCP/UDP) and of a timeout.

Parameters
zmq_urip_zmq_uri: ZMQ URI to create the communication.
timeoutp_timeout: Timeout for the communication.

Member Function Documentation

◆ Ctrl_cmd()

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.

Parameters
typep_type: Type of control command, i.e position: send a position to the slave.
board_idp_board_id: Board Id of the slave.
valuep_value: value to send (rad, rad/s, Nm or ON/OFF or nothing).
gainsp_gains: Optional value to set the gains of the slave.
msgp_msg: return feedback message from ZMQ communication.
Returns
fault

◆ Ecat_Master_cmd()

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.

Parameters
typeEcat_Master_cmd_Type: START_MASTER, STOP_MASTER, GET_SLAVES_DESCR.
argsstd::map of string : for istance start the master with some parameters... ({‘app_mode’:’run_mode’,’use_ecat_pos_as_id’:’false’}).
msgstring msg: return feedback message from ZMQ communication.
Returns
fault

◆ Flash_cmd()

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.

Parameters
typep_type: Save, Load and Load default SDO parameters of the flash.
board_idp_board_id: Board Id of the slave.
msgp_msg: return feedback message from ZMQ communication.
Returns
fault

◆ FOE_Master()

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.

Parameters
filenamep_filename: Filename to use to flah.
passwordp_password: Password for flashing (0xDAD0 [c28] 0xA550 [m3])
mcu_typep_mcu_type: Microcontroller type m3 or c28.
slave_posp_slave_pos: Slave position on the EtherCAT Network.
board_idp_board_id: Board Id of the slave.
msgp_msg: return feedback message from ZMQ communication.
Returns
fault

◆ get_zmq_timeout()

int EcReplCmd::get_zmq_timeout ( )

Return timeout of ZMQ communication.

Returns
int

◆ get_zmq_uri()

std::string EcReplCmd::get_zmq_uri ( )

Return ZMQ URI for the ZMQ communication.

Returns
std::__cxx11::string

◆ Motors_PDO_cmd()

EcReplFault EcReplCmd::Motors_PDO_cmd ( motors_ref_map motors_references)

Command to send references.

Parameters
refs: references motors map.
Returns
fault

◆ PDOs_aux_cmd()

EcReplFault EcReplCmd::PDOs_aux_cmd ( std::vector< aux_cmd_message_t > aux_cmds,
std::string & msg )

Command to release or engage motors brake.

Parameters
aux_cmdsaux_cmds: vector of aux cmd setting slave id and release or engage brakes.
msgp_msg: return feedback message from ZMQ communication.
Returns
fault

◆ set_zmq_timeout()

void EcReplCmd::set_zmq_timeout ( int timeout)

set timeout of ZMQ communication.

Parameters
timeoutp_timeout:...

◆ Slave_SDO_cmd()

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").

Parameters
board_idp_board_id: Board Id of the slave.
rd_sdop_rd_sdo: read sdo vector to read the values specified in this structure.
wr_sdop_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.
msgp_msg: return feedback message from ZMQ communication.
Returns
fault

◆ Slave_SDO_info()

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.

Parameters
typep_type: It's possible to get the SDO information with the NAME or OBJECT DICTIONARY.
board_idp_board_id: Board Id of the slave.
msgp_msg: return feedback message from ZMQ communication.
Returns
fault

◆ Trajectory_Cmd()

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.

Parameters
typep_type: Homing, Sine, Smooth Trajectory.
namep_name: Name of trajectory.
board_idp_board_id: Board Id of the slave.
homing_parp_homing_par: Structure of homing trajectory that has the time values to perform the hominh position.
period_parp_period_par: Structure of periodic trajectory, in this case, a sine wave with frequency, amplitude, theta (offset), and time,
smooth_parp_smooth_par: Structure of smooth trajectory having like x the time and y the position in radians.
msgp_msg: return feedback message from ZMQ communication.
Returns
fault

◆ Trj_queue_cmd()

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.

Parameters
typep_type: Push (start) or clear the trajectory.
trj_namesp_trj_names: Name of Trajectory.
msgp_msg: return feedback message from ZMQ communication.
Returns
fault

◆ zmq_do_cmd()

void EcReplCmd::zmq_do_cmd ( iit::advr::Repl_cmd pb_cmd,
std::string & msg,
int timeout,
EcReplFault & fault )
private

This method is responsible to perform the ZMQ commad to EtherCAT Server.

Parameters
pb_cmdprotobuf command
msgreturn feedback message from ZMQ communication.
timeouttimeout
faultfault detected.

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