Skip to content

Commit

Permalink
Prepared the MBD motor control holder for board amc2c (robotology#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoaccame authored and valegagge committed May 5, 2023
1 parent 29b031d commit 66a2d02
Show file tree
Hide file tree
Showing 10 changed files with 1,054 additions and 929 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// --------------------------------------------------------------------------------------------------------------------

#include "embot_app_board_amc2c_mbd.h"
#include "embot_app_board_amc2c_theMBD.h"


// --------------------------------------------------------------------------------------------------------------------
Expand All @@ -23,31 +24,33 @@ namespace embot::app::board::amc2c::mbd {
void Startup(embot::prot::can::Address adr)
{
embot::core::print("MBD is starting up on an amc2c");
embot::app::board::amc2c::theMBD::getInstance().initialise({adr});
}

void OnTick(const std::vector<embot::prot::can::Frame> &input, std::vector<embot::prot::can::Frame> &output)
{
static uint32_t cnt {0};
if(0 == (cnt++ % 1))
{
// embot::core::print("MBD is ticking on an amc2c");

uint8_t b0 = cnt&0xff;
uint8_t b1 = (cnt>>8)&0xff;
uint8_t b2 = (cnt>>16)&0xff;
uint8_t b3 = (cnt>>24)&0xff;
embot::prot::can::Frame fr1 {0x202, 4, {b0, b1, b2, b3, 0, 0, 0, 0}};
output.push_back(fr1);
}

size_t numRXframes = input.size();

if(numRXframes > 0)
{
// just for test: i get the first only and i send it back
embot::prot::can::Frame f = input[0];
output.push_back(f);
}
embot::app::board::amc2c::theMBD::getInstance().tick(input, output);
// static uint32_t cnt {0};
// if(0 == (cnt++ % 1))
// {
//// embot::core::print("MBD is ticking on an amc2c");
//
// uint8_t b0 = cnt&0xff;
// uint8_t b1 = (cnt>>8)&0xff;
// uint8_t b2 = (cnt>>16)&0xff;
// uint8_t b3 = (cnt>>24)&0xff;
// embot::prot::can::Frame fr1 {0x202, 4, {b0, b1, b2, b3, 0, 0, 0, 0}};
// output.push_back(fr1);
// }
//
// size_t numRXframes = input.size();
//
// if(numRXframes > 0)
// {
// // just for test: i get the first only and i send it back
// embot::prot::can::Frame f = input[0];
// output.push_back(f);
// }
}

} // end of namespace
Expand Down
Loading

0 comments on commit 66a2d02

Please sign in to comment.