Note that the verbindungsAufbau and verbindungsAbbau is crucial. The verbindungsAufbau function uses the CAN node id you configured your controller. The function returns a temporary node ID this controller is listening to. The cob_id is a temporary alias for this controller which is required to access its object dictionary. The object dictionary is accessed using the mycanopen_sdo_upload_exp function. After accessing the object dictionary this alias is released.
//public
int Uvr_Can::isUVR_c(int to_node_id) {
boost::mutex::scoped_lock lock(can_if_mtx_);
uint32_t vendor = 0, product = 0, version = 0, identifier = 0;
int ret = 0, cob_id = 0;
//cob_id = verbindungsAufbau(sock_, self_node_id_, to_node_id);
cob_id = this->verbindungsAufbau_c(to_node_id);
mycanopen_sdo_upload_exp(sock_, cob_id, 0x1018, 0x01, &vendor);
mycanopen_sdo_upload_exp(sock_, cob_id, 0x1018, 0x02, &product);
mycanopen_sdo_upload_exp(sock_, cob_id, 0x1018, 0x03, &version);
mycanopen_sdo_upload_exp(sock_, cob_id, 0x23e2, 0x01, &identifier);
verbindungsAbbau(sock_, self_node_id_, to_node_id);
if(vendor == 0x000000CB && product == 0x0000100B && identifier == 128) ret = 1611;
return ret;
}
Keine Kommentare:
Kommentar veröffentlichen