This PR changes prepares support for sending MC frames not only to actuators on CAN locations (boards such as foc or amcbldc) but also to actuators placed on the ETH board. This latter is the case of the amc board which has an actuator on its second core that can be reached by using inter core communication (ICC).
So far, no functionality is added: only code refactoring.
In more details
The code for the transmission of the frames related to MC is moved from the file Motor.c into objects of a dedicated namespace where it is possible to discriminate between CAN and ICC destinations.
As an example, we send a velocity PID message with the following code:
// ICUBCANPROTO_POL_MC_CMD__SET_VELOCITY_PID
embot::app::eth::mc::messaging::sender::Set_Velocity_PID msg {{o->mlocation}, {Kp, Ki, Kd, Ks}};
msg.transmit();
The constructor of the message surely accepts the values to send {Kp, Ki, Kd, Ks} but it also accepts a location that can be either on CAN or on ICC. It is inside the .transmit() method that eventually the transmission is directed towards CAN or ICC:
And for ICC we have for now an empty function that we shall fill in a later PR with a call to a embot::app::eth::theICCservices object.
bool Command::tx2icc(const Location &des, const embot::prot::can::Frame &frame)
{
//#warning TODO: fill embot::app::eth::mc::messaging::sender::Command::tx2icc() which adds a frame in the ICC queue
embot::core::print(frame.to_string());
return true;
}
Tests
I have tested the code and successfully moved a motor on three different setups using amc, ems and mc4plus boards.
Mergeability
Following the above tests the PR can surely be merged.
I will add support in icub-firmware-shared / icub-main to describe the location of an actuator to be on ETH and I will enable the code now shadowed by YRI_uses_MC_foc_actuator_descriptor_generic.
I will add the embot::app::eth::theICCservices object in the amc board to transmit and receive frames towards its second core and also in the amc2c code to manage communication w/ the amc.
In brief
This PR changes prepares support for sending MC frames not only to actuators on CAN locations (boards such as
foc
oramcbldc
) but also to actuators placed on the ETH board. This latter is the case of theamc
board which has an actuator on its second core that can be reached by using inter core communication (ICC).So far, no functionality is added: only code refactoring.
In more details
The code for the transmission of the frames related to MC is moved from the file
Motor.c
into objects of a dedicated namespace where it is possible to discriminate between CAN and ICC destinations.As an example, we send a velocity PID message with the following code:
The constructor of the message surely accepts the values to send
{Kp, Ki, Kd, Ks}
but it also accepts a location that can be either on CAN or on ICC. It is inside the.transmit()
method that eventually the transmission is directed towards CAN or ICC:Where for the CAN we have a call to the
EOtheCANservices
object we have always used:And for ICC we have for now an empty function that we shall fill in a later PR with a call to a
embot::app::eth::theICCservices
object.Tests
I have tested the code and successfully moved a motor on three different setups using
amc
,ems
andmc4plus
boards.Mergeability
Following the above tests the PR can surely be merged.
Associated PRs
There is a PR for the binaries:
Further work
icub-firmware-shared
/icub-main
to describe the location of an actuator to be on ETH and I will enable the code now shadowed byYRI_uses_MC_foc_actuator_descriptor_generic
.embot::app::eth::theICCservices
object in theamc
board to transmit and receive frames towards its second core and also in theamc2c
code to manage communication w/ theamc
.