Closed human2154 closed 2 years ago
SOEM (Simple Open EtherCAT Master) Slaveinfo Starting slaveinfo ec_init on rteth0 succeeded. 1 slaves found and configured. Calculated workcounter 3
Slave:1 Name:ModuleSlotsDrive Output size: 48bits Input size: 48bits State: 4 Delay: 0[ns] Has DC: 1 DCParentport:0 Activeports:1.0.0.0 Configured address: 1001 Man: 0000009a ID: 01100002 Rev: 00120025 SM0 A:1000 L: 256 F:00010026 Type:1 SM1 A:1400 L: 256 F:00010022 Type:2 SM2 A:1800 L: 6 F:00010064 Type:3 SM3 A:1c00 L: 6 F:00010020 Type:4 FMMU0 Ls:00000000 Ll: 6 Lsb:0 Leb:7 Ps:1800 Psb:0 Ty:02 Act:01 FMMU1 Ls:00000006 Ll: 6 Lsb:0 Leb:7 Ps:1c00 Psb:0 Ty:01 Act:01 FMMUfunc 0:1 1:2 2:3 3:0 MBX length wr: 256 rd: 256 MBX protocols : 0e CoE details: 2f FoE details: 01 EoE details: 01 SoE details: 00 Ebus current: 0[mA] only LRD/LWR:0 CoE Object Description found, 492 entries. Index: 1000 Datatype: 0007 Objectcode: 07 Name: Device type Sub: 00 Datatype: 0007 Bitlength: 0020 Obj.access: 0007 Name: Device type Value :0x00020192 131474
This is my slave info.
First. when I do
ec_slave[slc].blockLRW = 1;
It can read and write PDOs but send twice
And is there any data about CoEdetails 8bit information???
ec_slave[slc].CoEdetails
when I change this data 0x2F to 0x3F and turn off LRW, It communicates once but I cannot read and write PDOs.
Hi @human2154 ,
Having a quick glance at your code, it seems you are calling ec_send_processdata
twice in your ecatthread
method. Once directly before the infinite while loop, and once at the end after the clock_nanosleep
call.
So I would say that is expected behavior?
If not, please state more clearly what you are actually trying to do and what is called where. I'll not go over 14 pages of code without more information ;-)
About the general SOEM questions, I suggest to ask those at the upstream repo where SOEM actually is developed. They don't seem to be ROS related. Maybe try to create a non-ROS minimal example. This should help with getting those resolved...
First. Thank you for your reply.
ethercatthread
there are two ec_send_processdata();
. The first one runs just once when initializing the thread. And in while loop, there's a second ec_send_processdata();
function that runs repeatedly at 1kHz. When I delete the first one, there was no difference.What I really want to do is my Ethercat slave device read and write just once in the loop. The below picture is what I really want Timing graph. It just has single lines near the 1ms. When I check WKC in while loop. The WKC is 3 (I use just 1 slave).
I thought I have a mistake in initializing my slave. So I tried to below things. And I checked the WKC too.
ec_slave[slc].PO2SOconfig = &ELMOsetupPlatinum;
but the result is same. And WKC was 3.ec_slave[slc].blockLRW = 1;
So I cant config IO map.ec_slave[slc].CoEdetails
0x2F to 0x3F and did not run LRW options ec_slave[slc].blockLRW = 1;
. It communicate once. But, the input output data was empty. And WKC was 2.I really weird because I delete most of the codes, but the results are always the same.... Thank you for all your kindness.
Well with that bunch of code it is really hard to debug without having access to the hardware. Can you provide a minimal example (best, a single main function) that still shows the issue? With what program are you creating the graphs? Are you sure you are measuring correct?
I cannot help much with the issues your having and, again, IMO they are not ROS-related. So I suggest to use the original SOEM issue tracker and provide them with a non-ROS minimal example. They are so much more familiar with this than me. So they might be able to pinpoint the issue right away....
Thank you.
In this program the ethercat thread below is the only read and write code. The other code is just for initialize. And I check this EtherCAT timing with the 'Hilsher net Analyzer tool' and it works well.
void *ecatthread(void *ptr)
{
struct timespec ts, tleft;
int ht;
int cycletime;
int toff = 0;
struct sched_param p;
p.sched_priority = sched_get_priority_max(SCHED_FIFO);
pthread_setschedparam(pthread_self(), SCHED_FIFO, &p);
clock_gettime(CLOCK_MONOTONIC, &ts);
ht = (ts.tv_nsec / 1000000) + 1; /* round to nearest ms */
ts.tv_nsec = ht * 1000000;
cycletime = *(int *)ptr * 1000; /* cycletime in ns */
printf("create ecatthread! \n");
printf("pthread priority = %d\n", p.sched_priority);
ec_send_processdata();
//-----------------------------------------------------------------------------------------
while (1)
{
/* calculate next cycle start */
add_timespec(&ts, cycletime + toff);
std::cout << cycletime << " cycletime | toff " << toff << std::endl;
/* wait to cycle start */
clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &ts, &tleft);
ec_receive_processdata(EC_TIMEOUTRET);
if (ec_slave[0].hasdc)
{
ec_sync(ec_DCtime, cycletime, &toff);
}
ec_send_processdata();
}
}
Thanks to recommend me to move this issue at the original SOEM git. So, removing this issue is better for you? Or, just leave it?
I suggest you create the issue upstream, and we can close this one here and link against the upstream issue.
Thank you.
With your help, I solved some problems and write a new issue at original SOEM Here is the new link. Thank you.
Question
Hello. I'm a beginner in E-cat. And thank you for developing SOEM.
I use 'simpletest' for initializing slaves and a 1000Hz thread for calculating and sending-receiving E-cat data. In a normal situation, the data is only sent at 1000us timing. But in my graph, as the picture attached, it sends at 0ms and 1000us twice.
I'll attach my code and timing graph. Please help me. Thank you.
soem_ros_Twice_error_code.pdf
ROS Distro (please check as appropriate):
SOEM ROS Wrapper version (please check and complete as appropriate):
Hardware setup Describe exactly which type of hardware setup you have (i.e. which ethercat slaves)