question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RxPDO sent value is updated slowly

See original GitHub issue

Hello and thanks a lot for your work!

I’ve successfully configured a RxPDO to be sent every 10ms. The sent value should be different at any transmission, but I see on the slave node a received value that change every 3 or 4 sent PDOs (30-40ms). Sending an SDO instead of a PDO I was able to send a different value every 1ms. (You can see the related code commented below.)

I leaved my previous tries as commented code.

Am I missing something?

Thanks in Advance!

`

s60.rpdo.read()
s60.rpdo[1].clear()
s60.rpdo[1].add_variable('Target position')
s60.rpdo[1].enabled = True
s60.rpdo.save()
s60.rpdo[1]['Target position'].raw = (7*6000).to_bytes(4, 'little')
s60.rpdo[1].start(0.01)

s60.nmt.state = 'OPERATIONAL'
print("Gone Operational")

network.sync.start(0.001)


starttime = time.time()
oldtime = time.time()
while True:
	newtime = time.time()
	if newtime-oldtime>0.0005:
		cosminus1 = math.cos(1.0*(newtime-starttime))-1
		feeds = int(6000 * cosminus1 * 3.3 + 42000)
	#print(feeds, '@ timesector:', newtime-oldtime)
	#s60.sdo.download(0x607A,0,feeds.to_bytes(4, 'little'))		#MF: Target position

		#s60.rpdo[1].setdata = feeds.to_bytes(4, 'little')
		#s60.object_dictionary['Target position'].raw = feeds.to_bytes(4, 'little')
		#s60.rpdo[1].update()
		#s60.rpdo[1]['Target position'].raw = feeds.to_bytes(4, 'little')
		s60.rpdo[1]['Target position'].set_data(feeds.to_bytes(4, 'little'))
		oldtime = newtime

`

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
christiansandbergcommented, Jan 20, 2020

Ixxat utilizes the hardware for periodic transmission which improves timing between messages, but unfortunately it does not provide a way to update the data after it has started. Therefore the message needs to be stopped and recreated every time the data is changed. This is probably very expensive and probably why you have such problems.

I don’t have a solution for you but implementing the periodic transmission yourself might be one.

1reaction
af-silvacommented, Jan 21, 2020

@Matiu-f

Yes, but depending on your configuration it will only be executed at sync message. A think the way the framework it’s build, at sync it will grab the data and transmit it, so you should be seeing data being sent and updated at the frequency you configured at network.sync.start()

You have also to check the CAN interface configuration and the Bus speed supported, for instance I use SocketCAN at 1000 Kbit/s with with kvaser …


s60.rpdo.read()
s60.rpdo[1].clear()
s60.rpdo[1].add_variable('Target position')
s60.rpdo[1].enabled = True
s60.rpdo.save()

s60.rpdo[1]['Target position'].raw = (7*6000).to_bytes(4, 'little')
s60.rpdo[1].start(0.01)

network.sync.start(0.01) # 10 milliseconds 

s60.nmt.state = 'OPERATIONAL'
print("Gone Operational")

starttime = time.time()
oldtime = time.time()

while True:
	delta = int(starttime  * 1000) - int(oldtime * 1000)
        if delta < 10:
	    continue
	cosminus1 = math.cos(1.0*(newtime-starttime))-1
	feeds = int(6000 * cosminus1 * 3.3 + 42000)
	s60.rpdo[1]['Target position'].set_data(feeds.to_bytes(4, 'little'))
	oldtime = newtime
Read more comments on GitHub >

github_iconTop Results From Across the Web

Process Data Objects (PDO) - Beckhoff infosys
Introduction. In many fieldbus systems the entire process image is continuously transferred - usually in a more or less cyclic manner.
Read more >
A11358 EtherCAT CoE Programming Manual - ElectroCraft
3) When motor I2t protection is enabled, set its Over current value over the motor Nominal current. 4) Set the drive Current limit...
Read more >
Tutorial — SOEM 1 documentation - RT-Labs
Each group will have its own logic address space mapped to an IOmap address and make it possible to send and receive process...
Read more >
Flexible PDO Mapping - Kollmorgen Webhelp
As the PDO map is changed, the startup script is automatically updated by TwinCAT to send to the drive during the PREOP to...
Read more >
Configuration Guideline for CANopen Networks
(TxPDOs) are sent by the I/O device and contain input data. Mapping. Typically there are several RxPDO and. TxPDOs available for the process...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found