-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The amc
board uses ICC
and CAN
to move the wrist of ergoCub
.
#474
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
created a embot::app::eth::mc::messaging::receiver::Agent interface added CAN print etc
…that this is available
…mn_serv_MC_advfoc
…ew data structures
…comes first. amc-icc project now allows advfoc to manage a amc2c over can or over icc amcbld-application2 project is changed to reflect the changes in data structures required for the above features
amc: 2.0 amc2c: 3.0.0 amcbldc: 2.0.10 ems: 3.85 mc4plus: 3.88 mc2plus: 3.67 all dated 01 mar 2024 @ 17.17
This was referenced Mar 4, 2024
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR belongs to a set of five PRs on
icub-firmware
,icub-firmware-shared
,icub-firmware-build
,icub-main
androbots-configuration
.They introduce a new MC service that supports actuators located on the second core of the new dual core ETH boards that run the outer control loop at 1 ms. So far the only dual core board we use is the
amc
which runs on the first CM7 core and uses an actuator board on its CM4 core: theamc2c
.The core features of the new MC service are:
advfoc
, that is able to define the location of the actuator to be on different places: directly accessible to the application, accessible via CAN, accessible via ICC (inter core communication);The above two features are for now supported only by the
amc
andamc2c
boards but will be soon supported by the next dual core board, theamcfoc
, and by future ones.The PRs directly touch the code and binaries of the
amc
andamc2c
boards that useadvfoc
andICC
but also of theamcbldc
that shares some environmental code with theamc2c
.The legacy ETH boards (the
ems
,mc4plus
andmc2plus
) are not dual core and don't need theadvfoc
features. However, the PRs touches them as well because we have changed the UDP protocol to carry the MS service configuration.There are also changes in
icub-main
to parse the extra information of the MC service and inrobots-configuration
for the new xml files.Description of how the
advfoc
worksIn here is a brief description of how the
advfoc
works for the case of the wrist ofergocub
fromYRI
down to the HW communication across the two core of theamc
board.The xml configuration
The xml description uses the type eomn_serv_MC_advfoc that can manage actuators on CAN and also on ICC even in mixed location. Moreover, each actuator can be of mixed board type and hence with different application and protocol versions.
Code listing. File w/ service description.
Code listing. File w/ mechanical properties traditionally keeps also the properties of the actuators. I left them in the same place but I have changed the name of the group to be uniform w/ the
advfoc
type.The transport over UDP
This information is transported over UDP inside the traditional struct
eOmn_service_cmmnds_command_t
that has been enhanced in itseOmn_serv_config_data_mc_t
field to contain a new description for the caseeomn_serv_MC_advfoc
.Figure. The xml files are parsed by YRI and their information is transported to the
amc
board using aeOmn_service_cmmnds_command_t
struct.In here the changed data structures.
Code listing. The struct
eOmn_serv_config_data_mc_t
hold the neweOmn_serv_config_data_mc_advfoc_t
struct.In particular, it is the new struct
eOmn_serv_config_data_mc_advfoc_t
alongside with its new fields that does the job.Code listing. Now each actuator is described by the
eOmc_adv_actuator_descriptor_t
struct that contains type of board, its application and protocol version and its location.Code listing. The new compact
eOlocation_t
struct allows CAN, local and inter-core locations.Inside the
amc
boardThe
eOmn_service_cmmnds_command_t
is handled by the CM7 application which runs new code to manage the MC service and to communicate towards the second CM4 core.The handling of the service configuration
The received MC service configuration
eOmn_service_cmmnds_command_t
is managed by the objectembot::app::eth::theServices
that calls theembot::app::eth::Service
interface ofCategory::mc
that we have loaded.In this PR I have added only for the
amc
board (and later boards) a new class, theembot::app::eth::theServiceMC
, that still manages theType::MC_foc
as now but also a brand newType::MC_advfoc
.The
theServiceMC
activates a dedicated implementation depending on the caseType::MC_foc
orType::MC_advfoc
that will trigger the relevant objects.As an example, for the case of the
advfoc
the implementation in classembot::app::eth::service::impl::mc::AGENTadvfoc
calls the traditionalEOtheCANmapping
andEOtheCANservice
to manage CAN locations and the newembot::app::eth::theICCmapping
andembot::app::eth::theICCservice
to manage communication with ICC-located actuators.Figure. The object
ServiceMC
reuses legacy C objects for CAN communication and new objects for ICC communication.The new
theICCservice
andtheICCmapping
objectsThe
theICCservice
is responsible to send messages from one core to another and to handle received ones. ThetheICCmapping
is used to associate received messages to MC entities.The object
theICCservice
holds the following objects:embot::hw::icc::LTR
objects (see Basics of inter core communication on STM32 #386) one for TX and one for RX.Its internals use the following mechanism for transmitting (reception is dual).
Figure. Step 1 of transmission: the user, for instance the CM7 core of the
amc
, puts a messages in the TX FIFO.Figure. Step 2 of transmission: when the user has put all the required messages, it starts transmission in blocking mode. The TX threads picks up all the messages in the TX FIFO and sends them all together to a shared shared
embot::hw::icc::LTR
. It waits until the receiving part, for instance the CM4 core, releases the sharedembot::hw::icc::LTR
.Figure. Step 3 of transmission: the receiver had previously registered the shared
embot::hw::icc::LTR
to alert its RX thread of any incoming data. The RX thread gets the data insideembot::hw::icc::LTR
, copy that inside its RX FIFO and finally releases the sharedembot::hw::icc::LTR
so that the other core is unlocked.Mergeability
The new features have been extensively tested over the months (yep, the ICC work began in November 2023) during development and with final tests during the last two weeks:
experimentalSetups/lego_setup_amc_advfoc
) using a mixture of ICC and CAN locations for the actuators onamc2c
andamcbldc
with YRI (yarprobotinterface) talking to theamc
but also to theems
;ergoCub
wrist on the dedicated setup (xml files inexperimentalSetups/wristMK2.1_SN002F
) withamc
,amc2c
and twoamcbldc
boards.icubGenova11
to assess theems
andmc4plus
boards.So, they can be safely merged.
Linked PRs
amc
board usesICC
andCAN
to move the wrist ofergoCub
. #474amc
board usesICC
andCAN
to move the wrist ofergoCub
icub-firmware-shared#93amc
board usesICC
andCAN
to move the wrist ofergoCub
icub-main#948amc
board usesICC
andCAN
to move the wrist ofergoCub
robots-configuration#623