robincornelius / libedssharp Goto Github PK
View Code? Open in Web Editor NEWA CanOpen EDS editor and library in C# with CanOpenNode export for Object Dictionary
License: GNU General Public License v3.0
A CanOpen EDS editor and library in C# with CanOpenNode export for Object Dictionary
License: GNU General Public License v3.0
Hi Robin, thanks for the work in the past weeks, it gets solid!
I guess this has to do with commit 61c2b84, some observations:
Examples from my .c file before/after 0.5 beta:
before: {(void*)&CO_OD_ROM.RPDOCommunicationParameter[1].COB_IDUsedByRPDO, 0x8d, 0x4 },
after: {(void*)&CO_OD_ROM.rpdocommunicationparameter[1].cob_idusedbyrpdo, 0x8d, 0x4 },
before: {(void*)&CO_OD_ROM.TPDOMappingParameter[0].mappedObject4, 0x8d, 0x4 },
after: {(void*)&CO_OD_ROM.tpdomappingparameter[0].mappedObjectMAPPEDOBJECT, 0x8d, 0x4 },
before: {0x6040, 0x00, 0xbe, 2, (void*)&CO_OD_RAM.axle0WheelRightControlword},
after: {0x6040, 0x00, 0xbe, 2, (void*)&CO_OD_RAM.axleAXLEWheelRightControlword},
Another one from .h
before: #define ODA_IMU_IMUAccX
after: #define ODA_imu_imuaccimuacc
Hi,
I'm basically having the same problem as with the original js generator https://sourceforge.net/p/canopennode/discussion/387151/thread/a56d0cc8/.
When I create the CANopenNode object dictionary files, they contain a LGPL license header. As there is no dynamic linking in deeply embedded devices, this means that those files in practise can't be used in commercial applications in that use case.
The files in the CANopenNode github repo contain a header with linking exception, e.g. https://github.com/CANopenNode/CANopenNode/blob/master/CANopen.c. According to Janez Paternoster it's OK to change the generated files to the same license too (see first link).
Is it OK for you to change the license for your files also?
Thanks!
Edit: Links do not work for some reason??
Edit2: Just to clarify, this only appies to the generated files, not the editor itself :-)
System.dll!System.Collections.Generic.SortedDictionary<ushort, libEDSsharp.ODentry>.this[ushort].get(ushort key) Unknown EDSEditor.exe!ODEditor.DevicePDOView.updatePDOTXslot(libEDSsharp.ODentry od, int row) Line 233 C# EDSEditor.exe!ODEditor.DevicePDOView.updatePDOinfo() Line 154 C# EDSEditor.exe!ODEditor.DeviceView.dispatch_updatePDOinfo() Line 87 C# EDSEditor.exe!ODEditor.MyTabUserControl.doUpdatePDOs() Line 44 C# EDSEditor.exe!ODEditor.DeviceODView.populateindexlists() Line 523 C# EDSEditor.exe!ODEditor.DeviceODView.deleteObjectToolStripMenuItem_Click(object sender, System.EventArgs e) Line 664 C#
Crash happens here as the parent has no parent ;-)
I'm talking about this line.
Should this not be the datatype of the parent? Also inheriting accessType and PDOtype would be handy.
I'm not sure about this, so no pull request yet ;-)
I just retrieved libedssharp sources and rebuilt (VS2013). Using the build result the Object Dictionary Editor is v0.5.
The work around is to manually reset the max sub-item index value (Right click on sub-index 0 and select the option to change the max sub-index). I've fooled around with this a bit and I'm pretty sure one part of the editor code interprets the max sub-index as a hex value but other parts assume its decimal.
jl
I added 17 additional RPDOs using the Rx PDO Mapping tab (right click -> insert PDO), then verified that the additional RPDO communications/mapping objects were listed in the Object Dictionary. Saved settings and returned to the Device Info Tab where the Number of RPDOs remained at 4 (initial value). Exporting the c/h files does produce the desired 21 RPDOs however.
I then went back to the RX PDO Mapping tab and mapped an object to the 5th RPDO (first 4 are already defined). After saving the change and going back to the Device Info screen the number of RPDOs is now correctly shown as 21.
I did this starting with the _project.xml released w/ CANopenNode.
jl
I have some RPDOs that I want configured to start/default to the disabled state. This would involve setting bit 31 of subindex 01 for the RPDO communications OD entry.
0x1404,1 COB-ID = 0x200 + $NODEID
Using the editor changed this to 0x80000200 + $NODEID hoping that the default configuration would have the associated RPDO to be disabled. My application code would later clear bit 31 to enable the RPDO.
After making this edit I was able to save the change, save the device xml file but on attempting to reopen the device xml file I receive an error...
Error parsing node id 0x3+0x80000200 nodes, System.OverflowException: Value was either too large or too small for a UInt16.
at System.Convert.ToUInt16(String value, Int32 fromBase)
at libEDSsharp.EDSsharp.GetNodeID(String input) in c:\Users\jal\Downloads\libedssharp-master\libedssharp-master\libEDSsharp\eds.cs:line 1433
Since COB-ID is UNSIGNED32 I presume that the editor is checking for overflow of the lower 16 bits of the value.
How can I create RPDO/TPDOs which are disabled initially?
Thanks
Jim
Should really check if things have been saved in some sane way before allowing close or someone is going to loose a lot of work, and that someone might be me
Attempting to rename individual array entries and give them a non-blank name does nothing. The save changes button seems to have no effect on an ARRAY type at least. This bug may effect more editing than just that.
I think it should be "accessType=const". I could be the a result of your "nasty workaround" ;-)
Also the DS301_profile.xml has some accessType="cons"..
This is not really a problem with libedssharp as it is intended for Windows .net, however I would like to use the editor on Linux OS. So maybe there is a mono guru around :-)
I've tried to compile the editor using mono xbuild / MonoDevelop and ran into the problem that in ReportView.cs the mshtml library is not available.
After disabling the following lines, the compile works:
`//using mshtml;
// mshtml.HTMLDocument CurrentDocument = (HTMLDocument)webBrowser1.Document.DomDocument;
// mshtml.IHTMLStyleSheet styleSheet = CurrentDocument.createStyleSheet("", 0);
// styleSheet.cssText = text;`
Maybe I've just missed the google result that says "install package xyz"?
If you add a new index the OD refreshes with all the data.
Fixed in GIT bf77682
The tenth subindex is written as 10 instead of 0x0A and therefore the "10" it is interpreted as 0x10 if checked with CANesdCheck. This results in an error because the number of subindexes (sub0) does not fit the highest subindex
eg:
[6401sub9]
ParameterName=Input
ObjectType=0x7
DataType=0x0003
AccessType=ro
DefaultValue=0
PDOMapping=1
;StorageLocation=RAM
[6401subA]
ParameterName=Input
ObjectType=0x7
DataType=0x0003
AccessType=ro
DefaultValue=0
PDOMapping=1
;StorageLocation=RAM
[6401sub9]
ParameterName=Input
ObjectType=0x7
;StorageLocation=RAM
DataType=0x0003
AccessType=ro
DefaultValue=0
PDOMapping=1
[6401sub10]
ParameterName=Input
ObjectType=0x7
;StorageLocation=RAM
DataType=0x0003
AccessType=ro
DefaultValue=0
PDOMapping=1
This patch fixes a typo in xml loading function
PDO-Map flag was set to optional.
Current workaround: save the XML and open it again..
Hello Robin,
In the EDS file generation the array/record entries are not correct if the array/record is larger then 9 entries.
I've solved this by changing the line:
writer.WriteLine(string.Format("[{0:X}sub{1}]", index,subindex));
to:
writer.WriteLine(string.Format("[{0:X}sub{1:X}]", index,subindex));
('write'-routine in eds.cs).
br. Hendrik.
Hi,
the editor is taking great shape, very nice!
One minor request: After editing, i have to save all three components (device.xml, eds and .c/.h), so doing this with just one click would be very handy.
Thanks!
because one can not change datatype of children ;-)
the CO_ODc/h files are generated incorrectly when the PDO range has gaps and is non contiguous. The exported entries are generated as if it is contiguous. #10 partially fixed this but did not address the CanOpenNode exporter
The CanOpen exporter requires a name to generate the c name mappings. If the individual array entries have a blank name the exporter crashes with null ref exception
It updates and exports to CO_OD.c fine but it does not display if it is set on REC objects
Hi,
when saving info page to .eds/xml, some info is not exported/saved.
Field: ok in .eds export; saved in .xml
Product number yes no
Vendor number yes no
Description yes no
Creation Date/Time no yes (auto filled)
Modification D/T no yes (auto filled)
Modified by yes no
Baudrates yes no
Device settings yes no
I've had a go at fixing this, but wasn't too successfull at finding all the neccessary places in the code. I'm more into embedded systems that GUI design :-)
As part of dynamic PDO mapping its necessary to change the "number of mapped objects" (subindex 0) for an PDO mapping parameter. I'm finding that for all the new RPDO's that I've added to the OD, the access type setting is grayed out so you can't change it from the default "ro" setting. I'd like to have the number of mapped objects set to zero but be able, at runtime, to change the setting when the RPDO is to be enabled. To do this, I need the accesstype of RPDO mapping, subindex 0x00 to be rw.
It seems like there may be a bug in the handling of the combobox.accesstype.Enabled property in DeviceODView.cs. I changed line ~300 to change comboBox_accesstype.Enabled = false; to comboBox_accesstype.Enabled = true; This seemed to allow me to change the accesstype as necessary but I don't know if it breaks something else.
jl
Would be very useful to be able to define strings as blah/0 to form 'b','l','a','h',0 etc but currently we can't all characters are char literals
When creating new REC objects they are being created as arrays and not as record objects should be. Record objects always start with a unsigned 8 max sub-index on sub 0, but after that any primitive data type is allowed for each sub index,.
I've tried checking/unchecking the various options under "Device Settings' and also changed the "Granularity" parameter, Update, and then export c/h. Version control tells me that there is no change to the exported c/h files. I was thinking these might map to the macros in CO_OD.h which define the FEATURES ....
/*******************************************************************************
FEATURES
*******************************************************************************/
#define CO_NO_SYNC 1 //Associated objects: 1005-1007
#define CO_NO_EMERGENCY 1 //Associated objects: 1014, 1015
#define CO_NO_SDO_SERVER 1 //Associated objects: 1200-127F
#define CO_NO_SDO_CLIENT 0 //Associated objects: 1280-12FF
#define CO_NO_RPDO 21 //Associated objects: 14xx, 16xx
#define CO_NO_TPDO 4 //Associated objects: 18xx, 1Axx
#define CO_NO_NMT_MASTER 0
Also curious about what the "Concrete Node Id" setting does?
Thanks ...jim
I just deleted a disabled SDO and the number in "const CO_OD_entry_t CO_OD[238] = {" in CO_OD.c was reduced by 1. Thats ok, but the SDO was not listed in the array before, so the number calculated must be wrong. I guess it counts the disabled SDOs also.
Although the editor works fine on my desktop as soon as you try to use it on a field laptop that tend to have smaller screens many things start to fall off the bottom.
May be set the default height to around 800px which will at least work on my field laptop
I may add something more intelligent but it depends on demand
An โitem with the same key has already been addedโ
exeption is thrown on eds[sectionname].Add(key, value); (line 1061) if the "name" string of the object or the subindex contains the characters "[" and "]"
like in
"Filtering time t1 [s]"
where the "[s]" is the unit of the "filtering time" in seconds
The "s" is erroneously interpretded and added as a key and so the next string that contains "[s]" e.g.
"Filtering time t2 [s]" is interpreted as the second occurence of the key "s"
CANchkEDS has no problem with the "[" and "]" characters in EDS files and checks it as valid.
Might not be needed to change but should be described.
When editing a SDO, it would be great if the current SDO in the list on the left stays selected after pressing the save button (and when the list loses focus). Keeping the current position of the scroll-bar would also be very helpful.
Thanks
The editor is getting better with every commit ๐
Hi Robin ,
first of all: thanks for all the work, great editor!
I'm happy to see some progress ๐
I tried to generate an EDS file (in debug mode) and it failed because the comments object is null. Also i was not able to find a way to enter a comment to fill in this object?
I fixed it with a "if (comments==null) return;" in line 402 in eds.ch, but i think you can work out a better solution.
Thanks!
Simon
Using version 0.4 it looks like the export to CANopenNode is not quite right. The c/h files compile ok and the node sort of runs although it appears to stuck in the pre-operational state. There is also an immediate Protocol Emergency Message on bootup.
Attempting to access COB 0x1800 I'm able to read subindex 0,1,2,3 but attempting to read 4,5,6 always returns a "Sub Index Does not exist" error ... even though the return value from a read of subindex 0 tells me the highest supported index is 6.
I'm reasonably confident that my CANopenNode code is working correctly because I'm able to successfully do all these things using CO_DATA.c/h generated by another tool.
Thanks
Jim
ps - Overall...like the UI of the tool much more than the web based OD editor that comes w/ the CANopenNode release!
This patch makes OD name and desctiption text box size aligned to current window sizes.
Changes:
0001-Changed-behaviour-of-name-and-description-text-fiel-.zip
according to DS306.
better placed under comments?
When I try to add new object, only option is to use index above 0x2000. My RPDO index is 0x1500.
Great job, much better interface.
Thanks
When changing Object Dictionary -> Description text in mono, the text gets all messed up regarding line breaks. This seems to be caused by this line:
textBox_description.Text = od.Description.Replace("\n", "\r\n");
inside DeviceODView.cs. All occurances of "\n" are replaced, resulting in something like "\r\r\n". I have no idea how this works on windows??
The attached patch fixes this problem for me, please have a look if this is OK and if it applies to other places in the code.
credit for regex goes to http://stackoverflow.com/a/31056
0001-fix-mono-linux-line-ending-messup.zip
e.g. if the sub index name is
"Actual alcohol value in vol.-%"
Modify/Creation date and time in DS306 format for eds file (h:mmtt MM-dd-yyyy) should be culture invariant.
E.g. German time would be 10:12 in eds instead of 10:12AM, that is not according DS306 (characters in format โhh:mm(AM|PM)โ
Added CultureInfo.InvariantCulture for Creation/Modification date and time.
Unable to push to this repro so her are the changes at line 1230 eds.cs
fi.CreationDate = fi.CreationDateTime.ToString("MM-dd-yyyy", CultureInfo.InvariantCulture);
fi.CreationTime = fi.CreationDateTime.ToString("h:mmtt", CultureInfo.InvariantCulture);
fi.ModificationDate = fi.ModificationDateTime.ToString("MM-dd-yyyy", CultureInfo.InvariantCulture);
fi.ModificationTime = fi.ModificationDateTime.ToString("h:mmtt", CultureInfo.InvariantCulture);
If byte 0 of COB-ID 0x200 is set as a dummy mapping of an dummy int16, byte 1 is automatically set to"-".
Ok so far.
But if byte 2 (next free) is also set to dummy int16 the table gets rearranged in this (faulty) way:
Byte 0 becomes a dummy int8, byte 1 gets the first part of the new dummy int16, byte 2 is automatically set to"-".
Or in other words: When mapping the second 16 bit variable, the first is redefined as a 8 bit variable
Hard to describe, but I think easy to reproduce.
PDO Map combo does not have "TPDO" and "RPDO" options.
upd: Also COS flag cannot be set. After pressing save button it returns to unchecked state.
Steps to reproduce:
The section STRUCTURES FOR RECORD TYPE OBJECTS in CO_OD.c is not currently populated so accessing record objects is producing undefined behaviour.
They are a special case anyway but we currently have :-
*1600, Data Type: RPDOMappingParameter_t */
#define OD_RPDOMappingParameter CO_OD_ROM.RPDOMappingParameter
/*1601, Data Type: RPDOMappingParameter_t */
#define OD_RPDOMappingParameter CO_OD_ROM.RPDOMappingParameter
/*1602, Data Type: RPDOMappingParameter_t */
#define OD_RPDOMappingParameter CO_OD_ROM.RPDOMappingParameter
/*1603, Data Type: RPDOMappingParameter_t */
#define OD_RPDOMappingParameter CO_OD_ROM.RPDOMappingParameter
and if we compare to the reference implementation from CanOpenNode it looks like -
/*1600[4], Data Type: OD_RPDOMappingParameter_t, Array[4] */
#define OD_RPDOMappingParameter CO_OD_ROM.RPDOMappingParameter
Nothing is actually broken in the existing code but the defines it is generating are messy and don't reflect its really an array. Not sure the best way to handle this as the whole handling of arrays of records is a odditity anyway and not strictly within the canopen spec but more to do with the CanOpenNode implementation.
When mapping a data type UNSIGNED16 (DataType=0x0006) the object length in the RPDO mapping parameter doesn't match data type of mapped object.
[2315]
ParameterName=Actual value reference channel
ObjectType=0x8
;StorageLocation=RAM
SubNumber=0x2
[2315sub0]
ParameterName=Number of actual values
ObjectType=0x7
;StorageLocation=RAM
DataType=0x0005
AccessType=rw
DefaultValue=1
PDOMapping=1
[2315sub1]
ParameterName=Actual value reference channel
ObjectType=0x7
;StorageLocation=RAM
DataType=0x0006
AccessType=rw
DefaultValue=0
PDOMapping=1
(...)
[1602sub2]
ParameterName=mapped object 2
ObjectType=0x7
;StorageLocation=RAM
DataType=0x0007
AccessType=rw
DefaultValue=0x23150108 <= should be 0x23150110 for UNSIGNED16
PDOMapping=0
Hi,
i created a new project, inserted the DS301 profile and exported to EDS.
The problem: sub-indexes are not generated. For example SDO 0x1018 has 4 sub-indexes "1018sub1", 1018sub2" but they are not saved to EDS?
Thanks
Simon
otherwise the field cannot be cleared:
{0x1003, 0x10, 0x86, 4, (void*)&CO_OD_RAM.preDefinedErrorField[0]}
needs to be changed to
{0x1003, 0x10, 0x8E, 4, (void*)&CO_OD_RAM.preDefinedErrorField[0]}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.