├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── update-installer-request.md ├── .gitignore ├── INSTALL └── Install.iss ├── LICENSE ├── README.md ├── SW2URDF.sln ├── SW2URDF ├── AssemblyInfo.cs ├── GlobalSuppressions.cs ├── Legacy │ └── SerialNode.cs ├── Properties │ ├── DataSources │ │ └── SwAddin.datasource │ ├── Resources.Designer.cs │ └── Resources.resx ├── ROS │ └── ROSFiles.cs ├── SW │ ├── EventHandling.cs │ └── SwAddin.cs ├── SW2URDF.csproj ├── SW2URDF.csproj.user ├── SW2URDF.png ├── SW2URDF.ruleset ├── Test │ ├── SW2URDFTest.cs │ ├── SWTestFixture.cs │ ├── TestCSVImportExport.cs │ ├── TestCommon.cs │ ├── TestExportHelper.cs │ ├── TestLogger.cs │ ├── TestMathOps.cs │ ├── TestPropertyManager.cs │ ├── TestROSFIles.cs │ ├── TestSWAttached.cs │ ├── TestSerialization.cs │ ├── TestURDFMerge.cs │ ├── TestURDFPackage.cs │ └── TestVersioning.cs ├── UI │ ├── AssemblyExportForm.Designer.cs │ ├── AssemblyExportForm.cs │ ├── AssemblyExportForm.resx │ ├── AssemblyExportFormExtension.cs │ ├── IMessageBox.cs │ ├── MessageBoxHelper.cs │ ├── PartExportForm.Designer.cs │ ├── PartExportForm.cs │ ├── PartExportForm.resx │ ├── Resources │ │ └── Images │ │ │ ├── AddinIcon.bmp │ │ │ ├── MainIconLarge.bmp │ │ │ ├── MainIconSmall.bmp │ │ │ ├── ToolbarLarge.bmp │ │ │ └── ToolbarSmall.bmp │ ├── TreeMergeWPF.xaml │ ├── TreeMergeWPF.xaml.cs │ ├── TreeMergedEventArgs.cs │ ├── TreeModifiedEventArgs.cs │ ├── UIResources.xaml │ └── URDFTreeView.cs ├── URDF │ ├── Axis.cs │ ├── Calibration.cs │ ├── ChildLink.cs │ ├── Collision.cs │ ├── Color.cs │ ├── ConfigVersion.cs │ ├── Dynamics.cs │ ├── Geometry.cs │ ├── Inertia.cs │ ├── Inertial.cs │ ├── Joint.cs │ ├── Limit.cs │ ├── Link.cs │ ├── LinkNode.cs │ ├── Mass.cs │ ├── Material.cs │ ├── Mesh.cs │ ├── Mimic.cs │ ├── Origin.cs │ ├── PackageXMLWriter.cs │ ├── ParentLink.cs │ ├── Robot.cs │ ├── SafetyController.cs │ ├── Texture.cs │ ├── URDFAttribute.cs │ ├── URDFElement.cs │ ├── URDFWriter.cs │ └── Visual.cs ├── URDFExport │ ├── CSV │ │ ├── CSVImportExport.cs │ │ └── ContextToColumns.cs │ ├── CommonSwOperations.cs │ ├── ConfigurationSerialization.cs │ ├── ExportHelper.cs │ ├── ExportHelperExtension.cs │ ├── ExportPropertyManager.cs │ ├── ExportPropertyManagerExtension.cs │ ├── URDFMerge │ │ ├── TreeMerger.cs │ │ └── URDFTreeCorrespondance.cs │ └── URDFPackage.cs ├── URDFWriter.cs ├── Utilities │ ├── Logger.cs │ └── MathOPS.cs ├── Versioning │ └── Version.cs ├── images │ ├── ros_logo_128x128.png │ ├── ros_logo_16x16.png │ ├── ros_logo_20x20.png │ ├── ros_logo_32x32.png │ ├── ros_logo_40x40.png │ ├── ros_logo_64x64.png │ └── ros_logo_96x96.png ├── lib │ └── log4net.dll └── packages.config ├── TestRunner ├── GlobalSuppressions.cs ├── Properties │ └── launchSettings.json ├── README.md ├── TestRunner.cs ├── TestRunner.csproj └── app.config ├── examples ├── 3_DOF_ARM │ ├── 3_DOF_ARM.SLDASM │ ├── 3_DOF_ARM_BASE.SLDPRT │ ├── 3_DOF_ARM_END_EFFECTOR.SLDPRT │ ├── 3_DOF_ARM_SEGMENT.SLDPRT │ └── 3_DOF_ARM_description │ │ ├── CMakeLists.txt │ │ ├── config │ │ └── joint_names_3_DOF_ARM_description.yaml │ │ ├── launch │ │ ├── display.launch │ │ └── gazebo.launch │ │ ├── meshes │ │ ├── base_link.STL │ │ ├── dist_Link.STL │ │ ├── effector_link.STL │ │ └── prox_link.STL │ │ ├── package.xml │ │ └── urdf │ │ ├── 3_DOF_ARM_description.csv │ │ └── 3_DOF_ARM_description.urdf ├── 4_WHEELER │ ├── 4_WHEELER.SLDASM │ ├── 4_WHEELER_CHASSIS.SLDPRT │ ├── 4_WHEELER_WHEEL.SLDPRT │ └── 4_WHEELER_description │ │ ├── CMakeLists.txt │ │ ├── config │ │ └── joint_names_4_WHEELER_description.yaml │ │ ├── launch │ │ ├── display.launch │ │ └── gazebo.launch │ │ ├── meshes │ │ ├── back_left_link.STL │ │ ├── back_right_link.STL │ │ ├── base_link.STL │ │ ├── front_left_link.STL │ │ └── front_right_link.STL │ │ ├── package.xml │ │ └── urdf │ │ ├── 4_WHEELER_description.csv │ │ └── 4_WHEELER_description.urdf ├── ORIGINAL_3_DOF_ARM │ ├── Arm.SLDASM │ ├── Arm_base.SLDPRT │ ├── Arm_brace.SLDPRT │ ├── Arm_link.SLDASM │ ├── Arm_link1_tube.SLDPRT │ ├── Arm_link_tube.SLDPRT │ ├── Basic.SLDASM │ ├── Basic.STL │ ├── ORIGINAL_3_DOF_ARM.SLDASM │ ├── ORIGINAL_3_DOF_ARM_description │ │ ├── CMakeLists.txt │ │ ├── config │ │ │ └── joint_names_ORIGINAL_3_DOF_ARM_description.yaml │ │ ├── launch │ │ │ ├── display.launch │ │ │ └── gazebo.launch │ │ ├── meshes │ │ │ ├── base_link.STL │ │ │ ├── link1.STL │ │ │ ├── link2.STL │ │ │ └── link3.STL │ │ ├── package.xml │ │ └── urdf │ │ │ ├── ORIGINAL_3_DOF_ARM_description.csv │ │ │ └── ORIGINAL_3_DOF_ARM_description.urdf │ ├── Skin Link.SLDPRT │ └── Stupid_basic.SLDASM └── TOY_BLOCK │ ├── BlockA.SLDPRT │ └── block_description │ ├── manifest.xml │ ├── meshes │ └── block_description.STL │ └── urdf │ └── BlockA.urdf └── scripts └── UpdateVersionInfo.ps1 /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **System Information** 11 | 1. SolidWorks version and service pack 12 | 2. Version of exporter 13 | 14 | **Describe the bug** 15 | A clear and concise description of what the bug is. 16 | 17 | **Attach simple model which clearly illustrates the issue** 18 | 19 | **Attach an example of a corrected URDF (if applicable)** 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/update-installer-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Update Installer Request 3 | about: Request a new version of the installer that is compatible with a different 4 | version of SolidWorks. 5 | title: '' 6 | labels: Update Installer 7 | assignees: '' 8 | 9 | --- 10 | 11 | **What versions of the installer have you tried?** 12 | 13 | **Have you confirmed that installing by source is successful?** 14 | 15 | **What version of SolidWorks and SP?** 16 | -------------------------------------------------------------------------------- /INSTALL/Install.iss: -------------------------------------------------------------------------------- 1 | ; Script generated by the Inno Setup Script Wizard. 2 | ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! 3 | 4 | #define MyAppName "SolidWorks To URDF" 5 | #define MyAppVersion "2018 v1.6" 6 | #define MyAppPublisher "Stephen Brawner" 7 | #define MyAppURL "http://wiki.ros.org/sw_urdf_exporter" 8 | 9 | #define MainBinaryName "SW2URDF.dll" 10 | #define SetupBaseName "sw2urdfSetup_" 11 | #define DllLocation AddBackslash(SourcePath + "..\SW2URDF\bin\x64\Debug") + MainBinaryName 12 | #define BuildVersion GetFileVersion(DllLocation) 13 | #define CommitVersion GetFileProductVersion(DllLocation) 14 | #define AVF1 Copy(BuildVersion, 1, Pos(".", BuildVersion) - 1) + "_" + Copy(BuildVersion, Pos(".", BuildVersion) + 1) 15 | #define AVF2 Copy(AVF1, 1, Pos(".", AVF1 ) - 1) + "_" + Copy(AVF1 , Pos(".", AVF1 ) + 1) 16 | #define AppVersionFile Copy(AVF2, 1, Pos(".", AVF2 ) - 1) + "_" + Copy(AVF2 , Pos(".", AVF2 ) + 1) 17 | 18 | [Setup] 19 | ; NOTE: The value of AppId uniquely identifies this application. 20 | ; Do not use the same AppId value in installers for other applications. 21 | ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) 22 | AppId={{E43E85A9-071D-430A-91B2-84B7AB923170} 23 | AppName={#MyAppName} 24 | AppVersion={#CommitVersion} 25 | VersionInfoVersion={#BuildVersion} 26 | VersionInfoCopyright=2019 27 | VersionInfoProductName={#MyAppName} 28 | ;AppVerName={#MyAppName} {#MyAppVersion} 29 | AppPublisher={#MyAppPublisher} 30 | AppPublisherURL={#MyAppURL} 31 | AppSupportURL={#MyAppURL} 32 | AppUpdatesURL={#MyAppURL} 33 | CreateAppDir=yes 34 | OutputBaseFilename=sw2urdfSetup 35 | ;OutputBaseFilename={#SetupBaseName + AppVersionFile} 36 | Compression=lzma 37 | DefaultDirName="C:\Program Files\SolidWorks Corp\SolidWorks\URDFExporter" 38 | SolidCompression=no 39 | PrivilegesRequired=admin 40 | OutputDir=..\..\INSTALL\OUTPUT 41 | SourceDir=..\SW2URDF\bin\ 42 | ArchitecturesAllowed=x64 43 | ArchitecturesInstallIn64BitMode=x64 44 | 45 | [Languages] 46 | Name: "english"; MessagesFile: "compiler:Default.isl" 47 | 48 | [Files] 49 | Source: x64\Debug\*; DestDir: {app}; Flags: ignoreversion; Check: IsWin64; 50 | ;Source: x86\Debug\*; DestDir: {app}; Flags: regserver ignoreversion; Check: not IsWin64 51 | 52 | ; NOTE: Don't use "Flags: ignoreversion" on any shared system files 53 | 54 | [Run] 55 | Filename: "{reg:HKLM64\SOFTWARE\Microsoft\.NETFramework,InstallRoot}\v4.0.30319\RegAsm.exe"; Parameters: """{app}\SW2URDF.dll"" ""/codebase"""; StatusMsg: Registering controls ...; Check: IsWin64; Languages: 56 | 57 | 58 | [Registry] 59 | Root: HKLM64; Subkey: "SOFTWARE\SolidWorks\Addins\65c9fc17-6a74-45a3-8f84-55185900275d"; ValueType: none; ValueName: ""; Flags: dontcreatekey deletekey uninsdeletevalue; Check: IsWin64 60 | Root: HKCU64; Subkey: "Software\SolidWorks\AddInsStartup\65c9fc17-6a74-45a3-8f84-55185900275d"; ValueType: none; ValueName: ""; Flags: dontcreatekey deletekey uninsdeletevalue; Check: IsWin64 61 | 62 | [UninstallRun] 63 | 64 | Filename: "{reg:HKLM64\SOFTWARE\Microsoft\.NETFramework,InstallRoot}\v4.0.30319\RegAsm.exe"; Parameters: """{app}\SW2URDF.dll"" ""/unregister"""; StatusMsg: Unregistering controls ...; Check: IsWin64; Languages: 65 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020 Stephen Brawner 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SolidWorks to URDF Exporter 2 | 3 | Authored and maintained by [Stephen Brawner](brawner@gmail.com). Past supporters include [PickNik Consulting](https://picknik.ai), Verb Surgical, Open Robotics, and Willow Garage. 4 | 5 | ## Latest Release 6 | 7 | **SolidWorks 2021** 8 | 9 | https://github.com/ros/solidworks_urdf_exporter/releases/tag/1.6.1 10 | 11 | **SolidWorks 2020** 12 | 13 | https://github.com/ros/solidworks_urdf_exporter/releases/tag/1.6.0 14 | 15 | **SolidWorks 2019 on 2018 SP 5** 16 | 17 | https://github.com/ros/solidworks_urdf_exporter/releases/tag/1.5.1 18 | 19 | ## SolidWorks Version Requirements 20 | 21 | 1. The minimum required version of SolidWorks for use with this add-in is 2018 Service Pack 5. SolidWorks 2017 or earlier may work. See [this issue](https://github.com/ros/solidworks_urdf_exporter/issues/73). 22 | 23 | ## Usage 24 | 25 | See the [ROS Wiki](http://wiki.ros.org/sw_urdf_exporter) and associated [tutorials](http://wiki.ros.org/sw_urdf_exporter/Tutorials). 26 | 27 | ## Development 28 | 29 | 1. Install Visual Studio 2017 30 | 1. Install .NET desktop development 31 | 1. From Visual Studio: `Tools > Get Tools and Features...` 32 | 1. Check `.NET desktop development` package 33 | 1. Select `Modify` 34 | 1. Install the [SolidWorks API tools](https://help.solidworks.com/2019/english/api/sldworksapiprogguide/GettingStarted/SolidWorks_API_Getting_Started_Overview.htm) 35 | 1. Launch Visual Studio with admin privileges. Right click and select `Run as Administrator` 36 | 1. Open `sw2urdf/SW2URDF.sln` 37 | 1. Enable Debugging 38 | 1. Right click `SW2URDF` in the Solution Explorer 39 | 1. Click the `Debug` Tab 40 | 1. Ensure `Configuration:` is set to `Debug` 41 | 1. Ensure `Start external program:` is pointing to the SolidWorks executable. For example `C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\SLDWORKS.exe` 42 | 43 | ## Converting mesh format from 3dxml to dae 44 | 45 | Executing the following command will convert the format of the exported mesh from 3DXML to DAE, and rewrite the URDF, allowing you to display colored meshes in visualization tools like RViz: 46 | 47 | ```bash 48 | pip3 install scikit-robot -U 49 | convert-urdf-mesh --output 50 | ``` 51 | 52 | ### Trouble Shooting 53 | 54 | 1. `AxImp.exe` error - Check the installation of the .Net Tools. If there is no error, install the Windows 10 SDK. 55 | 1. `Resourse.resx` error - Check if `sw2urdf/SW2URDF/Resources.resx` exists and is empty. If empty, delete this file then right click the `SW2URDF` in the Solution Explorer and select `Properties`. Navigate to the Resources tab and click the button to create a new file. 56 | -------------------------------------------------------------------------------- /SW2URDF.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.168 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SW2URDF", "SW2URDF\SW2URDF.csproj", "{473A16EC-06E9-4C08-B6EF-9AF0036B69E6}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestRunner", "TestRunner\TestRunner.csproj", "{4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Debug|x64 = Debug|x64 14 | Debug|x86 = Debug|x86 15 | Release|Any CPU = Release|Any CPU 16 | Release|x64 = Release|x64 17 | Release|x86 = Release|x86 18 | Test Release|Any CPU = Test Release|Any CPU 19 | Test Release|x64 = Test Release|x64 20 | Test Release|x86 = Test Release|x86 21 | Test|Any CPU = Test|Any CPU 22 | Test|x64 = Test|x64 23 | Test|x86 = Test|x86 24 | EndGlobalSection 25 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 26 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Debug|Any CPU.ActiveCfg = Debug|x64 27 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Debug|Any CPU.Build.0 = Debug|x64 28 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Debug|x64.ActiveCfg = Debug|x64 29 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Debug|x64.Build.0 = Debug|x64 30 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Debug|x86.ActiveCfg = Debug|x86 31 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Debug|x86.Build.0 = Debug|x86 32 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Release|Any CPU.Build.0 = Release|Any CPU 34 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Release|x64.ActiveCfg = Release|x64 35 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Release|x64.Build.0 = Release|x64 36 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Release|x86.ActiveCfg = Release|x86 37 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Release|x86.Build.0 = Release|x86 38 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Test Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Test Release|Any CPU.Build.0 = Release|Any CPU 40 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Test Release|x64.ActiveCfg = Release|x64 41 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Test Release|x64.Build.0 = Release|x64 42 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Test Release|x86.ActiveCfg = Release|x86 43 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Test Release|x86.Build.0 = Release|x86 44 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Test|Any CPU.ActiveCfg = Release|Any CPU 45 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Test|Any CPU.Build.0 = Release|Any CPU 46 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Test|x64.ActiveCfg = Debug|x64 47 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Test|x64.Build.0 = Debug|x64 48 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Test|x86.ActiveCfg = Release|x86 49 | {473A16EC-06E9-4C08-B6EF-9AF0036B69E6}.Test|x86.Build.0 = Release|x86 50 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 51 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Debug|Any CPU.Build.0 = Debug|Any CPU 52 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Debug|x64.ActiveCfg = Debug|Any CPU 53 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Debug|x64.Build.0 = Debug|Any CPU 54 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Debug|x86.ActiveCfg = Debug|Any CPU 55 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Debug|x86.Build.0 = Debug|Any CPU 56 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Release|Any CPU.ActiveCfg = Release|Any CPU 57 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Release|Any CPU.Build.0 = Release|Any CPU 58 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Release|x64.ActiveCfg = Release|Any CPU 59 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Release|x64.Build.0 = Release|Any CPU 60 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Release|x86.ActiveCfg = Release|Any CPU 61 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Release|x86.Build.0 = Release|Any CPU 62 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Test Release|Any CPU.ActiveCfg = Debug|Any CPU 63 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Test Release|Any CPU.Build.0 = Debug|Any CPU 64 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Test Release|x64.ActiveCfg = Release|Any CPU 65 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Test Release|x64.Build.0 = Release|Any CPU 66 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Test Release|x86.ActiveCfg = Debug|Any CPU 67 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Test Release|x86.Build.0 = Debug|Any CPU 68 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Test|Any CPU.ActiveCfg = Debug|Any CPU 69 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Test|Any CPU.Build.0 = Debug|Any CPU 70 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Test|x64.ActiveCfg = Debug|Any CPU 71 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Test|x64.Build.0 = Debug|Any CPU 72 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Test|x86.ActiveCfg = Debug|Any CPU 73 | {4BCA2D3C-ED8B-40F2-9B9E-CB02F64498FB}.Test|x86.Build.0 = Debug|Any CPU 74 | EndGlobalSection 75 | GlobalSection(SolutionProperties) = preSolution 76 | HideSolutionNode = FALSE 77 | EndGlobalSection 78 | GlobalSection(ExtensibilityGlobals) = postSolution 79 | SolutionGuid = {12ABEBE6-0D61-4C5B-A162-B0469B70371D} 80 | EndGlobalSection 81 | EndGlobal 82 | -------------------------------------------------------------------------------- /SW2URDF/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Stephen Brawner 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | using System.Reflection; 24 | 25 | // 26 | // General Information about an assembly is controlled through the following 27 | // set of attributes. Change these attribute values to modify the information 28 | // associated with an assembly. 29 | // 30 | [assembly: AssemblyTitle("")] 31 | [assembly: AssemblyDescription("")] 32 | [assembly: AssemblyConfiguration("")] 33 | [assembly: AssemblyCompany("")] 34 | [assembly: AssemblyProduct("")] 35 | [assembly: AssemblyCopyright("")] 36 | [assembly: AssemblyTrademark("")] 37 | [assembly: AssemblyCulture("")] 38 | 39 | // 40 | // Version information for an assembly consists of the following four values: 41 | // 42 | // Major Version 43 | // Minor Version 44 | // Build Number 45 | // Revision 46 | // 47 | // You can specify all the values or you can default the Revision and Build Numbers 48 | // by using the '*' as shown below: 49 | 50 | [assembly: AssemblyVersion("1.6.*")] 51 | // 52 | // In order to sign your assembly you must specify a key to use. Refer to the 53 | // Microsoft .NET Framework documentation for more information on assembly signing. 54 | // 55 | // Use the attributes below to control which key is used for signing. 56 | // 57 | // Notes: 58 | // (*) If no key is specified, the assembly is not signed. 59 | // (*) KeyName refers to a key that has been installed in the Crypto Service 60 | // Provider (CSP) on your machine. KeyFile refers to a file which contains 61 | // a key. 62 | // (*) If the KeyFile and the KeyName values are both specified, the 63 | // following processing occurs: 64 | // (1) If the KeyName can be found in the CSP, that key is used. 65 | // (2) If the KeyName does not exist and the KeyFile does exist, the key 66 | // in the KeyFile is installed into the CSP and used. 67 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. 68 | // When specifying the KeyFile, the location of the KeyFile should be 69 | // relative to the project output directory which is 70 | // %Project Directory%\obj\. For example, if your KeyFile is 71 | // located in the project directory, you would specify the AssemblyKeyFile 72 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] 73 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework 74 | // documentation for more information on this. 75 | // 76 | [assembly: AssemblyDelaySign(false)] 77 | [assembly: AssemblyKeyFile("")] 78 | [assembly: AssemblyKeyName("")] -------------------------------------------------------------------------------- /SW2URDF/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. 3 | // Project-level suppressions either have no target or are given 4 | // a specific target and scoped to a namespace, type, member, etc. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | 8 | [assembly: SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "To be fixed, there are just too many right now", Scope = "module")] 9 | [assembly: SuppressMessage("Design", "CA1062:Validate arguments of public methods", Justification = "To be fixed, there are too many right now", Scope = "module")] 10 | [assembly: SuppressMessage("Usage", "CA2211:Non-constant fields should not be visible", Justification = "See CA1051 above", Scope = "module")] 11 | [assembly: SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "To be fixed, too many to address right now", Scope = "module")] 12 | [assembly: SuppressMessage("Globalization", "CA1307:Specify StringComparison", Justification = "To be fixed, this tool is not localized", Scope = "module")] 13 | [assembly: SuppressMessage("Globalization", "CA1303:Do not pass literals as localized parameters", Justification = "To be fixed, this tool is not localized", Scope = "module")] 14 | [assembly: SuppressMessage("Globalization", "CA1305:Specify IFormatProvider", Justification = "To be fixed, this tool is not localized", Scope = "module")] 15 | [assembly: SuppressMessage("Reliability", "CA2000:Dispose objects before losing scope", Justification = "To be fixed, but too many for now", Scope = "module")] 16 | -------------------------------------------------------------------------------- /SW2URDF/Legacy/SerialNode.cs: -------------------------------------------------------------------------------- 1 | using log4net; 2 | using SW2URDF.URDF; 3 | using SW2URDF.Utilities; 4 | using System.Collections.Generic; 5 | using System.Runtime.Serialization; 6 | using System.Xml.Serialization; 7 | 8 | namespace SW2URDF.Legacy 9 | { 10 | //The serial node class, it is used only for saving the configuration. 11 | [DataContract(IsReference = true)] 12 | public class SerialNode 13 | { 14 | private readonly ILog logger = Logger.GetLogger(); 15 | 16 | [DataMember] 17 | public string linkName; 18 | 19 | [DataMember] 20 | public string jointName; 21 | 22 | [DataMember] 23 | public string axisName; 24 | 25 | [DataMember] 26 | public string coordsysName; 27 | 28 | [DataMember] 29 | public List componentPIDs; 30 | 31 | [DataMember] 32 | public string jointType; 33 | 34 | [DataMember] 35 | public bool isBaseNode; 36 | 37 | [DataMember] 38 | public bool isIncomplete; 39 | 40 | [DataMember] 41 | public List Nodes; 42 | 43 | [XmlIgnore] 44 | [DataMember] 45 | public Link URDFLink; 46 | 47 | //This is only used by the serialization module. 48 | public SerialNode() 49 | { 50 | Nodes = new List(); 51 | } 52 | 53 | public LinkNode BuildLinkNodeFromSerialNode() 54 | { 55 | logger.Info("Deserializing node " + linkName); 56 | LinkNode node = new LinkNode(); 57 | node.Link.Name = linkName; 58 | node.Link.Joint.Name = jointName; 59 | node.Link.Joint.AxisName = axisName; 60 | node.Link.Joint.CoordinateSystemName = coordsysName; 61 | node.Link.SWComponentPIDs = componentPIDs; 62 | node.Link.Joint.Type = jointType; 63 | node.IsBaseNode = isBaseNode; 64 | node.IsIncomplete = isIncomplete; 65 | 66 | node.Name = node.Link.Name; 67 | node.Text = node.Link.Name; 68 | 69 | foreach (SerialNode child in Nodes) 70 | { 71 | node.Nodes.Add(child.BuildLinkNodeFromSerialNode()); 72 | } 73 | return node; 74 | } 75 | } 76 | } -------------------------------------------------------------------------------- /SW2URDF/Properties/DataSources/SwAddin.datasource: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | SW2URDF.SwAddin, SW2URDF, Version=1.0.4542.28866, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /SW2URDF/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SW2URDF.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SW2URDF.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /SW2URDF/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | text/microsoft-resx 91 | 92 | 93 | 1.3 94 | 95 | 96 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 97 | 98 | 99 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 100 | 101 | -------------------------------------------------------------------------------- /SW2URDF/SW2URDF.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | en-US 11 | false 12 | ProjectFiles 13 | 14 | 15 | C:\PROGRA~1\SOLIDW~1\SOLIDW~1\\SldWorks.exe 16 | Program 17 | 18 | 19 | C:\PROGRA~1\SOLIDW~1\SOLIDW~1\\SldWorks.exe 20 | Program 21 | 22 | 23 | C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\SLDWORKS.exe 24 | Program 25 | true 26 | 27 | 28 | C:\PROGRA~1\SOLIDW~1\SOLIDW~1\\SldWorks.exe 29 | Program 30 | 31 | 32 | C:\PROGRA~1\SOLIDW~1\SOLIDW~1\\SldWorks.exe 33 | Program 34 | 35 | 36 | C:\PROGRA~1\SOLIDW~1\SOLIDW~1\\SldWorks.exe 37 | Program 38 | 39 | 40 | C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\SLDWORKS.exe 41 | true 42 | Program 43 | 44 | -------------------------------------------------------------------------------- /SW2URDF/SW2URDF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/SW2URDF/SW2URDF.png -------------------------------------------------------------------------------- /SW2URDF/SW2URDF.ruleset: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /SW2URDF/Test/SW2URDFTest.cs: -------------------------------------------------------------------------------- 1 | using SolidWorks.Interop.sldworks; 2 | using SolidWorks.Interop.swconst; 3 | using System.IO; 4 | using Xunit; 5 | 6 | namespace SW2URDF.Test 7 | { 8 | /// 9 | /// Base class for each Test class. This file contains many helper functions as well 10 | /// as access to the TestFixture which contains the SwApp reference. 11 | /// 12 | public abstract class SW2URDFTest : IClassFixture 13 | { 14 | public const string ModelName3DofArm = "3_DOF_ARM"; 15 | public const string ModelName4Wheeler = "4_WHEELER"; 16 | public const string ModelNameOriginal3DofArm = "ORIGINAL_3_DOF_ARM"; 17 | protected readonly SWTestFixture TestFixture; 18 | protected readonly SldWorks SwApp; 19 | public SW2URDFTest(SWTestFixture fixture) 20 | { 21 | SWTestFixture.Initialize(); 22 | TestFixture = fixture; 23 | SwApp = SWTestFixture.SwApp; 24 | } 25 | 26 | public void Dispose() 27 | { 28 | Assert.True(SwApp.CloseAllDocuments(true)); 29 | } 30 | 31 | public static string GetDebugDirectory() 32 | { 33 | return System.AppDomain.CurrentDomain.BaseDirectory; 34 | } 35 | 36 | public static string GetX64Directory() 37 | { 38 | return Path.GetDirectoryName(GetDebugDirectory()); 39 | } 40 | 41 | public static string GetBinDirectory() 42 | { 43 | return Path.GetDirectoryName(GetX64Directory()); 44 | } 45 | 46 | public static string GetProjectDirectory() 47 | { 48 | return Path.GetDirectoryName(GetBinDirectory()); 49 | } 50 | 51 | public static string GetSolutionDirectory() 52 | { 53 | return Path.GetDirectoryName(GetProjectDirectory()); 54 | } 55 | 56 | public static string GetExamplesDirectory() 57 | { 58 | return Path.Combine(GetSolutionDirectory(), "examples"); 59 | } 60 | 61 | public static string GetModelDirectory(string modelName) 62 | { 63 | return Path.Combine(GetExamplesDirectory(), modelName); 64 | } 65 | 66 | public static string GetPackageDirectory(string modelName) 67 | { 68 | string modelDirectory = GetModelDirectory(modelName); 69 | string package_name = modelName + "_description"; 70 | return Path.Combine(modelDirectory, package_name); 71 | } 72 | 73 | public static string GetURDFDirectory(string modelName) 74 | { 75 | return Path.Combine(GetPackageDirectory(modelName), "urdf"); 76 | } 77 | 78 | public static string GetMeshesDirectory(string modelName) 79 | { 80 | return Path.Combine(GetPackageDirectory(modelName), "meshes"); 81 | } 82 | 83 | public static string GetCSVPath(string modelName) 84 | { 85 | string urdfDirectory = GetURDFDirectory(modelName); 86 | string fileName = modelName + "_description.csv"; 87 | return Path.Combine(urdfDirectory, fileName); 88 | } 89 | 90 | public ModelDoc2 OpenSWDocument(string modelName) 91 | { 92 | Assert.True(SwApp.CloseAllDocuments(true)); 93 | 94 | string modelDirectory = GetModelDirectory(modelName); 95 | string filename = Path.Combine(modelDirectory, modelName + ".SLDASM"); 96 | Assert.True(File.Exists(filename)); 97 | int errors = 0; 98 | int warnings = 0; 99 | int filetype = (int)swDocumentTypes_e.swDocASSEMBLY; 100 | string configuration = ""; 101 | 102 | ModelDoc2 doc = SwApp.OpenDoc6(filename, filetype, (int)swOpenDocOptions_e.swOpenDocOptions_Silent, 103 | configuration, ref errors, ref warnings); 104 | Assert.Equal(0, errors); 105 | Assert.Equal(0, warnings); 106 | return doc; 107 | } 108 | 109 | public ModelDoc2 OpenSWPartDocument(string modelName) 110 | { 111 | Assert.True(SwApp.CloseAllDocuments(true)); 112 | 113 | string modelDirectory = GetModelDirectory(modelName); 114 | string filename = Path.Combine(modelDirectory, modelName + ".SLDPRT"); 115 | Assert.True(File.Exists(filename)); 116 | int errors = 0; 117 | int warnings = 0; 118 | int filetype = (int)swDocumentTypes_e.swDocASSEMBLY; 119 | string configuration = ""; 120 | 121 | ModelDoc2 doc = SwApp.OpenDoc6(filename, filetype, (int)swOpenDocOptions_e.swOpenDocOptions_Silent, 122 | configuration, ref errors, ref warnings); 123 | Assert.Equal(0, errors); 124 | Assert.Equal(0, warnings); 125 | return doc; 126 | } 127 | 128 | public static string CreateRandomTempDirectory() 129 | { 130 | string name = Path.GetRandomFileName(); 131 | string tempDirectory = Path.Combine(Path.GetTempPath(), name); 132 | Assert.True(Directory.CreateDirectory(tempDirectory).Exists); 133 | return tempDirectory; 134 | } 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /SW2URDF/Test/SWTestFixture.cs: -------------------------------------------------------------------------------- 1 | using SolidWorks.Interop.sldworks; 2 | using System; 3 | 4 | namespace SW2URDF.Test 5 | { 6 | /// 7 | /// TestFixture which gets passed to each Test Class. For now it just provides 8 | /// the reference to the SolidWorks app. 9 | /// 10 | public class SWTestFixture : IDisposable 11 | { 12 | public static bool Initialized = false; 13 | public static SldWorks SwApp; 14 | 15 | public static void Initialize() 16 | { 17 | if (!Initialized) 18 | { 19 | SwApp = (SldWorks)Activator.CreateInstance(Type.GetTypeFromProgID("SldWorks.Application")); 20 | SwApp.Visible = true; 21 | Initialized = true; 22 | } 23 | } 24 | 25 | public void Dispose() 26 | { 27 | Dispose(true); 28 | GC.SuppressFinalize(this); 29 | } 30 | 31 | protected virtual void Dispose(bool disposing) 32 | { 33 | 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SW2URDF/Test/TestCSVImportExport.cs: -------------------------------------------------------------------------------- 1 | using SolidWorks.Interop.sldworks; 2 | using SW2URDF.URDF; 3 | using SW2URDF.URDFExport; 4 | using SW2URDF.URDFExport.CSV; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.IO; 8 | using Xunit; 9 | 10 | namespace SW2URDF.Test 11 | { 12 | [Collection("Requires SW Test Collection")] 13 | public class TestCSVImportExport : SW2URDFTest 14 | { 15 | public TestCSVImportExport(SWTestFixture fixture) : base(fixture) 16 | { 17 | } 18 | 19 | [Theory] 20 | [InlineData("3_DOF_ARM", 4)] 21 | public void TestLoadURDFRobotFromCSV(string modelName, int expNumLinks) 22 | { 23 | string csvFilename = GetCSVPath(modelName); 24 | using (StreamReader reader = new StreamReader(csvFilename)) 25 | { 26 | List links = ImportExport.LoadURDFRobotFromCSV(reader.BaseStream); 27 | Assert.Equal(expNumLinks, links.Count); 28 | foreach (Link link in links) 29 | { 30 | Assert.NotNull(link); 31 | } 32 | } 33 | } 34 | 35 | [Theory] 36 | [InlineData("3_DOF_ARM", 5)] 37 | public void TestWriteRobotToCSV(string modelName, int expNumLines) 38 | { 39 | ModelDoc2 doc = OpenSWDocument(modelName); 40 | LinkNode baseNode = ConfigurationSerialization.LoadBaseNodeFromModel(doc, out bool abortProcess); 41 | Assert.False(abortProcess); 42 | Link baseLink = baseNode.RebuildLink(); 43 | Robot robot = new Robot(); 44 | robot.SetBaseLink(baseLink); 45 | 46 | string tempFile = Path.GetTempFileName(); 47 | 48 | try 49 | { 50 | ImportExport.WriteRobotToCSV(robot, tempFile); 51 | Assert.True(File.Exists(tempFile)); 52 | 53 | string[] text = File.ReadAllLines(tempFile); 54 | Assert.Equal(expNumLines, text.Length); 55 | } 56 | catch (Exception e) 57 | { 58 | Assert.True(false, "Failed to write robot to CSV " + e.Message); 59 | } 60 | finally 61 | { 62 | if (File.Exists(tempFile)) 63 | { 64 | File.Delete(tempFile); 65 | Assert.True(SwApp.CloseAllDocuments(true)); 66 | } 67 | } 68 | 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /SW2URDF/Test/TestLogger.cs: -------------------------------------------------------------------------------- 1 | using log4net; 2 | using SW2URDF.Utilities; 3 | using System.IO; 4 | using Xunit; 5 | 6 | namespace SW2URDF.Test 7 | { 8 | public class TestLogger : SW2URDFTest 9 | { 10 | public TestLogger(SWTestFixture fixture) : base(fixture) 11 | { 12 | } 13 | 14 | public static void TestGetLogger() 15 | { 16 | Assert.NotNull(Logger.GetLogger()); 17 | } 18 | 19 | public static void TestGetLoggerTwice() 20 | { 21 | Assert.Equal(Logger.GetLogger(), Logger.GetLogger()); 22 | } 23 | 24 | public static void TestLoggerFileExists() 25 | { 26 | ILog logger = Logger.GetLogger(); 27 | string filename = Logger.GetFileName(); 28 | string message = "Hello there"; 29 | logger.Info(message); 30 | LogManager.Flush(1000); 31 | Assert.True(File.Exists(filename)); 32 | 33 | string[] text = File.ReadAllLines(filename); 34 | Assert.Contains(message, text[text.Length - 1]); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /SW2URDF/Test/TestPropertyManager.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using SW2URDF.SW; 3 | using SW2URDF.URDFExport; 4 | using Xunit; 5 | 6 | namespace SW2URDF.Test 7 | { 8 | /// 9 | /// TODO (SIMINT-164), code in UI components needs to be tested, but 10 | /// pm.show() crashes SolidWorks. 11 | /// 12 | [Collection("Requires SW Test Collection")] 13 | public class TestPropertyManager : SW2URDFTest 14 | { 15 | public TestPropertyManager(SWTestFixture fixture) : base(fixture) 16 | { 17 | } 18 | 19 | 20 | // TODO(SIMINT-164) pm.Show() crashes with drag drop 21 | //[Theory] 22 | //[InlineData("3_DOF_ARM")] 23 | public void TestPropertyManagerOpens(string modelName) 24 | { 25 | OpenSWDocument(modelName); 26 | SwAddin addin = new SwAddin(); 27 | addin.ConnectToSW(SwApp, 0); 28 | addin.SetupAssemblyExporter(); 29 | SwApp.CloseAllDocuments(true); 30 | } 31 | 32 | // TODO(SIMINT-164) pm.Show() crashes with drag drop 33 | //[Theory] 34 | //[InlineData("3_DOF_ARM")] 35 | public void TestPropertyManagerOpenCloseOk(string modelName) 36 | { 37 | OpenSWDocument(modelName); 38 | 39 | ExportPropertyManager pm = new ExportPropertyManager(SwApp); 40 | pm.Show(); 41 | pm.Close(true); 42 | SwApp.CloseAllDocuments(true); 43 | Xunit.Assert.True(true, "Property manager failed to open/close with okay"); 44 | } 45 | 46 | // TODO(SIMINT-164) pm.Show() crashes with drag drop 47 | //[Theory] 48 | //[InlineData("3_DOF_ARM")] 49 | public void TestPropertyManagerOpenCloseNotOk(string modelName) 50 | { 51 | OpenSWDocument(modelName); 52 | 53 | ExportPropertyManager pm = new ExportPropertyManager(SwApp); 54 | pm.Show(); 55 | pm.Close(false); 56 | SwApp.CloseAllDocuments(true); 57 | Xunit.Assert.True(true, "Property manager failed to open/close with cancel"); 58 | } 59 | 60 | // TODO(SIMINT-164) pm.Show() crashes with drag drop 61 | //[Theory] 62 | //[InlineData("3_DOF_ARM")] 63 | public void TestPreviewExport(string modelName) 64 | { 65 | OpenSWDocument(modelName); 66 | ExportPropertyManager pm = new ExportPropertyManager(SwApp); 67 | pm.Show(); 68 | 69 | PrivateObject obj = new PrivateObject(pm); 70 | obj.Invoke("ExportButtonPress"); 71 | Xunit.Assert.NotNull(obj.GetProperty("Exporter.URDFRobot")); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /SW2URDF/Test/TestROSFIles.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace SW2URDF.Test 3 | { 4 | /// 5 | /// Todo(SIMINT-164) write tests to test existance of ROS files 6 | /// 7 | public class TestROSFIles : SW2URDFTest 8 | { 9 | public TestROSFIles(SWTestFixture fixture) : base(fixture) 10 | { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SW2URDF/Test/TestSWAttached.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace SW2URDF.Test 4 | { 5 | [Collection("Requires SW Test Collection")] 6 | public class TestSWAttached : SW2URDFTest 7 | { 8 | public TestSWAttached(SWTestFixture fixture) : base(fixture) 9 | { 10 | } 11 | 12 | [Fact] 13 | public void TestSWOpens() 14 | { 15 | Assert.NotNull(SwApp); 16 | } 17 | 18 | [Theory] 19 | [InlineData("3_DOF_ARM")] 20 | [InlineData("4_WHEELER")] 21 | [InlineData("ORIGINAL_3_DOF_ARM")] 22 | public void TestModelDocOpens(string modelName) 23 | { 24 | OpenSWDocument(modelName); 25 | Assert.True(SwApp.CloseAllDocuments(true)); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SW2URDF/Test/TestSerialization.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using SolidWorks.Interop.sldworks; 3 | using SW2URDF.URDF; 4 | using SW2URDF.URDFExport; 5 | using Xunit; 6 | 7 | namespace SW2URDF.Test 8 | { 9 | [Collection("Requires SW Test Collection")] 10 | public class TestSerialization : SW2URDFTest 11 | { 12 | public TestSerialization(SWTestFixture fixture) : base(fixture) 13 | { 14 | } 15 | 16 | [Theory] 17 | [InlineData("3_DOF_ARM", 4)] 18 | public void TestLoadConfigFromStringXML(string modelName, int expNumLinks) 19 | { 20 | ModelDoc2 doc = OpenSWDocument(modelName); 21 | PrivateType serialization = new PrivateType(typeof(ConfigurationSerialization)); 22 | object swAttObj = serialization.InvokeStatic( 23 | "FindSWSaveAttribute", new object[] { doc, "URDF Export Configuration" }); 24 | Xunit.Assert.NotNull(swAttObj); 25 | 26 | Attribute swAtt = (Attribute)swAttObj; 27 | Parameter param = swAtt.GetParameter("data"); 28 | 29 | Xunit.Assert.NotNull(param); 30 | string data = param.GetStringValue(); 31 | 32 | Xunit.Assert.NotNull(data); 33 | Xunit.Assert.NotEmpty(data); 34 | 35 | LinkNode baseNode = (LinkNode)serialization.InvokeStatic( 36 | "LoadConfigFromStringXML", new object[] { data }); 37 | Link link = baseNode.RebuildLink(); 38 | Xunit.Assert.Equal(expNumLinks, CommonSwOperations.GetCount(link)); 39 | } 40 | 41 | [Theory] 42 | [InlineData("3_DOF_ARM", 4)] 43 | [InlineData("4_WHEELER", 5)] 44 | public void TestLoadBaseNodeFromModel(string modelName, int expNumLinks) 45 | { 46 | ModelDoc2 doc = OpenSWDocument(modelName); 47 | LinkNode baseNode = ConfigurationSerialization.LoadBaseNodeFromModel(doc, out bool error); 48 | Xunit.Assert.False(error); 49 | Xunit.Assert.NotNull(baseNode); 50 | Xunit.Assert.Equal(expNumLinks, CommonSwOperations.GetCount(baseNode.RebuildLink())); 51 | } 52 | 53 | [Theory] 54 | [InlineData("3_DOF_ARM")] 55 | [InlineData("4_WHEELER")] 56 | public void TestSerializeToString(string modelName) 57 | { 58 | ModelDoc2 doc = OpenSWDocument(modelName); 59 | LinkNode baseNode = ConfigurationSerialization.LoadBaseNodeFromModel(doc, out bool error); 60 | Xunit.Assert.False(error); 61 | 62 | PrivateType serialization = new PrivateType(typeof(ConfigurationSerialization)); 63 | string newData = (string)serialization.InvokeStatic( 64 | "SerializeToString", new object[] { baseNode }); 65 | Xunit.Assert.NotNull(newData); 66 | Xunit.Assert.NotEmpty(newData); 67 | 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /SW2URDF/Test/TestURDFMerge.cs: -------------------------------------------------------------------------------- 1 | namespace SW2URDF.Test 2 | { 3 | /// 4 | /// TODO(SIMINT-164) Implement tests covering public methods below 5 | /// public Link Merge(TreeView cadTree, URDFTreeCorrespondance correspondance) 6 | /// public void BuildCorrespondance(URDFTreeView existingTree, List loadedLinks, 7 | /// out List matchedLinks, out List unmatchedLinks) 8 | /// public Link GetCorrespondingLink(TreeViewItem item) 9 | /// 10 | public class TestURDFMerge : SW2URDFTest 11 | { 12 | public TestURDFMerge(SWTestFixture fixture) : base(fixture) 13 | { 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /SW2URDF/Test/TestURDFPackage.cs: -------------------------------------------------------------------------------- 1 | using Moq; 2 | using SW2URDF.UI; 3 | using SW2URDF.URDFExport; 4 | using System; 5 | using System.IO; 6 | using System.Windows; 7 | using Xunit; 8 | 9 | namespace SW2URDF.Test 10 | { 11 | public class TestURDFPackage : SW2URDFTest 12 | { 13 | public TestURDFPackage(SWTestFixture fixture) : base(fixture) 14 | { 15 | } 16 | 17 | [Fact] 18 | public void TestCreateDirectories() 19 | { 20 | string tempDirectory = CreateRandomTempDirectory(); 21 | string name = Path.GetRandomFileName(); 22 | URDFPackage pkg = new URDFPackage(name, tempDirectory); 23 | 24 | Mock messageBoxMock = new Mock(); 25 | messageBoxMock.Setup(m => m.Show(It.IsAny())) 26 | .Returns(MessageBoxResult.OK); //can be whatever depends on test case 27 | URDFPackage.MessageBox = messageBoxMock.Object; 28 | pkg.CreateDirectories(); 29 | 30 | Assert.True(Directory.Exists(pkg.WindowsPackageDirectory)); 31 | Assert.True(Directory.Exists(pkg.WindowsMeshesDirectory)); 32 | Assert.True(Directory.Exists(pkg.WindowsRobotsDirectory)); 33 | Assert.True(Directory.Exists(pkg.WindowsTexturesDirectory)); 34 | Assert.True(Directory.Exists(pkg.WindowsLaunchDirectory)); 35 | Assert.True(Directory.Exists(pkg.WindowsConfigDirectory)); 36 | 37 | Directory.Delete(tempDirectory, true); 38 | } 39 | 40 | [Fact] 41 | public void TestCreateCMakeLists() 42 | { 43 | string tempDirectory = CreateRandomTempDirectory(); 44 | string name = Path.GetRandomFileName(); 45 | URDFPackage pkg = new URDFPackage(name, tempDirectory); 46 | Mock messageBoxMock = new Mock(); 47 | messageBoxMock.Setup(m => m.Show(It.IsAny())) 48 | .Returns(MessageBoxResult.OK); //can be whatever depends on test case 49 | URDFPackage.MessageBox = messageBoxMock.Object; 50 | pkg.CreateDirectories(); 51 | pkg.CreateCMakeLists(); 52 | 53 | Assert.True(File.Exists(pkg.WindowsCMakeLists)); 54 | 55 | Console.WriteLine("Deleting directory " + tempDirectory); 56 | Directory.Delete(tempDirectory, true); 57 | } 58 | 59 | [Fact] 60 | public void TestCreateConfigYAML() 61 | { 62 | string tempDirectory = CreateRandomTempDirectory(); 63 | string name = Path.GetRandomFileName(); 64 | Directory.CreateDirectory(tempDirectory); 65 | URDFPackage pkg = new URDFPackage(name, tempDirectory); 66 | Mock messageBoxMock = new Mock(); 67 | messageBoxMock.Setup(m => m.Show(It.IsAny())) 68 | .Returns(MessageBoxResult.OK); //can be whatever depends on test case 69 | URDFPackage.MessageBox = messageBoxMock.Object; 70 | pkg.CreateDirectories(); 71 | pkg.CreateConfigYAML(new string[] {"a", "b", "c"}); 72 | 73 | Assert.True(File.Exists(pkg.WindowsConfigYAML)); 74 | 75 | Console.WriteLine("Deleting directory " + tempDirectory); 76 | Directory.Delete(tempDirectory, true); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /SW2URDF/Test/TestVersioning.cs: -------------------------------------------------------------------------------- 1 |  2 | using SW2URDF.Versioning; 3 | using Xunit; 4 | 5 | namespace SW2URDF.Test 6 | { 7 | public class TestVersioning : SW2URDFTest 8 | { 9 | public TestVersioning(SWTestFixture fixture) : base(fixture) 10 | { 11 | } 12 | 13 | [Fact] 14 | public void TestGetCommitVersion() 15 | { 16 | string commitVersion = Version.GetCommitVersion(); 17 | Assert.NotNull(commitVersion); 18 | Assert.NotEmpty(commitVersion); 19 | Assert.DoesNotContain("dirty", commitVersion); 20 | } 21 | 22 | [Fact] 23 | public void TestGetBuildVersion() 24 | { 25 | string buildVersion = Version.GetBuildVersion(); 26 | Assert.NotNull(buildVersion); 27 | Assert.NotEmpty(buildVersion); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /SW2URDF/UI/AssemblyExportForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /SW2URDF/UI/IMessageBox.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace SW2URDF.UI 4 | { 5 | public interface IMessageBox 6 | { 7 | MessageBoxResult Show(string message); 8 | MessageBoxResult Show(string message, string caption, MessageBoxButton buttons); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /SW2URDF/UI/MessageBoxHelper.cs: -------------------------------------------------------------------------------- 1 |  2 | using System.Windows; 3 | 4 | namespace SW2URDF.UI 5 | { 6 | public class MessageBoxHelper : IMessageBox 7 | { 8 | public MessageBoxResult Show(string message) 9 | { 10 | return MessageBox.Show(message); 11 | } 12 | 13 | public MessageBoxResult Show(string message, string caption, MessageBoxButton buttons) 14 | { 15 | return MessageBox.Show(message, caption, buttons); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SW2URDF/UI/PartExportForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /SW2URDF/UI/Resources/Images/AddinIcon.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/SW2URDF/UI/Resources/Images/AddinIcon.bmp -------------------------------------------------------------------------------- /SW2URDF/UI/Resources/Images/MainIconLarge.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/SW2URDF/UI/Resources/Images/MainIconLarge.bmp -------------------------------------------------------------------------------- /SW2URDF/UI/Resources/Images/MainIconSmall.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/SW2URDF/UI/Resources/Images/MainIconSmall.bmp -------------------------------------------------------------------------------- /SW2URDF/UI/Resources/Images/ToolbarLarge.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/SW2URDF/UI/Resources/Images/ToolbarLarge.bmp -------------------------------------------------------------------------------- /SW2URDF/UI/Resources/Images/ToolbarSmall.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/SW2URDF/UI/Resources/Images/ToolbarSmall.bmp -------------------------------------------------------------------------------- /SW2URDF/UI/TreeMergedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using SW2URDF.URDFExport.URDFMerge; 2 | using System; 3 | 4 | namespace SW2URDF.UI 5 | { 6 | public class TreeMergedEventArgs : EventArgs 7 | { 8 | public readonly URDFTreeView MergedTree; 9 | public readonly bool Success; 10 | public readonly bool UsedCSVInertial; 11 | public readonly bool UsedCSVVisualCollision; 12 | public readonly bool UsedCSVJointKinematics; 13 | public readonly bool UsedCSVJointOther; 14 | public readonly string CSVFilename; 15 | 16 | public TreeMergedEventArgs() 17 | { 18 | Success = false; 19 | } 20 | 21 | public TreeMergedEventArgs(URDFTreeView mergedTree, bool success, TreeMerger merger, string csvFilename) 22 | { 23 | MergedTree = mergedTree; 24 | Success = success; 25 | UsedCSVInertial = merger.UseCSVInertial; 26 | UsedCSVVisualCollision = merger.UseCSVVisualCollision; 27 | UsedCSVJointKinematics = merger.UseCSVJointKinematics; 28 | UsedCSVJointOther = merger.UseCSVJointOther; 29 | CSVFilename = csvFilename; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /SW2URDF/UI/TreeModifiedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SW2URDF.UI 4 | { 5 | public class TreeModifiedEventArgs : EventArgs 6 | { 7 | public URDFTreeView Tree; 8 | } 9 | } -------------------------------------------------------------------------------- /SW2URDF/UI/UIResources.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /SW2URDF/URDF/Axis.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Collections.Specialized; 3 | using System.Runtime.Serialization; 4 | using System.Windows.Forms; 5 | 6 | namespace SW2URDF.URDF 7 | { 8 | [DataContract(IsReference = true, Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 9 | public class Axis : URDFElement 10 | { 11 | [DataMember] 12 | private readonly URDFAttribute XYZAttribute; 13 | 14 | private double[] XYZ 15 | { 16 | get => (double[])XYZAttribute.Value; 17 | set => XYZAttribute.Value = value; 18 | } 19 | 20 | public double[] GetXYZ() 21 | { 22 | return (double[])XYZ.Clone(); 23 | } 24 | 25 | public void SetXYZ(double[] xyz) 26 | { 27 | XYZ = (double[])xyz.Clone(); 28 | } 29 | 30 | public double X 31 | { 32 | get => XYZ[0]; 33 | set => XYZ[0] = value; 34 | } 35 | 36 | public double Y 37 | { 38 | get => XYZ[1]; 39 | set => XYZ[1] = value; 40 | } 41 | 42 | public double Z 43 | { 44 | get => XYZ[2]; 45 | set => XYZ[2] = value; 46 | } 47 | 48 | public Axis() : base("axis", false) 49 | { 50 | XYZAttribute = new URDFAttribute("xyz", true, new double[] { 0, 0, 0 }); 51 | 52 | Attributes.Add(XYZAttribute); 53 | } 54 | 55 | public void FillBoxes(TextBox boxX, TextBox boxY, TextBox boxZ, string format) 56 | { 57 | string[] xyzText = XYZAttribute.GetTextArrayFromDoubleArray(format); 58 | if (xyzText != null) 59 | { 60 | boxX.Text = xyzText[0]; 61 | boxY.Text = xyzText[1]; 62 | boxZ.Text = xyzText[2]; 63 | } 64 | } 65 | 66 | public void Update(TextBox boxX, TextBox boxY, TextBox boxZ) 67 | { 68 | XYZAttribute.SetDoubleArrayFromStringArray(new string[] { boxX.Text, boxY.Text, boxZ.Text }); 69 | } 70 | 71 | /// 72 | /// Axis is similar to Origin in that its attribute is stored as a double array. 73 | /// 74 | /// 75 | /// 76 | public override void SetElementFromData(List context, StringDictionary dictionary) 77 | { 78 | string typeName = GetType().Name; 79 | List updatedContext = new List(context) { typeName }; 80 | 81 | double[] xyz = new double[3]; 82 | 83 | string contextString = string.Join(".", updatedContext) + ".xyz"; 84 | for (int i = 0; i < xyz.Length; i++) 85 | { 86 | string lookupString = contextString + "." + "xyz"[i]; 87 | if (!dictionary.ContainsKey(lookupString)) 88 | { 89 | logger.Info("CSV file does not contain column for " + lookupString); 90 | continue; 91 | } 92 | 93 | object value = URDFAttribute.GetValueFromString(dictionary[lookupString]); 94 | if (value != null && value.GetType() == typeof(double)) 95 | { 96 | xyz[i] = (double)value; 97 | } 98 | } 99 | 100 | XYZAttribute.Value = xyz; 101 | } 102 | } 103 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/Calibration.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Windows.Forms; 3 | 4 | namespace SW2URDF.URDF 5 | { 6 | //The calibration element of a joint. 7 | [DataContract(IsReference = true, Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 8 | public class Calibration : URDFElement 9 | { 10 | [DataMember] 11 | private readonly URDFAttribute RisingAttribute; 12 | 13 | public double Rising 14 | { 15 | get => (double)RisingAttribute.Value; 16 | set => RisingAttribute.Value = value; 17 | } 18 | 19 | [DataMember] 20 | private readonly URDFAttribute FallingAttribute; 21 | 22 | public double Falling 23 | { 24 | get => (double)FallingAttribute.Value; 25 | set => FallingAttribute.Value = value; 26 | } 27 | 28 | public Calibration() : base("calibration", false) 29 | { 30 | RisingAttribute = new URDFAttribute("rising", false, null); 31 | FallingAttribute = new URDFAttribute("falling", false, null); 32 | Attributes.Add(RisingAttribute); 33 | Attributes.Add(FallingAttribute); 34 | } 35 | 36 | public void FillBoxes(TextBox boxRising, TextBox boxFalling, string format) 37 | { 38 | boxRising.Text = RisingAttribute.GetTextFromDoubleValue(format); 39 | boxFalling.Text = FallingAttribute.GetTextFromDoubleValue(format); 40 | } 41 | 42 | public void SetValues(TextBox boxRising, TextBox boxFalling) 43 | { 44 | RisingAttribute.SetDoubleValueFromString(boxRising.Text); 45 | FallingAttribute.SetDoubleValueFromString(boxFalling.Text); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/ChildLink.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Windows.Forms; 3 | 4 | namespace SW2URDF.URDF 5 | { 6 | //The child link element 7 | [DataContract(Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 8 | public class ChildLink : URDFElement 9 | { 10 | [DataMember] 11 | private readonly URDFAttribute NameAttribute; 12 | 13 | public string Name 14 | { 15 | get => (string)NameAttribute.Value; 16 | set => NameAttribute.Value = value; 17 | } 18 | 19 | public ChildLink() : base("child", true) 20 | { 21 | NameAttribute = new URDFAttribute("link", true, ""); 22 | Attributes.Add(NameAttribute); 23 | } 24 | 25 | public void FillBoxes(Label box) 26 | { 27 | box.Text = Name; 28 | } 29 | 30 | public void Update(Label box) 31 | { 32 | Name = box.Text; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/Collision.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace SW2URDF.URDF 4 | { 5 | //The collision element of a link. 6 | [DataContract(Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 7 | public class Collision : URDFElement 8 | { 9 | [DataMember] 10 | public readonly Origin Origin; 11 | 12 | [DataMember] 13 | public readonly Geometry Geometry; 14 | 15 | public Collision() : base("collision", false) 16 | { 17 | Origin = new Origin(false); 18 | Geometry = new Geometry(); 19 | 20 | ChildElements.Add(Origin); 21 | ChildElements.Add(Geometry); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/Color.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Windows.Forms; 3 | 4 | namespace SW2URDF.URDF 5 | { 6 | //The color element of the material element. Contains a single RGBA. 7 | [DataContract(Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 8 | public class Color : URDFElement 9 | { 10 | [DataMember] 11 | private readonly URDFAttribute RGBAAttribute; 12 | 13 | private double[] RGBA 14 | { 15 | get => (double[])RGBAAttribute.Value; 16 | set => RGBAAttribute.Value = value; 17 | } 18 | 19 | public double Red 20 | { 21 | get => RGBA[0]; 22 | set => RGBA[0] = value; 23 | } 24 | 25 | public double Green 26 | { 27 | get => RGBA[1]; 28 | set => RGBA[1] = value; 29 | } 30 | 31 | public double Blue 32 | { 33 | get => RGBA[2]; 34 | set => RGBA[2] = value; 35 | } 36 | 37 | public double Alpha 38 | { 39 | get => RGBA[3]; 40 | set => RGBA[3] = value; 41 | } 42 | 43 | public Color() : base("color", false) 44 | { 45 | RGBAAttribute = new URDFAttribute("rgba", true, new double[] { 1, 1, 1, 1 }); 46 | 47 | Attributes.Add(RGBAAttribute); 48 | } 49 | 50 | public void FillBoxes(DomainUpDown boxRed, DomainUpDown boxGreen, 51 | DomainUpDown boxBlue, DomainUpDown boxAlpha, string format) 52 | { 53 | string[] rgbaText = RGBAAttribute.GetTextArrayFromDoubleArray(format); 54 | if (rgbaText != null) 55 | { 56 | boxRed.Text = rgbaText[0]; 57 | boxGreen.Text = rgbaText[1]; 58 | boxBlue.Text = rgbaText[2]; 59 | boxAlpha.Text = rgbaText[3]; 60 | } 61 | } 62 | 63 | public void Update(DomainUpDown boxRed, DomainUpDown boxGreen, 64 | DomainUpDown boxBlue, DomainUpDown boxAlpha) 65 | { 66 | RGBAAttribute.SetDoubleArrayFromStringArray( 67 | new string[] { boxRed.Text, boxGreen.Text, boxBlue.Text, boxAlpha.Text }); 68 | } 69 | 70 | public void SetColor(double[] rgba) 71 | { 72 | Red = rgba[0]; 73 | Green = rgba[1]; 74 | Blue = rgba[2]; 75 | Alpha = rgba[3]; 76 | } 77 | 78 | public double[] GetColor() 79 | { 80 | return new double[] { Red, Green, Blue, Alpha }; 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/ConfigVersion.cs: -------------------------------------------------------------------------------- 1 | namespace SW2URDF.URDF 2 | { 3 | public static class ConfigVersion 4 | { 5 | public static readonly double DATA_CONTRACT_VERSION = 1.4; 6 | } 7 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/Dynamics.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Windows.Forms; 3 | 4 | namespace SW2URDF.URDF 5 | { 6 | //The dynamics element of a joint. 7 | [DataContract(IsReference = true, Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 8 | public class Dynamics : URDFElement 9 | { 10 | [DataMember] 11 | private readonly URDFAttribute DampingAttribute; 12 | 13 | public double Damping 14 | { 15 | get => (double)DampingAttribute.Value; 16 | set => DampingAttribute.Value = value; 17 | } 18 | 19 | [DataMember] 20 | private readonly URDFAttribute FrictionAttribute; 21 | 22 | public double Friction 23 | { 24 | get => (double)FrictionAttribute.Value; 25 | set => FrictionAttribute.Value = value; 26 | } 27 | 28 | public Dynamics() : base("dynamics", false) 29 | { 30 | DampingAttribute = new URDFAttribute("damping", false, null); 31 | FrictionAttribute = new URDFAttribute("friction", false, null); 32 | 33 | Attributes.Add(DampingAttribute); 34 | Attributes.Add(FrictionAttribute); 35 | } 36 | 37 | public void FillBoxes(TextBox boxDamping, TextBox boxFriction, string format) 38 | { 39 | boxDamping.Text = DampingAttribute.GetTextFromDoubleValue(format); 40 | boxFriction.Text = FrictionAttribute.GetTextFromDoubleValue(format); 41 | } 42 | 43 | public void SetValues(TextBox boxDamping, TextBox boxFriction) 44 | { 45 | DampingAttribute.SetDoubleValueFromString(boxDamping.Text); 46 | FrictionAttribute.SetDoubleValueFromString(boxFriction.Text); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/Geometry.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace SW2URDF.URDF 4 | { 5 | //The geometry element of the visual and collision elements 6 | [DataContract(IsReference = true, Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 7 | public class Geometry : URDFElement 8 | { 9 | [DataMember] 10 | public readonly Mesh Mesh; 11 | 12 | public Geometry() : base("geometry", true) 13 | { 14 | Mesh = new Mesh(); 15 | ChildElements.Add(Mesh); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/Inertia.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Windows.Forms; 3 | 4 | namespace SW2URDF.URDF 5 | { 6 | //Inertia element, which means moment of inertia. In the inertial element 7 | [DataContract(IsReference = true, Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 8 | public class Inertia : URDFElement 9 | { 10 | [DataMember] 11 | private readonly URDFAttribute IxxAttribute; 12 | 13 | [DataMember] 14 | private readonly URDFAttribute IxyAttribute; 15 | 16 | [DataMember] 17 | private readonly URDFAttribute IxzAttribute; 18 | 19 | [DataMember] 20 | private readonly URDFAttribute IyyAttribute; 21 | 22 | [DataMember] 23 | private readonly URDFAttribute IyzAttribute; 24 | 25 | [DataMember] 26 | private readonly URDFAttribute IzzAttribute; 27 | 28 | public double Ixx 29 | { 30 | get => (double)IxxAttribute.Value; 31 | set => IxxAttribute.Value = value; 32 | } 33 | 34 | public double Ixy 35 | { 36 | get => (double)IxyAttribute.Value; 37 | set => IxyAttribute.Value = value; 38 | } 39 | 40 | public double Ixz 41 | { 42 | get => (double)IxzAttribute.Value; 43 | set => IxzAttribute.Value = value; 44 | } 45 | 46 | public double Iyy 47 | { 48 | get => (double)IyyAttribute.Value; 49 | set => IyyAttribute.Value = value; 50 | } 51 | 52 | public double Iyz 53 | { 54 | get => (double)IyzAttribute.Value; 55 | set => IyzAttribute.Value = value; 56 | } 57 | 58 | public double Izz 59 | { 60 | get => (double)IzzAttribute.Value; 61 | set => IzzAttribute.Value = value; 62 | } 63 | 64 | public Inertia() : base("inertia", false) 65 | { 66 | IxxAttribute = new URDFAttribute("ixx", true, 0.0); 67 | IxyAttribute = new URDFAttribute("ixy", true, 0.0); 68 | IxzAttribute = new URDFAttribute("ixz", true, 0.0); 69 | IyyAttribute = new URDFAttribute("iyy", true, 0.0); 70 | IyzAttribute = new URDFAttribute("iyz", true, 0.0); 71 | IzzAttribute = new URDFAttribute("izz", true, 0.0); 72 | 73 | Attributes.Add(IxxAttribute); 74 | Attributes.Add(IxyAttribute); 75 | Attributes.Add(IxzAttribute); 76 | Attributes.Add(IyyAttribute); 77 | Attributes.Add(IyzAttribute); 78 | Attributes.Add(IzzAttribute); 79 | } 80 | 81 | public void SetMomentMatrix(double[] array) 82 | { 83 | Ixx = array[0]; 84 | Ixy = -array[1]; 85 | Ixz = -array[2]; 86 | Iyy = array[4]; 87 | Iyz = -array[5]; 88 | Izz = array[8]; 89 | } 90 | 91 | public void FillBoxes(TextBox boxIxx, TextBox boxIxy, TextBox boxIxz, 92 | TextBox boxIyy, TextBox boxIyz, TextBox boxIzz, string format) 93 | { 94 | boxIxx.Text = IxxAttribute.GetTextFromDoubleValue(format); 95 | boxIxy.Text = IxyAttribute.GetTextFromDoubleValue(format); 96 | boxIxz.Text = IxzAttribute.GetTextFromDoubleValue(format); 97 | boxIyy.Text = IyyAttribute.GetTextFromDoubleValue(format); 98 | boxIyz.Text = IyzAttribute.GetTextFromDoubleValue(format); 99 | boxIzz.Text = IzzAttribute.GetTextFromDoubleValue(format); 100 | } 101 | 102 | public void Update(TextBox boxIxx, TextBox boxIxy, TextBox boxIxz, 103 | TextBox boxIyy, TextBox boxIyz, TextBox boxIzz) 104 | { 105 | IxxAttribute.SetDoubleValueFromString(boxIxx.Text); 106 | IxyAttribute.SetDoubleValueFromString(boxIxy.Text); 107 | IxzAttribute.SetDoubleValueFromString(boxIxz.Text); 108 | IyyAttribute.SetDoubleValueFromString(boxIyy.Text); 109 | IyzAttribute.SetDoubleValueFromString(boxIyz.Text); 110 | IzzAttribute.SetDoubleValueFromString(boxIzz.Text); 111 | } 112 | 113 | internal double[] GetMoment() 114 | { 115 | return new double[] { Ixx, Ixy, Ixz, Ixy, Iyy, Iyz, Ixz, Iyz, Izz }; 116 | } 117 | } 118 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/Inertial.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace SW2URDF.URDF 4 | { 5 | //The inertial element of a link 6 | [DataContract(IsReference = true, Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 7 | public class Inertial : URDFElement 8 | { 9 | [DataMember] 10 | public readonly Origin Origin; 11 | 12 | [DataMember] 13 | public readonly Mass Mass; 14 | 15 | [DataMember] 16 | public readonly Inertia Inertia; 17 | 18 | public Inertial() : base("inertial", false) 19 | { 20 | Origin = new Origin(false); 21 | Mass = new Mass(); 22 | Inertia = new Inertia(); 23 | 24 | ChildElements.Add(Origin); 25 | ChildElements.Add(Mass); 26 | ChildElements.Add(Inertia); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/Joint.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Collections.Specialized; 3 | using System.Runtime.Serialization; 4 | using System.Windows.Forms; 5 | 6 | namespace SW2URDF.URDF 7 | { 8 | //The joint class. There is one for every link but the base link 9 | [DataContract(IsReference = true, Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 10 | public class Joint : URDFElement 11 | { 12 | public static readonly List AvailableTypes = new List 13 | { 14 | "revolute", "continuous", "prismatic", "fixed", "floating", "planar" 15 | }; 16 | 17 | [DataMember] 18 | private readonly URDFAttribute NameAttribute; 19 | 20 | public string Name 21 | { 22 | get => (string)NameAttribute.Value; 23 | set => NameAttribute.Value = value; 24 | } 25 | 26 | [DataMember] 27 | private readonly URDFAttribute TypeAttribute; 28 | 29 | public string Type 30 | { 31 | get => (string)TypeAttribute.Value; 32 | set => TypeAttribute.Value = value; 33 | } 34 | 35 | [DataMember] 36 | public readonly Origin Origin; 37 | 38 | [DataMember] 39 | public readonly ParentLink Parent; 40 | 41 | [DataMember] 42 | public readonly ChildLink Child; 43 | 44 | [DataMember] 45 | public readonly Axis Axis; 46 | 47 | [DataMember] 48 | public readonly Limit Limit; 49 | 50 | [DataMember] 51 | public readonly Calibration Calibration; 52 | 53 | [DataMember] 54 | public readonly Dynamics Dynamics; 55 | 56 | [DataMember] 57 | public readonly SafetyController Safety; 58 | 59 | [DataMember(IsRequired = false)] 60 | public readonly Mimic Mimic; 61 | 62 | [DataMember] 63 | public string CoordinateSystemName; 64 | 65 | [DataMember] 66 | public string AxisName; 67 | 68 | public Joint() : base("joint", false) 69 | { 70 | Origin = new Origin(false); 71 | Parent = new ParentLink(); 72 | Child = new ChildLink(); 73 | Axis = new Axis(); 74 | 75 | Limit = new Limit(); 76 | Calibration = new Calibration(); 77 | Dynamics = new Dynamics(); 78 | Safety = new SafetyController(); 79 | Mimic = new Mimic(); 80 | 81 | NameAttribute = new URDFAttribute("name", true, ""); 82 | TypeAttribute = new URDFAttribute("type", true, ""); 83 | 84 | Attributes.Add(NameAttribute); 85 | Attributes.Add(TypeAttribute); 86 | 87 | ChildElements.Add(Origin); 88 | ChildElements.Add(Parent); 89 | ChildElements.Add(Child); 90 | ChildElements.Add(Axis); 91 | 92 | ChildElements.Add(Limit); 93 | ChildElements.Add(Calibration); 94 | ChildElements.Add(Dynamics); 95 | ChildElements.Add(Safety); 96 | ChildElements.Add(Mimic); 97 | } 98 | 99 | public void FillBoxes(TextBox boxName, ComboBox boxType) 100 | { 101 | boxName.Text = Name; 102 | boxType.Text = Type; 103 | } 104 | 105 | public void Update(TextBox boxName, ComboBox boxType) 106 | { 107 | Name = boxName.Text; 108 | Type = boxType.Text; 109 | } 110 | 111 | public override bool ElementContainsData() 112 | { 113 | return !string.IsNullOrWhiteSpace(Name) && !string.IsNullOrWhiteSpace(Type); 114 | } 115 | 116 | public override bool AreRequiredFieldsSatisfied() 117 | { 118 | Limit.SetRequired((Type == "prismatic" || Type == "revolute")); 119 | return base.AreRequiredFieldsSatisfied(); 120 | } 121 | 122 | public override void AppendToCSVDictionary(List context, OrderedDictionary dictionary) 123 | { 124 | string contextString = string.Join(".", context); 125 | 126 | string coordSysContext = contextString + ".CoordSysName"; 127 | dictionary.Add(coordSysContext, CoordinateSystemName); 128 | 129 | string axisContext = contextString + ".AxisName"; 130 | dictionary.Add(axisContext, AxisName); 131 | 132 | base.AppendToCSVDictionary(context, dictionary); 133 | } 134 | 135 | public override void SetElement(URDFElement externalElement) 136 | { 137 | base.SetElement(externalElement); 138 | 139 | // The base method already performs the type check, so we don't have to for this cast 140 | Joint joint = (Joint)externalElement; 141 | 142 | // These strings aren't kept as URDFAttribute objects and so they are tracked separately 143 | CoordinateSystemName = joint.CoordinateSystemName; 144 | AxisName = joint.AxisName; 145 | } 146 | 147 | public override void SetElementFromData(List context, StringDictionary dictionary) 148 | { 149 | string contextString = string.Join(".", context); 150 | 151 | string coordSysContext = contextString + ".CoordSysName"; 152 | CoordinateSystemName = dictionary[coordSysContext]; 153 | 154 | string axisContext = contextString + ".AxisName"; 155 | AxisName = dictionary[axisContext]; 156 | 157 | base.SetElementFromData(context, dictionary); 158 | } 159 | 160 | public void SetJointKinematics(Joint joint) 161 | { 162 | CoordinateSystemName = joint.CoordinateSystemName; 163 | AxisName = joint.AxisName; 164 | Type = joint.Type; 165 | Axis.SetElement(joint.Axis); 166 | Origin.SetElement(joint.Origin); 167 | } 168 | 169 | public void SetJointNonKinematics(Joint joint) 170 | { 171 | Limit.SetElement(joint.Limit); 172 | Calibration.SetElement(joint.Calibration); 173 | Dynamics.SetElement(joint.Dynamics); 174 | Safety.SetElement(joint.Safety); 175 | } 176 | } 177 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/Limit.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Windows.Forms; 3 | 4 | namespace SW2URDF.URDF 5 | { 6 | //The limit element of a joint. 7 | [DataContract(IsReference = true, Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 8 | public class Limit : URDFElement 9 | { 10 | [DataMember] 11 | private readonly URDFAttribute LowerAttribute; 12 | 13 | [DataMember] 14 | private readonly URDFAttribute UpperAttribute; 15 | 16 | [DataMember] 17 | private readonly URDFAttribute EffortAttribute; 18 | 19 | [DataMember] 20 | private readonly URDFAttribute VelocityAttribute; 21 | 22 | public double Lower 23 | { 24 | get => (double)LowerAttribute.Value; 25 | set => LowerAttribute.Value = value; 26 | } 27 | 28 | public double Upper 29 | { 30 | get => (double)UpperAttribute.Value; 31 | set => UpperAttribute.Value = value; 32 | } 33 | 34 | public double Effort 35 | { 36 | get => (double)EffortAttribute.Value; 37 | set => EffortAttribute.Value = value; 38 | } 39 | 40 | public double Velocity 41 | { 42 | get => (double)VelocityAttribute.Value; 43 | set => VelocityAttribute.Value = value; 44 | } 45 | 46 | public Limit() : base("limit", false) 47 | { 48 | EffortAttribute = new URDFAttribute("effort", true, null); 49 | VelocityAttribute = new URDFAttribute("velocity", true, null); 50 | LowerAttribute = new URDFAttribute("lower", false, null); 51 | UpperAttribute = new URDFAttribute("upper", false, null); 52 | 53 | Attributes.Add(LowerAttribute); 54 | Attributes.Add(UpperAttribute); 55 | Attributes.Add(EffortAttribute); 56 | Attributes.Add(VelocityAttribute); 57 | } 58 | 59 | public void FillBoxes(TextBox boxLower, TextBox boxUpper, 60 | TextBox boxEffort, TextBox boxVelocity, string format) 61 | { 62 | boxLower.Text = LowerAttribute.GetTextFromDoubleValue(format); 63 | boxUpper.Text = UpperAttribute.GetTextFromDoubleValue(format); 64 | boxEffort.Text = EffortAttribute.GetTextFromDoubleValue(format); 65 | boxVelocity.Text = VelocityAttribute.GetTextFromDoubleValue(format); 66 | } 67 | 68 | public void SetValues(TextBox boxLower, TextBox boxUpper, 69 | TextBox boxEffort, TextBox boxVelocity) 70 | { 71 | if (string.IsNullOrWhiteSpace(boxLower.Text) && 72 | string.IsNullOrWhiteSpace(boxUpper.Text) && 73 | string.IsNullOrWhiteSpace(boxEffort.Text) && 74 | string.IsNullOrWhiteSpace(boxVelocity.Text) && 75 | !IsRequired()) 76 | { 77 | // If all text boxes are empty and this element isn't required, then leave blank 78 | return; 79 | } 80 | LowerAttribute.SetDoubleValueFromString(boxLower.Text); 81 | UpperAttribute.SetDoubleValueFromString(boxUpper.Text); 82 | EffortAttribute.SetDoubleValueFromString(boxEffort.Text); 83 | VelocityAttribute.SetDoubleValueFromString(boxVelocity.Text); 84 | } 85 | 86 | public override void SetRequired(bool required) 87 | { 88 | base.SetRequired(required); 89 | UpperAttribute.SetRequired(required); 90 | LowerAttribute.SetRequired(required); 91 | } 92 | 93 | public override bool AreRequiredFieldsSatisfied() 94 | { 95 | // If a limit is required, then these fields should be as well. 96 | UpperAttribute.SetRequired(IsRequired()); 97 | LowerAttribute.SetRequired(IsRequired()); 98 | return base.AreRequiredFieldsSatisfied(); 99 | } 100 | } 101 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/LinkNode.cs: -------------------------------------------------------------------------------- 1 | using log4net; 2 | using SW2URDF.Utilities; 3 | using System.Windows.Forms; 4 | 5 | namespace SW2URDF.URDF 6 | { 7 | //A LinkNode is derived from a TreeView TreeNode. I've added many new fields to it so 8 | // that information can be passed around from the TreeView itself. 9 | public class LinkNode : TreeNode 10 | { 11 | private static readonly ILog logger = Logger.GetLogger(); 12 | 13 | public Link Link 14 | { get; set; } 15 | 16 | public bool IsBaseNode 17 | { get; set; } 18 | 19 | public bool IsIncomplete 20 | { get; set; } 21 | 22 | public bool NeedsSaving 23 | { get; set; } 24 | 25 | public string WhyIncomplete 26 | { get; set; } 27 | 28 | public LinkNode() 29 | { 30 | Link = new Link(); 31 | } 32 | 33 | public LinkNode(Link link) 34 | { 35 | logger.Info("Building node " + link.Name); 36 | 37 | IsBaseNode = link.Parent == null; 38 | IsIncomplete = true; 39 | Link = link; 40 | 41 | Name = Link.Name; 42 | Text = Link.Name; 43 | 44 | foreach (Link child in link.Children) 45 | { 46 | Nodes.Add(new LinkNode(child)); 47 | } 48 | } 49 | 50 | public Link UpdateLinkTree(Link parent) 51 | { 52 | Link.Children.Clear(); 53 | Link.Parent = parent; 54 | foreach (LinkNode child in Nodes) 55 | { 56 | Link.Children.Add(child.UpdateLinkTree(Link)); 57 | } 58 | return Link; 59 | } 60 | 61 | public override object Clone() 62 | { 63 | LinkNode cloned = (LinkNode)base.Clone(); 64 | cloned.Link = Link.Clone(); 65 | return cloned; 66 | } 67 | 68 | public Link RebuildLink() 69 | { 70 | Link.Children.Clear(); 71 | foreach (LinkNode child in Nodes) 72 | { 73 | Link.Children.Add(child.RebuildLink()); 74 | } 75 | return Link; 76 | } 77 | } 78 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/Mass.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Windows.Forms; 3 | 4 | namespace SW2URDF.URDF 5 | { 6 | //mass element, belongs to the inertial element 7 | [DataContract(IsReference = true, Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 8 | public class Mass : URDFElement 9 | { 10 | [DataMember] 11 | private readonly URDFAttribute ValueAttribute; 12 | 13 | public double Value 14 | { 15 | get => (double)ValueAttribute.Value; 16 | set => ValueAttribute.Value = value; 17 | } 18 | 19 | public Mass() : base("mass", false) 20 | { 21 | ValueAttribute = new URDFAttribute("value", true, 0.0); 22 | 23 | Attributes.Add(ValueAttribute); 24 | } 25 | 26 | public void FillBoxes(TextBox box, string format) 27 | { 28 | box.Text = ValueAttribute.GetTextFromDoubleValue(format); 29 | } 30 | 31 | public void Update(TextBox box) 32 | { 33 | ValueAttribute.SetDoubleValueFromString(box.Text); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/Material.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Windows.Forms; 3 | 4 | namespace SW2URDF.URDF 5 | { 6 | //The material element of the visual element. 7 | [DataContract(IsReference = true, Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 8 | public class Material : URDFElement 9 | { 10 | [DataMember] 11 | public readonly Color Color; 12 | 13 | [DataMember] 14 | public readonly Texture Texture; 15 | 16 | [DataMember] 17 | public readonly URDFAttribute NameAttribute; 18 | 19 | public string Name 20 | { 21 | get => (string)NameAttribute.Value; 22 | set => NameAttribute.Value = value; 23 | } 24 | 25 | public Material() : base("material", false) 26 | { 27 | Color = new Color(); 28 | Texture = new Texture(); 29 | NameAttribute = new URDFAttribute("name", true, ""); 30 | 31 | Attributes.Add(NameAttribute); 32 | ChildElements.Add(Color); 33 | ChildElements.Add(Texture); 34 | } 35 | 36 | public void FillBoxes(ComboBox box) 37 | { 38 | box.Text = Name; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/Mesh.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace SW2URDF.URDF 4 | { 5 | //The mesh element of the geometry element. This contains only a filename location of the mesh. 6 | [DataContract(IsReference = true, Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 7 | public class Mesh : URDFElement 8 | { 9 | [DataMember] 10 | private readonly URDFAttribute FilenameAttribute; 11 | 12 | public string Filename 13 | { 14 | get => (string)FilenameAttribute.Value; 15 | set => FilenameAttribute.Value = value; 16 | } 17 | 18 | public Mesh() : base("mesh", false) 19 | { 20 | FilenameAttribute = new URDFAttribute("filename", true, null); 21 | 22 | Attributes.Add(FilenameAttribute); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/Mimic.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Windows.Forms; 3 | 4 | namespace SW2URDF.URDF 5 | { 6 | [DataContract(Name = "Mimic", Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 7 | public class Mimic : URDFElement 8 | { 9 | [DataMember] 10 | private readonly URDFAttribute JointNameAttribute; 11 | 12 | public string JointName 13 | { 14 | get => (string)JointNameAttribute.Value; 15 | set 16 | { 17 | if (value.GetType() == typeof(string)) 18 | { 19 | JointNameAttribute.Value = value; 20 | } 21 | } 22 | } 23 | 24 | [DataMember] 25 | private readonly URDFAttribute MultiplierAttribute; 26 | 27 | public double Multiplier 28 | { 29 | get => (double)MultiplierAttribute.Value; 30 | set 31 | { 32 | if (value.GetType() == typeof(double)) 33 | { 34 | MultiplierAttribute.Value = value; 35 | } 36 | } 37 | } 38 | 39 | [DataMember] 40 | private readonly URDFAttribute OffsetAttribute; 41 | 42 | public double Offset 43 | { 44 | get => (double)OffsetAttribute.Value; 45 | set 46 | { 47 | if (value.GetType() == typeof(double)) 48 | { 49 | OffsetAttribute.Value = value; 50 | } 51 | } 52 | } 53 | 54 | public Mimic() : base("mimic", false) 55 | { 56 | JointNameAttribute = new URDFAttribute("joint", true, null); 57 | MultiplierAttribute = new URDFAttribute("multiplier", false, null); 58 | OffsetAttribute = new URDFAttribute("offset", false, null); 59 | 60 | Attributes.Add(JointNameAttribute); 61 | Attributes.Add(MultiplierAttribute); 62 | Attributes.Add(OffsetAttribute); 63 | } 64 | 65 | /// 66 | /// 67 | /// This Joint Position = multiplier * (other joint position) + offset 68 | /// 69 | /// 70 | /// 71 | /// 72 | public void Update(string mimicJointName, string multiplierText, string offsetText) 73 | { 74 | JointName = mimicJointName; 75 | MultiplierAttribute.SetDoubleValueFromString(multiplierText); 76 | OffsetAttribute.SetDoubleValueFromString(offsetText); 77 | } 78 | 79 | internal void FillBoxes(TextBox textBoxMimicMultiplier, TextBox textBoxMimicOffset) 80 | { 81 | textBoxMimicMultiplier.Text = MultiplierAttribute.GetTextFromDoubleValue(); 82 | textBoxMimicOffset.Text = OffsetAttribute.GetTextFromDoubleValue(); 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/Origin.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Collections.Specialized; 3 | using System.Runtime.Serialization; 4 | using System.Windows.Forms; 5 | 6 | namespace SW2URDF.URDF 7 | { 8 | [DataContract(Name = "Origin", Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 9 | public class Origin : URDFElement 10 | { 11 | [DataMember] 12 | private readonly URDFAttribute XYZAttribute; 13 | 14 | [DataMember] 15 | private readonly URDFAttribute RPYAttribute; 16 | 17 | private double[] XYZ 18 | { 19 | get => (double[])XYZAttribute.Value; 20 | set => XYZAttribute.Value = value; 21 | } 22 | 23 | public double[] GetXYZ() 24 | { 25 | return (double[])XYZ.Clone(); 26 | } 27 | 28 | public void SetXYZ(double[] xyz) 29 | { 30 | XYZ = xyz; 31 | } 32 | 33 | public double X 34 | { 35 | get => XYZ[0]; 36 | set => XYZ[0] = value; 37 | } 38 | 39 | public double Y 40 | { 41 | get => XYZ[1]; 42 | set => XYZ[1] = value; 43 | } 44 | 45 | public double Z 46 | { 47 | get => XYZ[2]; 48 | set => XYZ[2] = value; 49 | } 50 | 51 | private double[] RPY 52 | { 53 | get => (double[])RPYAttribute.Value; 54 | set => RPYAttribute.Value = value; 55 | } 56 | 57 | public double[] GetRPY() 58 | { 59 | return (double[])RPY.Clone(); 60 | } 61 | 62 | public void SetRPY(double[] rpy) 63 | { 64 | RPY = rpy; 65 | } 66 | 67 | public double Roll 68 | { 69 | get => RPY[0]; 70 | set => RPY[0] = value; 71 | } 72 | 73 | public double Pitch 74 | { 75 | get => RPY[1]; 76 | set => RPY[1] = value; 77 | } 78 | 79 | public double Yaw 80 | { 81 | get => RPY[2]; 82 | set => RPY[2] = value; 83 | } 84 | 85 | [DataMember] 86 | public bool isCustomized; 87 | 88 | public Origin(bool isRequired) : base("origin", isRequired) 89 | { 90 | isCustomized = false; 91 | 92 | XYZAttribute = new URDFAttribute("xyz", true, new double[] { 0, 0, 0 }); 93 | RPYAttribute = new URDFAttribute("rpy", true, new double[] { 0, 0, 0 }); 94 | 95 | Attributes.Add(XYZAttribute); 96 | Attributes.Add(RPYAttribute); 97 | } 98 | 99 | public void FillBoxes(TextBox boxX, TextBox boxY, TextBox boxZ, TextBox boxRoll, 100 | TextBox boxPitch, TextBox boxYaw, string format) 101 | { 102 | string[] xyzText = XYZAttribute.GetTextArrayFromDoubleArray(format); 103 | if (xyzText != null) 104 | { 105 | boxX.Text = xyzText[0]; 106 | boxY.Text = xyzText[1]; 107 | boxZ.Text = xyzText[2]; 108 | } 109 | 110 | string[] rpyText = RPYAttribute.GetTextArrayFromDoubleArray(format); 111 | if (rpyText != null) 112 | { 113 | boxRoll.Text = rpyText[0]; 114 | boxPitch.Text = rpyText[1]; 115 | boxYaw.Text = rpyText[2]; 116 | } 117 | } 118 | 119 | public void Update(TextBox boxX, TextBox boxY, TextBox boxZ, 120 | TextBox boxRoll, TextBox boxPitch, TextBox boxYaw 121 | ) 122 | { 123 | XYZAttribute.SetDoubleArrayFromStringArray(new string[] { boxX.Text, boxY.Text, boxZ.Text }); 124 | RPYAttribute.SetDoubleArrayFromStringArray(new string[] { boxRoll.Text, boxPitch.Text, boxYaw.Text }); 125 | } 126 | 127 | /// 128 | /// Origin is a unique case in that its attributes are stored as double arrays. 129 | /// 130 | /// 131 | /// 132 | public override void SetElementFromData(List context, StringDictionary dictionary) 133 | { 134 | string typeName = GetType().Name; 135 | List updatedContext = new List(context) { typeName }; 136 | 137 | double[] xyz = new double[3]; 138 | double[] rpy = new double[3]; 139 | 140 | string contextString = string.Join(".", updatedContext) + ".xyz"; 141 | for (int i = 0; i < 3; i++) 142 | { 143 | string lookupString = contextString + "." + "xyz"[i]; 144 | if (!dictionary.ContainsKey(lookupString)) 145 | { 146 | logger.Info("CSV file does not contain column for " + lookupString); 147 | continue; 148 | } 149 | 150 | object value = URDFAttribute.GetValueFromString(dictionary[lookupString]); 151 | if (value != null && value.GetType() == typeof(double)) 152 | { 153 | xyz[i] = (double)value; 154 | } 155 | } 156 | 157 | contextString = string.Join(".", updatedContext) + ".rpy"; 158 | for (int i = 0; i < 3; i++) 159 | { 160 | string lookupString = contextString + "." + "rpy"[i]; 161 | if (!dictionary.ContainsKey(lookupString)) 162 | { 163 | logger.Info("CSV file does not contain column for " + lookupString); 164 | continue; 165 | } 166 | 167 | object value = URDFAttribute.GetValueFromString(dictionary[lookupString]); 168 | if (value != null && value.GetType() == typeof(double)) 169 | { 170 | rpy[i] = (double)value; 171 | } 172 | } 173 | 174 | XYZAttribute.Value = xyz; 175 | RPYAttribute.Value = rpy; 176 | } 177 | } 178 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/PackageXMLWriter.cs: -------------------------------------------------------------------------------- 1 | using log4net; 2 | using SW2URDF.Utilities; 3 | using System.Text; 4 | using System.Xml; 5 | 6 | namespace SW2URDF.URDF 7 | { 8 | //A class that just writes the bare minimum of the manifest file necessary for ROS packages. 9 | public class PackageXMLWriter 10 | { 11 | public XmlWriter writer; 12 | private static readonly ILog logger = Logger.GetLogger(); 13 | 14 | public PackageXMLWriter(string savePath) 15 | { 16 | XmlWriterSettings settings = new XmlWriterSettings(); 17 | settings.Encoding = new UTF8Encoding(false); 18 | settings.OmitXmlDeclaration = true; 19 | settings.Indent = true; 20 | settings.NewLineOnAttributes = false; 21 | logger.Info("Creating package.xml at " + savePath); 22 | writer = XmlWriter.Create(savePath, settings); 23 | } 24 | } 25 | 26 | //The base class for packageXML elements. Again, I guess I like having empty base classes 27 | public class PackageElement 28 | { 29 | } 30 | 31 | //Top level class for the package XML file. 32 | public class PackageXML : PackageElement 33 | { 34 | public Description description; 35 | public Dependencies dependencies; 36 | public Author author; 37 | public License license; 38 | 39 | public PackageXML(string name) 40 | { 41 | description = new Description(name); 42 | 43 | dependencies = new Dependencies( 44 | new string[] { "catkin" }, 45 | new string[] { 46 | "roslaunch", "robot_state_publisher", "rviz", "joint_state_publisher_gui", "gazebo" }); 47 | 48 | author = new Author("TODO"); 49 | 50 | license = new License("BSD"); 51 | } 52 | 53 | public void WriteElement(PackageXMLWriter mWriter) 54 | { 55 | XmlWriter writer = mWriter.writer; 56 | writer.WriteStartDocument(); 57 | writer.WriteStartElement("package"); 58 | writer.WriteAttributeString("format", "2"); 59 | 60 | description.WriteElement(writer); 61 | 62 | author.WriteElement(writer); 63 | license.WriteElement(writer); 64 | dependencies.WriteElement(writer); 65 | 66 | writer.WriteStartElement("export"); 67 | 68 | writer.WriteStartElement("architecture_independent"); 69 | writer.WriteEndElement(); 70 | 71 | writer.WriteEndElement(); 72 | 73 | writer.WriteEndElement(); 74 | writer.WriteEndDocument(); 75 | writer.Close(); 76 | } 77 | } 78 | 79 | //description element of the manifest file 80 | public class Description : PackageElement 81 | { 82 | private readonly string name; 83 | private readonly string brief; 84 | private readonly string longDescription; 85 | 86 | public Description(string name) 87 | { 88 | this.name = name; 89 | brief = "URDF Description package for " + name; 90 | longDescription = "This package contains configuration data, 3D models and launch files\r\n" + 91 | "for " + name + " robot"; 92 | } 93 | 94 | public void WriteElement(XmlWriter writer) 95 | { 96 | writer.WriteStartElement("name"); 97 | writer.WriteString(name); 98 | writer.WriteEndElement(); 99 | 100 | writer.WriteStartElement("version"); 101 | writer.WriteString("1.0.0"); 102 | writer.WriteEndElement(); 103 | 104 | writer.WriteStartElement("description"); 105 | 106 | writer.WriteStartElement("p"); 107 | writer.WriteString(brief); 108 | writer.WriteEndElement(); 109 | 110 | writer.WriteStartElement("p"); 111 | writer.WriteString(longDescription); 112 | writer.WriteEndElement(); 113 | 114 | writer.WriteEndElement(); 115 | } 116 | } 117 | 118 | //The depend element of the manifest file 119 | public class Dependencies : PackageElement 120 | { 121 | private readonly string[] buildTool; 122 | private readonly string[] buildExec; 123 | 124 | public Dependencies(string[] buildTool, string[] buildExec) 125 | { 126 | this.buildTool = buildTool; 127 | this.buildExec = buildExec; 128 | } 129 | 130 | public void WriteElement(XmlWriter writer) 131 | { 132 | foreach (string depend in buildTool) 133 | { 134 | writer.WriteStartElement("buildtool_depend"); 135 | writer.WriteString(depend); 136 | writer.WriteEndElement(); 137 | } 138 | 139 | foreach (string depend in buildExec) 140 | { 141 | writer.WriteStartElement("depend"); 142 | writer.WriteString(depend); 143 | writer.WriteEndElement(); 144 | } 145 | } 146 | } 147 | 148 | //The author element of the manifest file 149 | public class Author : PackageElement 150 | { 151 | private readonly string name; 152 | 153 | public Author(string name) 154 | { 155 | this.name = name; 156 | } 157 | 158 | public void WriteElement(XmlWriter writer) 159 | { 160 | writer.WriteStartElement("author"); 161 | writer.WriteString(name); 162 | writer.WriteEndElement(); 163 | 164 | writer.WriteStartElement("maintainer"); 165 | writer.WriteAttributeString("email", name + "@email.com"); 166 | writer.WriteEndElement(); 167 | } 168 | } 169 | 170 | //The license element of the manifest file 171 | public class License : PackageElement 172 | { 173 | private readonly string lic; 174 | 175 | public License(string lic) 176 | { 177 | this.lic = lic; 178 | } 179 | 180 | public void WriteElement(XmlWriter writer) 181 | { 182 | writer.WriteStartElement("license"); 183 | writer.WriteString(lic); 184 | writer.WriteEndElement(); 185 | } 186 | } 187 | } 188 | -------------------------------------------------------------------------------- /SW2URDF/URDF/ParentLink.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Windows.Forms; 3 | 4 | namespace SW2URDF.URDF 5 | { 6 | //parent_link element of a joint. 7 | [DataContract(IsReference = true, Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 8 | public class ParentLink : URDFElement 9 | { 10 | [DataMember] 11 | private readonly URDFAttribute NameAttribute; 12 | 13 | public string Name 14 | { 15 | get => (string)NameAttribute.Value; 16 | set => NameAttribute.Value = value; 17 | } 18 | 19 | public ParentLink() : base("parent", true) 20 | { 21 | NameAttribute = new URDFAttribute("link", true, ""); 22 | Attributes.Add(NameAttribute); 23 | } 24 | 25 | public void FillBoxes(Label box) 26 | { 27 | box.Text = Name; 28 | } 29 | 30 | public void Update(Label box) 31 | { 32 | Name = box.Text; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/Robot.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Xml; 3 | 4 | namespace SW2URDF.URDF 5 | { 6 | //The base URDF element, a robot 7 | [DataContract(IsReference = true, Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 8 | public class Robot : URDFElement 9 | { 10 | [DataMember] 11 | public Link BaseLink { get; private set; } 12 | 13 | [DataMember] 14 | private readonly URDFAttribute NameAttribute; 15 | 16 | public string Name 17 | { 18 | get => (string)NameAttribute.Value; 19 | set => NameAttribute.Value = value; 20 | } 21 | 22 | public Robot() : base("robot", true) 23 | { 24 | BaseLink = new Link(null); 25 | NameAttribute = new URDFAttribute("name", true, ""); 26 | 27 | ChildElements.Add(BaseLink); 28 | Attributes.Add(NameAttribute); 29 | } 30 | 31 | public override void WriteURDF(XmlWriter writer) 32 | { 33 | writer.WriteStartDocument(); 34 | string buildVersion = Versioning.Version.GetBuildVersion(); 35 | string commitVersion = Versioning.Version.GetCommitVersion(); 36 | 37 | writer.WriteComment(" This URDF was automatically created by SolidWorks to URDF Exporter! " + 38 | "Originally created by Stephen Brawner (brawner@gmail.com) \r\n" + 39 | string.Format(" Commit Version: {0} Build Version: {1}\r\n", commitVersion, buildVersion) + 40 | " For more information, please see http://wiki.ros.org/sw_urdf_exporter "); 41 | 42 | base.WriteURDF(writer); 43 | writer.WriteEndDocument(); 44 | writer.Close(); 45 | } 46 | 47 | public void SetBaseLink(Link link) 48 | { 49 | BaseLink = link; 50 | ChildElements.Clear(); 51 | ChildElements.Add(link); 52 | } 53 | 54 | internal string[] GetJointNames(bool includeFixed) 55 | { 56 | return BaseLink.GetJointNames(includeFixed); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/SafetyController.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Windows.Forms; 3 | 4 | namespace SW2URDF.URDF 5 | { 6 | //The safety_controller element of a joint. 7 | [DataContract(IsReference = true, Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 8 | public class SafetyController : URDFElement 9 | { 10 | [DataMember] 11 | private readonly URDFAttribute SoftLowerAttribute; 12 | 13 | [DataMember] 14 | private readonly URDFAttribute SoftUpperAttribute; 15 | 16 | [DataMember] 17 | private readonly URDFAttribute KPositionAttribute; 18 | 19 | [DataMember] 20 | private readonly URDFAttribute KVelocityAttribute; 21 | 22 | public double SoftLower 23 | { 24 | get => (double)SoftLowerAttribute.Value; 25 | set => SoftLowerAttribute.Value = value; 26 | } 27 | 28 | public double SoftUpper 29 | { 30 | get => (double)SoftUpperAttribute.Value; 31 | set => SoftUpperAttribute.Value = value; 32 | } 33 | 34 | public double KPosition 35 | { 36 | get => (double)KPositionAttribute.Value; 37 | set => KPositionAttribute.Value = value; 38 | } 39 | 40 | public double KVelocity 41 | { 42 | get => (double)KVelocityAttribute.Value; 43 | set => KVelocityAttribute.Value = value; 44 | } 45 | 46 | public SafetyController() : base("safety_controller", false) 47 | { 48 | SoftUpperAttribute = new URDFAttribute("soft_upper_limit", false, null); 49 | SoftLowerAttribute = new URDFAttribute("soft_lower_limit", false, null); 50 | KPositionAttribute = new URDFAttribute("k_position", false, null); 51 | KVelocityAttribute = new URDFAttribute("k_velocity", true, null); 52 | 53 | Attributes.Add(SoftUpperAttribute); 54 | Attributes.Add(SoftLowerAttribute); 55 | Attributes.Add(KPositionAttribute); 56 | Attributes.Add(KVelocityAttribute); 57 | } 58 | 59 | public void FillBoxes(TextBox boxLower, TextBox boxUpper, 60 | TextBox boxPosition, TextBox boxVelocity, string format) 61 | { 62 | boxLower.Text = SoftLowerAttribute.GetTextFromDoubleValue(format); 63 | boxUpper.Text = SoftUpperAttribute.GetTextFromDoubleValue(format); 64 | boxPosition.Text = KPositionAttribute.GetTextFromDoubleValue(format); 65 | boxVelocity.Text = KVelocityAttribute.GetTextFromDoubleValue(format); 66 | } 67 | 68 | public void SetValues(TextBox boxLower, TextBox boxUpper, 69 | TextBox boxPosition, TextBox boxVelocity) 70 | { 71 | SoftLowerAttribute.SetDoubleValueFromString(boxLower.Text); 72 | SoftUpperAttribute.SetDoubleValueFromString(boxUpper.Text); 73 | KPositionAttribute.SetDoubleValueFromString(boxPosition.Text); 74 | KVelocityAttribute.SetDoubleValueFromString(boxVelocity.Text); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /SW2URDF/URDF/Texture.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace SW2URDF.URDF 4 | { 5 | //The texture element of the material element. 6 | [DataContract(IsReference = true, Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 7 | public class Texture : URDFElement 8 | { 9 | [DataMember] 10 | private readonly URDFAttribute FilenameAttribute; 11 | 12 | public string Filename 13 | { 14 | get => (string)FilenameAttribute.Value; 15 | set => FilenameAttribute.Value = value; 16 | } 17 | 18 | [DataMember] 19 | public string wFilename; 20 | 21 | public Texture() : base("texture", false) 22 | { 23 | wFilename = ""; 24 | FilenameAttribute = new URDFAttribute("filename", true, null); 25 | 26 | Attributes.Add(FilenameAttribute); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/URDFWriter.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using System.Xml; 3 | 4 | namespace SW2URDF.URDF 5 | { 6 | //Initiates the XMLWriter and its necessary settings 7 | public class URDFWriter 8 | { 9 | public XmlWriter writer; 10 | 11 | public URDFWriter(string savePath) 12 | { 13 | XmlWriterSettings settings = new XmlWriterSettings 14 | { 15 | Encoding = new UTF8Encoding(false), 16 | Indent = true, 17 | NewLineOnAttributes = true, 18 | }; 19 | writer = XmlWriter.Create(savePath, settings); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /SW2URDF/URDF/Visual.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace SW2URDF.URDF 4 | { 5 | //The visual element of a link 6 | [DataContract(IsReference = true, Namespace = "http://schemas.datacontract.org/2004/07/SW2URDF")] 7 | public class Visual : URDFElement 8 | { 9 | [DataMember] 10 | public readonly Origin Origin; 11 | 12 | [DataMember] 13 | public readonly Geometry Geometry; 14 | 15 | [DataMember] 16 | public readonly Material Material; 17 | 18 | public Visual() : base("visual", false) 19 | { 20 | Origin = new Origin(false); 21 | Geometry = new Geometry(); 22 | Material = new Material(); 23 | 24 | ChildElements.Add(Origin); 25 | ChildElements.Add(Geometry); 26 | ChildElements.Add(Material); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /SW2URDF/URDFExport/CSV/CSVImportExport.cs: -------------------------------------------------------------------------------- 1 | using CsvHelper; 2 | using log4net; 3 | using Microsoft.VisualBasic.FileIO; 4 | using SW2URDF.URDF; 5 | using SW2URDF.Utilities; 6 | using System; 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using System.Collections.Specialized; 10 | using System.IO; 11 | using System.Linq; 12 | using System.Text; 13 | 14 | namespace SW2URDF.URDFExport.CSV 15 | { 16 | /// 17 | /// Class to perform exporting to CSV and eventually importing of data from a CSV file 18 | /// 19 | public static class ImportExport 20 | { 21 | private static readonly ILog logger = Logger.GetLogger(); 22 | 23 | #region Public Methods 24 | 25 | /// 26 | /// Method to write a full URDF robot to a CSV 27 | /// 28 | /// URDF robot tree 29 | /// Fully qualified string name to write to 30 | public static void WriteRobotToCSV(Robot robot, string filename) 31 | { 32 | logger.Info("Writing CSV file " + filename); 33 | using (StreamWriter stream = new StreamWriter(filename)) 34 | { 35 | CsvWriter writer = new CsvWriter(stream); 36 | WriteHeaderToCSV(writer); 37 | WriteLinkToCSV(writer, robot.BaseLink); 38 | } 39 | } 40 | 41 | /// 42 | /// Loads a list of URDF Links from a CSV file 43 | /// 44 | /// 45 | /// 46 | public static List LoadURDFRobotFromCSV(Stream stream) 47 | { 48 | List loadedFields = new List(); 49 | using (TextFieldParser csvParser = new TextFieldParser(stream)) 50 | { 51 | csvParser.SetDelimiters(new string[] { "," }); 52 | 53 | string[] headers = csvParser.ReadFields(); 54 | while (!csvParser.EndOfData) 55 | { 56 | string[] fields = csvParser.ReadFields(); 57 | StringDictionary dictionary = new StringDictionary(); 58 | 59 | int minArrayLength = Math.Min(fields.Length, headers.Length); 60 | if (fields.Length != headers.Length) 61 | { 62 | logger.Warn(string.Format( 63 | "The number of columns in the row do not match the number of columns in the header {0} != {1}", 64 | fields.Length, headers.Length)); 65 | } 66 | for (int i = 0; i < minArrayLength; i++) 67 | { 68 | if (!string.IsNullOrWhiteSpace(fields[i])) 69 | { 70 | dictionary[headers[i]] = fields[i]; 71 | } 72 | } 73 | loadedFields.Add(dictionary); 74 | } 75 | 76 | return loadedFields.Select(fields => BuildLinkFromData(fields)).ToList(); 77 | } 78 | } 79 | 80 | #endregion Public Methods 81 | 82 | #region Private Methods 83 | 84 | /// 85 | /// Iterates through the column names and writes them to a file stream 86 | /// 87 | /// Stream to write to 88 | private static void WriteHeaderToCSV(CsvWriter writer) 89 | { 90 | foreach (DictionaryEntry entry in ContextToColumns.Dictionary) 91 | { 92 | string columnName = (string)entry.Value; 93 | writer.WriteField(columnName); 94 | } 95 | writer.NextRecord(); 96 | } 97 | 98 | /// 99 | /// Appends a line to an open CSV document of a URDF's Link properties 100 | /// 101 | /// Stream representing opened CSV file 102 | /// Dictionary of values 103 | private static void WriteValuesToCSV(CsvWriter writer, OrderedDictionary dictionary) 104 | { 105 | foreach (DictionaryEntry entry in ContextToColumns.Dictionary) 106 | { 107 | string context = (string)entry.Key; 108 | if (dictionary.Contains(context)) 109 | { 110 | object value = dictionary[context]; 111 | writer.WriteField(value); 112 | } 113 | else 114 | { 115 | writer.WriteField(null); 116 | } 117 | } 118 | 119 | writer.NextRecord(); 120 | HashSet keys1 = new HashSet(ContextToColumns.Dictionary.Keys.Cast()); 121 | HashSet keys2 = new HashSet(dictionary.Keys.Cast()); 122 | 123 | StringBuilder missingColumns = new StringBuilder(); 124 | foreach (string missing in keys2.Except(keys1)) 125 | { 126 | missingColumns.Append(missing).Append(","); 127 | } 128 | if (missingColumns.Length > 0) 129 | { 130 | logger.Error("The following columns were not written to the CSV: " + missingColumns.ToString()); 131 | } 132 | } 133 | 134 | /// 135 | /// Converts a URDF Link to a dictionary of values and writes them to a CSV 136 | /// 137 | /// StreamWriter of opened CSV document 138 | /// URDF link to append to the file 139 | private static void WriteLinkToCSV(CsvWriter writer, Link link) 140 | { 141 | OrderedDictionary dictionary = new OrderedDictionary(); 142 | link.AppendToCSVDictionary(new List(), dictionary); 143 | WriteValuesToCSV(writer, dictionary); 144 | 145 | foreach (Link child in link.Children) 146 | { 147 | WriteLinkToCSV(writer, child); 148 | } 149 | } 150 | 151 | private static Link BuildLinkFromData(StringDictionary dictionary) 152 | { 153 | StringDictionary contextDictionary = new StringDictionary(); 154 | foreach (DictionaryEntry entry in ContextToColumns.Dictionary) 155 | { 156 | string context = (string)entry.Key; 157 | string columnName = (string)entry.Value; 158 | 159 | if (dictionary.ContainsKey(columnName)) 160 | { 161 | contextDictionary[context] = dictionary[columnName]; 162 | } 163 | } 164 | 165 | Link link = new Link(); 166 | link.SetElementFromData(new List(), contextDictionary); 167 | return link; 168 | } 169 | 170 | #endregion Private Methods 171 | } 172 | } -------------------------------------------------------------------------------- /SW2URDF/URDFExport/CSV/ContextToColumns.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Specialized; 2 | 3 | namespace SW2URDF.URDFExport.CSV 4 | { 5 | public static class ContextToColumns 6 | { 7 | public const string KeyName = "Link Name"; 8 | public const string KeyParentLink = "Parent"; 9 | 10 | /// 11 | /// Provides both the column order of CSV files that are written, but also a lookup between the 12 | /// URDF name of field and a common sense name 13 | /// 14 | public static OrderedDictionary Dictionary = new OrderedDictionary() 15 | { 16 | { "Link.name", KeyName }, 17 | { "Link.Inertial.Origin.xyz.x", "Center of Mass X" }, 18 | {"Link.Inertial.Origin.xyz.y", "Center of Mass Y" }, 19 | {"Link.Inertial.Origin.xyz.z", "Center of Mass Z" }, 20 | {"Link.Inertial.Origin.rpy.r", "Center of Mass Roll" }, 21 | {"Link.Inertial.Origin.rpy.p", "Center of Mass Pitch" }, 22 | {"Link.Inertial.Origin.rpy.y", "Center of Mass Yaw" }, 23 | {"Link.Inertial.Mass.value", "Mass"}, 24 | {"Link.Inertial.Inertia.ixx", "Moment Ixx"}, 25 | {"Link.Inertial.Inertia.ixy", "Moment Ixy"}, 26 | {"Link.Inertial.Inertia.ixz", "Moment Ixz"}, 27 | {"Link.Inertial.Inertia.iyy", "Moment Iyy"}, 28 | {"Link.Inertial.Inertia.iyz", "Moment Iyz"}, 29 | {"Link.Inertial.Inertia.izz", "Moment Izz"}, 30 | {"Link.Visual.Origin.xyz.x", "Visual X"}, 31 | {"Link.Visual.Origin.xyz.y", "Visual Y" }, 32 | {"Link.Visual.Origin.xyz.z", "Visual Z"}, 33 | {"Link.Visual.Origin.rpy.r", "Visual Roll"}, 34 | {"Link.Visual.Origin.rpy.p", "Visual Pitch"}, 35 | {"Link.Visual.Origin.rpy.y", "Visual Yaw"}, 36 | {"Link.Visual.Geometry.Mesh.filename", "Mesh Filename"}, 37 | {"Link.Visual.Material.Color.rgba.r", "Color Red"}, 38 | {"Link.Visual.Material.Color.rgba.g", "Color Green"}, 39 | {"Link.Visual.Material.Color.rgba.b", "Color Blue"}, 40 | {"Link.Visual.Material.Color.rgba.a", "Color Alpha"}, 41 | {"Link.Collision.Origin.xyz.x", "Collision X"}, 42 | {"Link.Collision.Origin.xyz.y", "Collision Y"}, 43 | {"Link.Collision.Origin.xyz.z", "Collision Z"}, 44 | {"Link.Collision.Origin.rpy.r", "Collision Roll"}, 45 | {"Link.Collision.Origin.rpy.p", "Collision Pitch"}, 46 | {"Link.Collision.Origin.rpy.y", "Collision Yaw"}, 47 | {"Link.Collision.Geometry.Mesh.filename","Collision Mesh Filename"}, 48 | {"Link.Visual.Material.name","Material Name"}, 49 | {"Link.SWComponents","SW Components"}, 50 | { "Link.CoordSysName","Coordinate System"}, 51 | { "Link.AxisName","Axis Name"}, 52 | { "Link.Joint.name","Joint Name"}, 53 | { "Link.Joint.type","Joint Type"}, 54 | { "Link.Joint.Origin.xyz.x","Joint Origin X"}, 55 | { "Link.Joint.Origin.xyz.y","Joint Origin Y"}, 56 | { "Link.Joint.Origin.xyz.z","Joint Origin Z"}, 57 | { "Link.Joint.Origin.rpy.r","Joint Origin Roll"}, 58 | { "Link.Joint.Origin.rpy.p","Joint Origin Pitch"}, 59 | { "Link.Joint.Origin.rpy.y","Joint Origin Yaw"}, 60 | { "Link.Joint.ParentLink.link",KeyParentLink}, 61 | { "Link.Joint.Axis.xyz.x", "Joint Axis X"}, 62 | { "Link.Joint.Axis.xyz.y", "Joint Axis Y"}, 63 | { "Link.Joint.Axis.xyz.z", "Joint Axis Z"}, 64 | { "Link.Joint.Limit.effort", "Limit Effort"}, 65 | { "Link.Joint.Limit.velocity", "Limit Velocity"}, 66 | { "Link.Joint.Limit.lower", "Limit Lower"}, 67 | { "Link.Joint.Limit.upper", "Limit Upper"}, 68 | { "Link.Joint.Calibration.rising", "Calibration rising"}, 69 | { "Link.Joint.Calibration.falling", "Calibration falling" }, 70 | { "Link.Joint.Dynamics.damping", "Dynamics Damping" }, 71 | { "Link.Joint.Dynamics.friction", "Dynamics Friction" }, 72 | { "Link.Joint.SafetyController.soft_upper_limit" ,"Safety Soft Upper"}, 73 | { "Link.Joint.SafetyController.soft_lower_limit", "Safety Soft Lower" }, 74 | { "Link.Joint.SafetyController.k_position","Safety K Position"}, 75 | { "Link.Joint.SafetyController.k_velocity","Safety K Velocity"}, 76 | }; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /SW2URDF/URDFExport/URDFMerge/TreeMerger.cs: -------------------------------------------------------------------------------- 1 | using SolidWorks.Interop.sldworks; 2 | using SW2URDF.URDF; 3 | using System.Collections.Generic; 4 | using System.Windows.Controls; 5 | 6 | namespace SW2URDF.URDFExport.URDFMerge 7 | { 8 | public class TreeMerger 9 | { 10 | public bool UseCSVInertial; 11 | public bool UseCSVVisualCollision; 12 | public bool UseCSVJointKinematics; 13 | public bool UseCSVJointOther; 14 | 15 | /// 16 | /// Helper class to Merge two URDFTreeViews 17 | /// 18 | /// Use loaded values for MoI and CoM properties of a link 19 | /// Use loaded values for meshes and material properties 20 | /// Use loaded values for joint coordinate system, joint 21 | /// axis and joint type 22 | /// Use loaded values for Joint Limits, Calibration, Dynamics, 23 | /// and Safety Controller 24 | public TreeMerger(bool useCSVInertial, bool useCSVVisualCollision, 25 | bool useCSVJointKinematics, bool useCSVJointOther) 26 | { 27 | UseCSVInertial = useCSVInertial; 28 | UseCSVVisualCollision = useCSVVisualCollision; 29 | UseCSVJointKinematics = useCSVJointKinematics; 30 | UseCSVJointOther = useCSVJointOther; 31 | } 32 | 33 | public Link Merge(TreeView cadTree, URDFTreeCorrespondance correspondance) 34 | { 35 | if (cadTree.Items.Count != 1) 36 | { 37 | return null; 38 | } 39 | 40 | Link mergedRoot = MergeItem((TreeViewItem)cadTree.Items[0], correspondance); 41 | return mergedRoot; 42 | } 43 | 44 | private List MergeItems(ItemCollection cadCollection, URDFTreeCorrespondance correspondance) 45 | { 46 | List merged = new List(); 47 | 48 | foreach (TreeViewItem item in cadCollection) 49 | { 50 | Link mergedItem = MergeItem(item, correspondance); 51 | merged.Add(mergedItem); 52 | } 53 | 54 | return merged; 55 | } 56 | 57 | private Link MergeItem(TreeViewItem cadItem, URDFTreeCorrespondance correspondance) 58 | { 59 | Link cadLink = (Link)cadItem.Tag; 60 | Link csvLink = correspondance.GetCorrespondingLink(cadItem); 61 | 62 | Link mergedLink = MergeLink(cadLink, csvLink); 63 | 64 | List children = MergeItems(cadItem.Items, correspondance); 65 | mergedLink.Children.Clear(); 66 | mergedLink.Children.AddRange(children); 67 | return mergedLink; 68 | } 69 | 70 | private Link MergeLink(Link cadLink, Link csvLink) 71 | { 72 | if (csvLink == null) 73 | { 74 | return cadLink; 75 | } 76 | 77 | Link mergedLink = cadLink.Clone(); 78 | // SolidWorks components won't be loaded from the file. Use the components in the model 79 | mergedLink.SWMainComponent = cadLink.SWMainComponent; 80 | mergedLink.SWComponents = new List(cadLink.SWComponents); 81 | 82 | if (UseCSVInertial) 83 | { 84 | mergedLink.Inertial.SetElement(csvLink.Inertial); 85 | } 86 | 87 | if (UseCSVVisualCollision) 88 | { 89 | mergedLink.Visual.SetElement(csvLink.Visual); 90 | mergedLink.Collision.SetElement(csvLink.Collision); 91 | } 92 | 93 | if (UseCSVJointKinematics) 94 | { 95 | mergedLink.Joint.Origin.SetElement(csvLink.Joint.Origin); 96 | mergedLink.Joint.CoordinateSystemName = csvLink.Joint.CoordinateSystemName; 97 | 98 | mergedLink.Joint.Axis.SetElement(csvLink.Joint.Axis); 99 | mergedLink.Joint.AxisName = csvLink.Joint.AxisName; 100 | 101 | mergedLink.Joint.Type = csvLink.Joint.Type; 102 | } 103 | 104 | if (UseCSVJointOther) 105 | { 106 | mergedLink.Joint.Limit.SetElement(csvLink.Joint.Limit); 107 | mergedLink.Joint.Calibration.SetElement(csvLink.Joint.Calibration); 108 | mergedLink.Joint.Dynamics.SetElement(csvLink.Joint.Dynamics); 109 | mergedLink.Joint.Safety.SetElement(csvLink.Joint.Safety); 110 | } 111 | 112 | return mergedLink; 113 | } 114 | } 115 | } -------------------------------------------------------------------------------- /SW2URDF/URDFExport/URDFMerge/URDFTreeCorrespondance.cs: -------------------------------------------------------------------------------- 1 | using SW2URDF.UI; 2 | using SW2URDF.URDF; 3 | using System.Collections.Generic; 4 | using System.Windows.Controls; 5 | 6 | namespace SW2URDF.URDFExport.URDFMerge 7 | { 8 | public class URDFTreeCorrespondance 9 | { 10 | private readonly Dictionary ItemToLink; 11 | 12 | public URDFTreeCorrespondance() 13 | { 14 | ItemToLink = new Dictionary(); 15 | } 16 | 17 | public void BuildCorrespondance(URDFTreeView existingTree, List loadedLinks, out List matchedLinks, out List unmatchedLinks) 18 | { 19 | List existingItemsList = existingTree.Flatten(); 20 | 21 | ItemToLink.Clear(); 22 | 23 | Dictionary existingNameToItemsLookup = new Dictionary(); 24 | foreach (TreeViewItem item in existingItemsList) 25 | { 26 | existingNameToItemsLookup[item.Name] = item; 27 | } 28 | 29 | Dictionary loadedNameToLinkLookup = new Dictionary(); 30 | foreach (Link link in loadedLinks) 31 | { 32 | loadedNameToLinkLookup[link.Name] = link; 33 | } 34 | 35 | matchedLinks = new List(); 36 | unmatchedLinks = new List(); 37 | foreach (KeyValuePair entry in loadedNameToLinkLookup) 38 | { 39 | Link loadedLink = entry.Value; 40 | if (existingNameToItemsLookup.TryGetValue(entry.Key, out TreeViewItem item)) 41 | { 42 | matchedLinks.Add(loadedLink); 43 | ItemToLink[item] = loadedLink; 44 | } 45 | else 46 | { 47 | unmatchedLinks.Add(loadedLink); 48 | } 49 | } 50 | } 51 | 52 | public Link GetCorrespondingLink(TreeViewItem item) 53 | { 54 | ItemToLink.TryGetValue(item, out Link link); 55 | return link; 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /SW2URDF/URDFExport/URDFPackage.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Stephen Brawner 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | using SW2URDF.UI; 24 | using System; 25 | using System.IO; 26 | 27 | namespace SW2URDF.URDFExport 28 | { 29 | public class URDFPackage 30 | { 31 | public static IMessageBox MessageBox = new MessageBoxHelper(); 32 | public string PackageName { get; } 33 | 34 | public string PackageDirectory { get; } 35 | public string MeshesDirectory { get; } 36 | public string TexturesDirectory { get; } 37 | public string RobotsDirectory { get; } 38 | public string ConfigDirectory { get; } 39 | public string LaunchDirectory { get; } 40 | 41 | public string WindowsPackageDirectory { get; } 42 | public string WindowsMeshesDirectory { get; } 43 | public string WindowsTexturesDirectory { get; } 44 | public string WindowsRobotsDirectory { get; } 45 | public string WindowsLaunchDirectory { get; } 46 | public string WindowsConfigDirectory { get; } 47 | public string WindowsCMakeLists { get; } 48 | public string WindowsConfigYAML { get; } 49 | 50 | public URDFPackage(string name, string dir) 51 | { 52 | PackageName = name; 53 | PackageDirectory = @"package://" + name + @"/"; 54 | MeshesDirectory = PackageDirectory + @"meshes/"; 55 | RobotsDirectory = PackageDirectory + @"urdf/"; 56 | TexturesDirectory = PackageDirectory + @"textures/"; 57 | LaunchDirectory = PackageDirectory + @"launch/"; 58 | ConfigDirectory = PackageDirectory + @"config/"; 59 | 60 | char last = dir[dir.Length - 1]; 61 | dir = (last == '\\') ? dir : dir + @"\"; 62 | WindowsPackageDirectory = dir + name + @"\"; 63 | WindowsMeshesDirectory = WindowsPackageDirectory + @"meshes\"; 64 | WindowsRobotsDirectory = WindowsPackageDirectory + @"urdf\"; 65 | WindowsTexturesDirectory = WindowsPackageDirectory + @"textures\"; 66 | WindowsLaunchDirectory = WindowsPackageDirectory + @"launch\"; 67 | WindowsConfigDirectory = WindowsPackageDirectory + @"config\"; 68 | WindowsCMakeLists = WindowsPackageDirectory + @"CMakeLists.txt"; 69 | WindowsConfigYAML = WindowsConfigDirectory + @"joint_names_" + name + ".yaml"; 70 | } 71 | 72 | public void CreateDirectories() 73 | { 74 | MessageBox.Show("Creating URDF Package \"" + 75 | PackageName + "\" at:\n" + WindowsPackageDirectory); 76 | if (!Directory.Exists(WindowsPackageDirectory)) 77 | { 78 | Directory.CreateDirectory(WindowsPackageDirectory); 79 | } 80 | if (!Directory.Exists(WindowsMeshesDirectory)) 81 | { 82 | Directory.CreateDirectory(WindowsMeshesDirectory); 83 | } 84 | if (!Directory.Exists(WindowsRobotsDirectory)) 85 | { 86 | Directory.CreateDirectory(WindowsRobotsDirectory); 87 | } 88 | if (!Directory.Exists(WindowsTexturesDirectory)) 89 | { 90 | Directory.CreateDirectory(WindowsTexturesDirectory); 91 | } 92 | if (!Directory.Exists(WindowsLaunchDirectory)) 93 | { 94 | Directory.CreateDirectory(WindowsLaunchDirectory); 95 | } 96 | if (!Directory.Exists(WindowsConfigDirectory)) 97 | { 98 | Directory.CreateDirectory(WindowsConfigDirectory); 99 | } 100 | } 101 | 102 | public void CreateCMakeLists() 103 | { 104 | using (StreamWriter file = new StreamWriter(WindowsCMakeLists)) 105 | { 106 | file.WriteLine("cmake_minimum_required(VERSION 2.8.3)\r\n"); 107 | file.WriteLine("project(" + PackageName + ")\r\n"); 108 | file.WriteLine("find_package(catkin REQUIRED)\r\n"); 109 | file.WriteLine("catkin_package()\r\n"); 110 | file.WriteLine("find_package(roslaunch)\r\n"); 111 | file.WriteLine("foreach(dir config launch meshes urdf)"); 112 | file.WriteLine("\tinstall(DIRECTORY ${dir}/"); 113 | file.WriteLine("\t\tDESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${dir})"); 114 | file.WriteLine("endforeach(dir)"); 115 | } 116 | } 117 | 118 | public void CreateConfigYAML(String[] jointNames) 119 | { 120 | using (StreamWriter file = new StreamWriter(WindowsConfigYAML)) 121 | { 122 | file.Write("controller_joint_names: " + "["); 123 | 124 | foreach (String name in jointNames) 125 | { 126 | file.Write("'" + name + "', "); 127 | } 128 | 129 | file.WriteLine("]"); 130 | } 131 | } 132 | } 133 | } -------------------------------------------------------------------------------- /SW2URDF/Utilities/Logger.cs: -------------------------------------------------------------------------------- 1 | using log4net; 2 | using log4net.Appender; 3 | using log4net.Core; 4 | using log4net.Layout; 5 | using log4net.Layout.Pattern; 6 | using log4net.Repository.Hierarchy; 7 | 8 | using System; 9 | using System.IO; 10 | using System.Linq; 11 | using System.Reflection; 12 | 13 | namespace SW2URDF.Utilities 14 | { 15 | public class FileNamePatternConverter : PatternLayoutConverter 16 | { 17 | protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) 18 | { 19 | writer.Write(Path.GetFileName(loggingEvent.LocationInformation.FileName)); 20 | } 21 | } 22 | 23 | public static class Logger 24 | { 25 | private static bool Initialized = false; 26 | 27 | public static void Setup() 28 | { 29 | if (Initialized) 30 | { 31 | return; 32 | } 33 | 34 | Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository(); 35 | 36 | // This ConversionPattern is slow because any location-based parameter in log4net is 37 | // slow. If it becomes an issue this might have to be wrapped into a compile time macro 38 | PatternLayout patternLayout = new PatternLayout() 39 | { 40 | ConversionPattern = "%date %-5level %filename: %line - %message%newline" 41 | }; 42 | 43 | patternLayout.AddConverter("filename", typeof(FileNamePatternConverter)); 44 | patternLayout.ActivateOptions(); 45 | 46 | string homeDir = Environment.ExpandEnvironmentVariables("%HOMEDRIVE%%HOMEPATH%"); 47 | RollingFileAppender roller = new RollingFileAppender 48 | { 49 | AppendToFile = false, 50 | File = Path.Combine(homeDir, "sw2urdf_logs", "sw2urdf.log"), 51 | Layout = patternLayout, 52 | MaxSizeRollBackups = 5, 53 | MaximumFileSize = "10MB", 54 | RollingStyle = RollingFileAppender.RollingMode.Size, 55 | StaticLogFileName = true 56 | }; 57 | 58 | roller.ActivateOptions(); 59 | hierarchy.Root.AddAppender(roller); 60 | 61 | MemoryAppender memory = new MemoryAppender(); 62 | memory.ActivateOptions(); 63 | hierarchy.Root.AddAppender(memory); 64 | 65 | hierarchy.Root.Level = Level.Info; 66 | hierarchy.Configured = true; 67 | Initialized = true; 68 | ILog logger = LogManager.GetLogger( 69 | MethodBase.GetCurrentMethod().DeclaringType); 70 | logger.Info("\n" + String.Concat(Enumerable.Repeat("-", 80))); 71 | logger.Info("Logging commencing for SW2URDF exporter"); 72 | 73 | logger.Info("Commit version " + Versioning.Version.GetCommitVersion()); 74 | logger.Info("Build version " + Versioning.Version.GetBuildVersion()); 75 | } 76 | 77 | public static ILog GetLogger() 78 | { 79 | Setup(); 80 | return LogManager.GetLogger( 81 | MethodBase.GetCurrentMethod().DeclaringType); 82 | } 83 | 84 | public static string GetFileName() 85 | { 86 | RollingFileAppender rootAppender = 87 | LogManager.GetRepository().GetAppenders().OfType() 88 | .FirstOrDefault(); 89 | if (rootAppender != null) 90 | { 91 | return rootAppender.File; 92 | } 93 | else 94 | { 95 | return null; 96 | } 97 | } 98 | } 99 | } -------------------------------------------------------------------------------- /SW2URDF/Versioning/Version.cs: -------------------------------------------------------------------------------- 1 | using SW2URDF.Utilities; 2 | using System.Diagnostics; 3 | 4 | namespace SW2URDF.Versioning 5 | { 6 | internal class Version 7 | { 8 | public static string GetCommitVersion() 9 | { 10 | // Getting commit version which is attached to the latest git commit 11 | return FileVersionInfo.GetVersionInfo(typeof(Logger).Assembly.Location).ProductVersion; 12 | } 13 | 14 | public static string GetBuildVersion() 15 | { 16 | // Getting AssemblyVersion which is auto incremented for each build. See the AssemblyInfo.cs 17 | return typeof(Logger).Assembly.GetName().Version.ToString(); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /SW2URDF/images/ros_logo_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/SW2URDF/images/ros_logo_128x128.png -------------------------------------------------------------------------------- /SW2URDF/images/ros_logo_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/SW2URDF/images/ros_logo_16x16.png -------------------------------------------------------------------------------- /SW2URDF/images/ros_logo_20x20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/SW2URDF/images/ros_logo_20x20.png -------------------------------------------------------------------------------- /SW2URDF/images/ros_logo_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/SW2URDF/images/ros_logo_32x32.png -------------------------------------------------------------------------------- /SW2URDF/images/ros_logo_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/SW2URDF/images/ros_logo_40x40.png -------------------------------------------------------------------------------- /SW2URDF/images/ros_logo_64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/SW2URDF/images/ros_logo_64x64.png -------------------------------------------------------------------------------- /SW2URDF/images/ros_logo_96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/SW2URDF/images/ros_logo_96x96.png -------------------------------------------------------------------------------- /SW2URDF/lib/log4net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/SW2URDF/lib/log4net.dll -------------------------------------------------------------------------------- /SW2URDF/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /TestRunner/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. 3 | // Project-level suppressions either have no target or are given 4 | // a specific target and scoped to a namespace, type, member, etc. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | 8 | [assembly: SuppressMessage("Globalization", "CA1303:Do not pass literals as localized parameters", Justification = "This is not localized", Scope = "module")] 9 | -------------------------------------------------------------------------------- /TestRunner/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "TestRunner": { 4 | "commandName": "Project" 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /TestRunner/README.md: -------------------------------------------------------------------------------- 1 | # Testing SW2URDF 2 | 3 | This project programmatically runs the tests of the SW2URDF project. 4 | The tests rely on the models provided in the examples directory, so any changes to those files may cause these tests to fail. 5 | Update any tests to reflect corresponding changes in the models. 6 | 7 | ## To Build 8 | 9 | There is a test that checks that the git repo is not dirty, and all files have been committed. 10 | To pass that test, you need to commit all files, then rebuild the solution. 11 | 12 | When you build the solution, you should see two successful builds, SW2URDF and TestRunner. 13 | 14 | ## To Run 15 | 16 | Run the TestRunner executable, it will locate the SW2URDF Dll automatically. 17 | 18 | TestRunner\bin\Debug\net452>TestRunner.exe 19 | 20 | If you only want to run a subset of tests, the first argument of TestRunner.exe is an optional filter parameter. 21 | Any test with a fully qualified NameSpace.ClassName.FunctionName that contains the provided string will be run. 22 | For example, to run just the versioning tests. 23 | 24 | TestRunner\bin\Debug\net452>TestRunner.exe TestVersioning 25 | -------------------------------------------------------------------------------- /TestRunner/TestRunner.cs: -------------------------------------------------------------------------------- 1 | using SolidWorks.Interop.sldworks; 2 | using System; 3 | using System.IO; 4 | using System.Threading; 5 | using Xunit.Abstractions; 6 | using Xunit.Runners; 7 | 8 | namespace TestRunner 9 | { 10 | static public class Program 11 | { 12 | // We use consoleLock because messages can arrive in parallel, so we want to make sure we get 13 | // consistent console output. 14 | static readonly object consoleLock = new object(); 15 | 16 | // Use an event to know when we're done 17 | static readonly ManualResetEvent finished = new ManualResetEvent(false); 18 | 19 | // Start out assuming success; we'll set this to 1 if we get a failed test 20 | static int result = 0; 21 | 22 | static string TestNameFilter = ""; 23 | 24 | public static int Main(string[] args) 25 | { 26 | string solutionDir = 27 | Path.GetDirectoryName( // sw2urdf 28 | Path.GetDirectoryName( // TestRunner 29 | Path.GetDirectoryName( // bin 30 | Path.GetDirectoryName( // x64 31 | Path.GetDirectoryName( // net452 32 | AppDomain.CurrentDomain.BaseDirectory // Debug 33 | ))))); 34 | 35 | string testAssembly = Path.Combine(solutionDir, "SW2URDF\\bin\\x64\\Debug\\SW2URDF.dll"); 36 | string typeName = null; 37 | 38 | using (var runner = AssemblyRunner.WithAppDomain(testAssembly)) 39 | { 40 | if (null != args && args.Length > 0) 41 | { 42 | TestNameFilter = args[0]; 43 | runner.TestCaseFilter += FilterByClass; 44 | } 45 | runner.OnDiscoveryComplete = OnDiscoveryComplete; 46 | runner.OnExecutionComplete = OnExecutionComplete; 47 | runner.OnTestFailed = OnTestFailed; 48 | runner.OnTestSkipped = OnTestSkipped; 49 | 50 | Console.WriteLine("Discovering..."); 51 | runner.Start(typeName); 52 | 53 | finished.WaitOne(); 54 | finished.Dispose(); 55 | return result; 56 | } 57 | } 58 | 59 | public static bool FilterByClass(ITestCase testCase) 60 | { 61 | if (null != testCase && testCase.DisplayName.Contains(TestNameFilter)) 62 | { 63 | return true; 64 | } 65 | return false; 66 | } 67 | 68 | static void OnDiscoveryComplete(DiscoveryCompleteInfo info) 69 | { 70 | lock (consoleLock) 71 | Console.WriteLine($"Running {info.TestCasesToRun} of {info.TestCasesDiscovered} tests..."); 72 | } 73 | 74 | static void OnExecutionComplete(ExecutionCompleteInfo info) 75 | { 76 | lock (consoleLock) 77 | Console.WriteLine( 78 | $"Finished: {info.TotalTests} tests in" + 79 | $"{Math.Round(info.ExecutionTime, 3)}s " + 80 | $"({info.TestsFailed} failed, " + 81 | $"{info.TestsSkipped} skipped)"); 82 | 83 | finished.Set(); 84 | } 85 | 86 | static void OnTestFailed(TestFailedInfo info) 87 | { 88 | lock (consoleLock) 89 | { 90 | Console.ForegroundColor = ConsoleColor.Red; 91 | 92 | Console.WriteLine("[FAIL] {0}: {1}", info.TestDisplayName, info.ExceptionMessage); 93 | if (info.ExceptionStackTrace != null) 94 | Console.WriteLine(info.ExceptionStackTrace); 95 | 96 | Console.ResetColor(); 97 | } 98 | 99 | result = 1; 100 | } 101 | 102 | static void OnTestSkipped(TestSkippedInfo info) 103 | { 104 | lock (consoleLock) 105 | { 106 | Console.ForegroundColor = ConsoleColor.Yellow; 107 | Console.WriteLine("[SKIP] {0}: {1}", info.TestDisplayName, info.SkipReason); 108 | Console.ResetColor(); 109 | } 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /TestRunner/TestRunner.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | true 5 | full 6 | net452 7 | 8 | Exe 9 | 10 | 11 | 12 | 13 | 14 | all 15 | runtime; build; native; contentfiles; analyzers; buildtransitive 16 | 17 | 18 | 19 | 20 | 21 | 22 | ..\..\..\..\..\Program Files\SOLIDWORKS Corp\SOLIDWORKS\SolidWorks.Interop.sldworks.dll 23 | 24 | 25 | ..\..\..\..\..\Program Files\SOLIDWORKS Corp\SOLIDWORKS\SolidWorks.Interop.swconst.dll 26 | 27 | 28 | ..\..\..\..\..\Program Files\SOLIDWORKS Corp\SOLIDWORKS\SolidWorks.Interop.swpublished.dll 29 | 30 | 31 | ..\..\..\..\..\Program Files\SOLIDWORKS Corp\SOLIDWORKS\solidworkstools.dll 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /TestRunner/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/3_DOF_ARM/3_DOF_ARM.SLDASM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/3_DOF_ARM/3_DOF_ARM.SLDASM -------------------------------------------------------------------------------- /examples/3_DOF_ARM/3_DOF_ARM_BASE.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/3_DOF_ARM/3_DOF_ARM_BASE.SLDPRT -------------------------------------------------------------------------------- /examples/3_DOF_ARM/3_DOF_ARM_END_EFFECTOR.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/3_DOF_ARM/3_DOF_ARM_END_EFFECTOR.SLDPRT -------------------------------------------------------------------------------- /examples/3_DOF_ARM/3_DOF_ARM_SEGMENT.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/3_DOF_ARM/3_DOF_ARM_SEGMENT.SLDPRT -------------------------------------------------------------------------------- /examples/3_DOF_ARM/3_DOF_ARM_description/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | 3 | project(3_DOF_ARM_description) 4 | 5 | find_package(catkin REQUIRED) 6 | 7 | catkin_package() 8 | 9 | find_package(roslaunch) 10 | 11 | foreach(dir config launch meshes urdf) 12 | install(DIRECTORY ${dir}/ 13 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${dir}) 14 | endforeach(dir) 15 | -------------------------------------------------------------------------------- /examples/3_DOF_ARM/3_DOF_ARM_description/config/joint_names_3_DOF_ARM_description.yaml: -------------------------------------------------------------------------------- 1 | controller_joint_names: ['', 'prox_joint', 'dist_joint', 'effector_joint', ] 2 | -------------------------------------------------------------------------------- /examples/3_DOF_ARM/3_DOF_ARM_description/launch/display.launch: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 11 | 15 | 20 | 21 | -------------------------------------------------------------------------------- /examples/3_DOF_ARM/3_DOF_ARM_description/launch/gazebo.launch: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 15 | 20 | -------------------------------------------------------------------------------- /examples/3_DOF_ARM/3_DOF_ARM_description/meshes/base_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/3_DOF_ARM/3_DOF_ARM_description/meshes/base_link.STL -------------------------------------------------------------------------------- /examples/3_DOF_ARM/3_DOF_ARM_description/meshes/dist_Link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/3_DOF_ARM/3_DOF_ARM_description/meshes/dist_Link.STL -------------------------------------------------------------------------------- /examples/3_DOF_ARM/3_DOF_ARM_description/meshes/effector_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/3_DOF_ARM/3_DOF_ARM_description/meshes/effector_link.STL -------------------------------------------------------------------------------- /examples/3_DOF_ARM/3_DOF_ARM_description/meshes/prox_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/3_DOF_ARM/3_DOF_ARM_description/meshes/prox_link.STL -------------------------------------------------------------------------------- /examples/3_DOF_ARM/3_DOF_ARM_description/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3_DOF_ARM_description 3 | 1.0.0 4 | 5 |

URDF Description package for 3_DOF_ARM_description

6 |

This package contains configuration data, 3D models and launch files 7 | for 3_DOF_ARM_description robot

8 |
9 | TODO 10 | 11 | BSD 12 | catkin 13 | roslaunch 14 | robot_state_publisher 15 | rviz 16 | joint_state_publisher_gui 17 | gazebo 18 | 19 | 20 | 21 |
22 | -------------------------------------------------------------------------------- /examples/3_DOF_ARM/3_DOF_ARM_description/urdf/3_DOF_ARM_description.csv: -------------------------------------------------------------------------------- 1 | Link Name,Center of Mass X,Center of Mass Y,Center of Mass Z,Center of Mass Roll,Center of Mass Pitch,Center of Mass Yaw,Mass,Moment Ixx,Moment Ixy,Moment Ixz,Moment Iyy,Moment Iyz,Moment Izz,Visual X,Visual Y,Visual Z,Visual Roll,Visual Pitch,Visual Yaw,Mesh Filename,Color Red,Color Green,Color Blue,Color Alpha,Collision X,Collision Y,Collision Z,Collision Roll,Collision Pitch,Collision Yaw,Collision Mesh Filename,Material Name,SW Components,Coordinate System,Axis Name,Joint Name,Joint Type,Joint Origin X,Joint Origin Y,Joint Origin Z,Joint Origin Roll,Joint Origin Pitch,Joint Origin Yaw,Parent,Joint Axis X,Joint Axis Y,Joint Axis Z,Limit Effort,Limit Velocity,Limit Lower,Limit Upper,Calibration rising,Calibration falling,Dynamics Damping,Dynamics Friction,Safety Soft Upper,Safety Soft Lower,Safety K Position,Safety K Velocity 2 | base_link,0.00249115384615384,2.34558007901714E-18,0.00305587412587413,0,0,0,0.0510508806208341,3.5234044049786E-05,6.98466777397284E-37,-2.22339710804804E-37,3.5234044049786E-05,-5.44519126841819E-22,6.24882413753095E-05,0,0,0,0,0,0,package://3_DOF_ARM_description/meshes/base_link.STL,0.792156862745098,0.819607843137255,0.933333333333333,1,0,0,0,0,0,0,package://3_DOF_ARM_description/meshes/base_link.STL,,3_DOF_ARM_BASE-1,Origin_global,,,,0,0,0,0,0,0,,0,0,0,,,,,,,,,,,,0 3 | prox_link,6.94771684018737E-10,-0.0881460587278585,2.58403333886631E-10,0,0,0,0.132570921155528,0.000425622211946537,7.66166107697545E-12,1.12207653869985E-10,6.78913907046572E-05,2.10847233866869E-12,0.000427554426874909,0,0,0,0,0,0,package://3_DOF_ARM_description/meshes/prox_link.STL,0.792156862745098,0.819607843137255,0.933333333333333,1,0,0,0,0,0,0,package://3_DOF_ARM_description/meshes/prox_link.STL,,3_DOF_ARM_SEGMENT-1,Origin_prox_joint,Axis_prox_joint,prox_joint,continuous,0.00249115384615384,0,0,-1.5707963267949,0,-1.5707963267949,base_link,0,1,0,,,,,,,,,,,,0 4 | dist_Link,6.94771724770697E-10,-0.101063661551862,-2.58403354269632E-10,0,0,0,0.132570921155528,0.000425622211946537,-7.66166112117889E-12,-1.12207653890081E-10,6.78913907046571E-05,2.10847240386709E-12,0.000427554426874909,0,0,0,0,0,0,package://3_DOF_ARM_description/meshes/dist_Link.STL,0.792156862745098,0.819607843137255,0.933333333333333,1,0,0,0,0,0,0,package://3_DOF_ARM_description/meshes/dist_Link.STL,,3_DOF_ARM_SEGMENT-2,Origin_dist_joint,Axis_dist_joint,dist_joint,continuous,0,-0.18920972027972,0,-1.5707963267949,0,0,prox_link,-1,0,0,,,,,,,,,,,,0 5 | effector_link,7.89909498403104E-17,-1.94289029309402E-16,0.0118918918918916,0,0,0,0.0290597320457048,4.42470815817501E-06,1.74806527887155E-21,-1.05670524275547E-20,4.424708158175E-06,4.84594662178836E-20,5.90275807178375E-06,0,0,0,0,0,0,package://3_DOF_ARM_description/meshes/effector_link.STL,0.792156862745098,0.819607843137255,0.933333333333333,1,0,0,0,0,0,0,package://3_DOF_ARM_description/meshes/effector_link.STL,,3_DOF_ARM_END_EFFECTOR-1,Origin_effector_joint,Axis_effector_joint,effector_joint,continuous,0,-0.18,0,1.5707963267949,0,0,dist_Link,0,0,-1,,,,,,,,,,,,0 6 | -------------------------------------------------------------------------------- /examples/3_DOF_ARM/3_DOF_ARM_description/urdf/3_DOF_ARM_description.urdf: -------------------------------------------------------------------------------- 1 | 2 | 5 | 7 | 9 | 10 | 13 | 15 | 22 | 23 | 24 | 27 | 28 | 30 | 31 | 33 | 35 | 36 | 37 | 38 | 41 | 42 | 44 | 45 | 46 | 47 | 49 | 50 | 53 | 55 | 62 | 63 | 64 | 67 | 68 | 70 | 71 | 73 | 75 | 76 | 77 | 78 | 81 | 82 | 84 | 85 | 86 | 87 | 90 | 93 | 95 | 97 | 99 | 101 | 102 | 104 | 105 | 108 | 110 | 117 | 118 | 119 | 122 | 123 | 125 | 126 | 128 | 130 | 131 | 132 | 133 | 136 | 137 | 139 | 140 | 141 | 142 | 145 | 148 | 150 | 152 | 154 | 156 | 157 | 159 | 160 | 163 | 165 | 172 | 173 | 174 | 177 | 178 | 180 | 181 | 183 | 185 | 186 | 187 | 188 | 191 | 192 | 194 | 195 | 196 | 197 | 200 | 203 | 205 | 207 | 209 | 211 | 212 | -------------------------------------------------------------------------------- /examples/4_WHEELER/4_WHEELER.SLDASM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/4_WHEELER/4_WHEELER.SLDASM -------------------------------------------------------------------------------- /examples/4_WHEELER/4_WHEELER_CHASSIS.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/4_WHEELER/4_WHEELER_CHASSIS.SLDPRT -------------------------------------------------------------------------------- /examples/4_WHEELER/4_WHEELER_WHEEL.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/4_WHEELER/4_WHEELER_WHEEL.SLDPRT -------------------------------------------------------------------------------- /examples/4_WHEELER/4_WHEELER_description/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | 3 | project(4_WHEELER_description) 4 | 5 | find_package(catkin REQUIRED) 6 | 7 | catkin_package() 8 | 9 | find_package(roslaunch) 10 | 11 | foreach(dir config launch meshes urdf) 12 | install(DIRECTORY ${dir}/ 13 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${dir}) 14 | endforeach(dir) 15 | -------------------------------------------------------------------------------- /examples/4_WHEELER/4_WHEELER_description/config/joint_names_4_WHEELER_description.yaml: -------------------------------------------------------------------------------- 1 | controller_joint_names: ['', 'front_right_joint', 'back_right_joint', 'front_left_joint', 'back_left_joint', ] 2 | -------------------------------------------------------------------------------- /examples/4_WHEELER/4_WHEELER_description/launch/display.launch: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 11 | 15 | 20 | 21 | -------------------------------------------------------------------------------- /examples/4_WHEELER/4_WHEELER_description/launch/gazebo.launch: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 15 | 20 | -------------------------------------------------------------------------------- /examples/4_WHEELER/4_WHEELER_description/meshes/back_left_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/4_WHEELER/4_WHEELER_description/meshes/back_left_link.STL -------------------------------------------------------------------------------- /examples/4_WHEELER/4_WHEELER_description/meshes/back_right_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/4_WHEELER/4_WHEELER_description/meshes/back_right_link.STL -------------------------------------------------------------------------------- /examples/4_WHEELER/4_WHEELER_description/meshes/base_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/4_WHEELER/4_WHEELER_description/meshes/base_link.STL -------------------------------------------------------------------------------- /examples/4_WHEELER/4_WHEELER_description/meshes/front_left_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/4_WHEELER/4_WHEELER_description/meshes/front_left_link.STL -------------------------------------------------------------------------------- /examples/4_WHEELER/4_WHEELER_description/meshes/front_right_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/4_WHEELER/4_WHEELER_description/meshes/front_right_link.STL -------------------------------------------------------------------------------- /examples/4_WHEELER/4_WHEELER_description/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 4_WHEELER_description 3 | 1.0.0 4 | 5 |

URDF Description package for 4_WHEELER_description

6 |

This package contains configuration data, 3D models and launch files 7 | for 4_WHEELER_description robot

8 |
9 | TODO 10 | 11 | BSD 12 | catkin 13 | roslaunch 14 | robot_state_publisher 15 | rviz 16 | joint_state_publisher_gui 17 | gazebo 18 | 19 | 20 | 21 |
22 | -------------------------------------------------------------------------------- /examples/4_WHEELER/4_WHEELER_description/urdf/4_WHEELER_description.csv: -------------------------------------------------------------------------------- 1 | Link Name,Center of Mass X,Center of Mass Y,Center of Mass Z,Center of Mass Roll,Center of Mass Pitch,Center of Mass Yaw,Mass,Moment Ixx,Moment Ixy,Moment Ixz,Moment Iyy,Moment Iyz,Moment Izz,Visual X,Visual Y,Visual Z,Visual Roll,Visual Pitch,Visual Yaw,Mesh Filename,Color Red,Color Green,Color Blue,Color Alpha,Collision X,Collision Y,Collision Z,Collision Roll,Collision Pitch,Collision Yaw,Collision Mesh Filename,Material Name,SW Components,Coordinate System,Axis Name,Joint Name,Joint Type,Joint Origin X,Joint Origin Y,Joint Origin Z,Joint Origin Roll,Joint Origin Pitch,Joint Origin Yaw,Parent,Joint Axis X,Joint Axis Y,Joint Axis Z,Limit Effort,Limit Velocity,Limit Lower,Limit Upper,Calibration rising,Calibration falling,Dynamics Damping,Dynamics Friction,Safety Soft Upper,Safety Soft Lower,Safety K Position,Safety K Velocity 2 | base_link,-0.0141165384615385,4.23948754846086E-19,0.00692383725632013,0,0,0,0.563205630345987,0.00117384279611469,9.99854565423472E-20,-1.5465718715316E-20,0.000382342529746245,1.9910139953764E-20,0.00132140486649909,0,0,0,0,0,0,package://4_WHEELER_description/meshes/base_link.STL,0.792156862745098,0.819607843137255,0.933333333333333,1,0,0,0,0,0,0,package://4_WHEELER_description/meshes/base_link.STL,,4_WHEELER_CHASSIS-1,Origin_global,,,,0,0,0,0,0,0,,0,0,0,,,,,,,,,,,,0 3 | front_right_link,0.0150232018561485,0,0,0,0,0,0.084626652106075,3.81697371488008E-05,1.15941736867104E-37,-1.38810202635152E-24,2.54252769409231E-05,1.06543524839393E-40,2.54252769409231E-05,0,0,0,0,0,0,package://4_WHEELER_description/meshes/front_right_link.STL,0.792156862745098,0.819607843137255,0.933333333333333,1,0,0,0,0,0,0,package://4_WHEELER_description/meshes/front_right_link.STL,,4_WHEELER_WHEEL-2,Origin_front_right_joint,Axis_front_right_joint,front_right_joint,continuous,-0.0516165384615385,-0.05,-0.00997411961288419,1.5707963267949,0,3.14159265358979,base_link,1,0,0,,,,,,,,,,,,0 4 | back_right_link,0.0150232018561485,1.73472347597681E-18,6.93889390390723E-18,0,0,0,0.084626652106075,3.81697371488008E-05,-7.40219872782327E-38,7.0944970673424E-24,2.54252769409231E-05,2.64481672201998E-40,2.54252769409231E-05,0,0,0,0,0,0,package://4_WHEELER_description/meshes/back_right_link.STL,0.792156862745098,0.819607843137255,0.933333333333333,1,0,0,0,0,0,0,package://4_WHEELER_description/meshes/back_right_link.STL,,4_WHEELER_WHEEL-1,Origin_back_right_joint,Axis_back_right_joint,back_right_joint,continuous,-0.0516165384615385,0.05,-0.00997411961288421,1.5707963267949,0,3.14159265358979,base_link,1,0,0,,,,,,,,,,,,0 5 | front_left_link,0.0150232018561485,0,6.93889390390723E-18,0,0,0,0.084626652106075,3.81697371488008E-05,-8.25084535794452E-38,8.66046310517947E-24,2.54252769409231E-05,2.95137923266854E-38,2.54252769409231E-05,0,0,0,0,0,0,package://4_WHEELER_description/meshes/front_left_link.STL,0.792156862745098,0.819607843137255,0.933333333333333,1,0,0,0,0,0,0,package://4_WHEELER_description/meshes/front_left_link.STL,,4_WHEELER_WHEEL-3,Origin_front_left_joint,Axis_front_left_joint,front_left_joint,continuous,0.0233834615384615,-0.05,-0.0099741196128842,1.5707963267949,0,0,base_link,-1,0,0,,,,,,,,,,,,0 6 | back_left_link,0.0150232018561485,0,0,0,0,0,0.084626652106075,3.81697371488008E-05,-8.25084535794452E-38,7.84265519175544E-24,2.54252769409231E-05,-8.35361953230723E-38,2.54252769409231E-05,0,0,0,0,0,0,package://4_WHEELER_description/meshes/back_left_link.STL,0.792156862745098,0.819607843137255,0.933333333333333,1,0,0,0,0,0,0,package://4_WHEELER_description/meshes/back_left_link.STL,,4_WHEELER_WHEEL-4,Origin_back_left_joint,Axis_back_left_joint,back_left_joint,continuous,0.0233834615384615,0.05,-0.00997411961288421,1.5707963267949,0,0,base_link,-1,0,0,,,,,,,,,,,,0 7 | -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/Arm.SLDASM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/ORIGINAL_3_DOF_ARM/Arm.SLDASM -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/Arm_base.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/ORIGINAL_3_DOF_ARM/Arm_base.SLDPRT -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/Arm_brace.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/ORIGINAL_3_DOF_ARM/Arm_brace.SLDPRT -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/Arm_link.SLDASM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/ORIGINAL_3_DOF_ARM/Arm_link.SLDASM -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/Arm_link1_tube.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/ORIGINAL_3_DOF_ARM/Arm_link1_tube.SLDPRT -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/Arm_link_tube.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/ORIGINAL_3_DOF_ARM/Arm_link_tube.SLDPRT -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/Basic.SLDASM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/ORIGINAL_3_DOF_ARM/Basic.SLDASM -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/Basic.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/ORIGINAL_3_DOF_ARM/Basic.STL -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/ORIGINAL_3_DOF_ARM.SLDASM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/ORIGINAL_3_DOF_ARM/ORIGINAL_3_DOF_ARM.SLDASM -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/ORIGINAL_3_DOF_ARM_description/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | 3 | project(ORIGINAL_3_DOF_ARM_description) 4 | 5 | find_package(catkin REQUIRED) 6 | 7 | catkin_package() 8 | 9 | find_package(roslaunch) 10 | 11 | foreach(dir config launch meshes urdf) 12 | install(DIRECTORY ${dir}/ 13 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${dir}) 14 | endforeach(dir) 15 | -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/ORIGINAL_3_DOF_ARM_description/config/joint_names_ORIGINAL_3_DOF_ARM_description.yaml: -------------------------------------------------------------------------------- 1 | controller_joint_names: ['', 'joint1', 'joint2', 'joint3', ] 2 | -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/ORIGINAL_3_DOF_ARM_description/launch/display.launch: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 10 | 13 | 17 | 21 | 26 | -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/ORIGINAL_3_DOF_ARM_description/launch/gazebo.launch: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 15 | 20 | -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/ORIGINAL_3_DOF_ARM_description/meshes/base_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/ORIGINAL_3_DOF_ARM/ORIGINAL_3_DOF_ARM_description/meshes/base_link.STL -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/ORIGINAL_3_DOF_ARM_description/meshes/link1.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/ORIGINAL_3_DOF_ARM/ORIGINAL_3_DOF_ARM_description/meshes/link1.STL -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/ORIGINAL_3_DOF_ARM_description/meshes/link2.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/ORIGINAL_3_DOF_ARM/ORIGINAL_3_DOF_ARM_description/meshes/link2.STL -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/ORIGINAL_3_DOF_ARM_description/meshes/link3.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/ORIGINAL_3_DOF_ARM/ORIGINAL_3_DOF_ARM_description/meshes/link3.STL -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/ORIGINAL_3_DOF_ARM_description/package.xml: -------------------------------------------------------------------------------- 1 | 2 | ORIGINAL_3_DOF_ARM_description 3 | 1.0.0 4 | 5 |

URDF Description package for ORIGINAL_3_DOF_ARM_description

6 |

This package contains configuration data, 3D models and launch files 7 | for ORIGINAL_3_DOF_ARM_description robot

8 |
9 | TODO 10 | 11 | BSD 12 | catkin 13 | roslaunch 14 | robot_state_publisher 15 | rviz 16 | joint_state_publisher 17 | gazebo 18 | 19 | 20 | 21 |
-------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/ORIGINAL_3_DOF_ARM_description/urdf/ORIGINAL_3_DOF_ARM_description.csv: -------------------------------------------------------------------------------- 1 | Link Name,Center of Mass X,Center of Mass Y,Center of Mass Z,Center of Mass Roll,Center of Mass Pitch,Center of Mass Yaw,Mass,Moment Ixx,Moment Ixy,Moment Ixz,Moment Iyy,Moment Iyz,Moment Izz,Visual X,Visual Y,Visual Z,Visual Roll,Visual Pitch,Visual Yaw,Mesh Filename,Color Red,Color Green,Color Blue,Color Alpha,Collision X,Collision Y,Collision Z,Collision Roll,Collision Pitch,Collision Yaw,Collision Mesh Filename,Material Name,SW Components,Coordinate System,Axis Name,Joint Name,Joint Type,Joint Origin X,Joint Origin Y,Joint Origin Z,Joint Origin Roll,Joint Origin Pitch,Joint Origin Yaw,Parent,Joint Axis X,Joint Axis Y,Joint Axis Z,Limit Effort,Limit Velocity,Limit Lower,Limit Upper,Calibration rising,Calibration falling,Dynamics Damping,Dynamics Friction,Safety Soft Upper,Safety Soft Lower,Safety K Position,Safety K Velocity 2 | base_link,0.00857185004749454,0.0277890770314089,0.0379884681378223,0,0,0,0.0450462948917676,3.73760183746963E-05,7.37175916246715E-37,-3.67341984631965E-37,3.73760183746963E-05,3.21685897560652E-21,7.33038758972795E-05,0,0,0,0,0,0,package://ORIGINAL_3_DOF_ARM_description/meshes/base_link.STL,0,0,1,0.5,0,0,0,0,0,0,package://ORIGINAL_3_DOF_ARM_description/meshes/base_link.STL,,Arm_base-1,Origin_global,,,,0,0,0,0,0,0,,0,0,0,,,,,,,,,,,,0 3 | link1,0.110757629166325,-8.47845058049579E-12,8.47839853879151E-12,0,0,0,0.0483301725897621,2.34046418523273E-05,-9.12469035853591E-15,-9.1246965685776E-15,6.7625497098099E-05,-1.78995347833815E-11,6.79761299610003E-05,0,0,0,0,0,0,package://ORIGINAL_3_DOF_ARM_description/meshes/link1.STL,0.752941176470588,0.752941176470588,0.752941176470588,1,0,0,0,0,0,0,package://ORIGINAL_3_DOF_ARM_description/meshes/link1.STL,,Arm_link-1,Joint Origin ,Axis_joint1,joint1,continuous,0.0085719,0.027789,0.020415,2.8348,-1.5708,0,base_link,-1,0,0,,,,,,,,,,,,0 4 | link2,0.0943407218386796,5.81092854596774E-07,-9.84910960399876E-07,0,0,0,0.0585758042581199,2.38164941843817E-05,9.72727997584935E-10,7.81793935667511E-10,6.97154129782386E-05,-1.99343905502661E-09,6.97122641242123E-05,0,0,0,0,0,0,package://ORIGINAL_3_DOF_ARM_description/meshes/link2.STL,0.752941176470588,0.752941176470588,0.752941176470588,1,0,0,0,0,0,0,package://ORIGINAL_3_DOF_ARM_description/meshes/link2.STL,,Arm_link-2,Joint Origin ,Primary Axis ,joint2,revolute,0.18177,0,0,-1.5708,0,-1.7091,link1,0,-1,0,0,0,0,0,,,,,,,,0 5 | link3,0.0943408063355609,4.37197531205635E-07,-3.60101098773047E-07,0,0,0,0.0585758669634938,2.38167246601106E-05,-8.54495980074359E-12,-6.80054618075403E-11,6.97192250758933E-05,-3.89114521030646E-09,6.97121157840842E-05,0,0,0,0,0,0,package://ORIGINAL_3_DOF_ARM_description/meshes/link3.STL,0.752941176470588,0.752941176470588,0.752941176470588,1,0,0,0,0,0,0,package://ORIGINAL_3_DOF_ARM_description/meshes/link3.STL,,Arm_link-3,Joint Origin ,Primary Axis ,joint3,revolute,0.18177,0,0,-1.5708,0,-1.8796,link2,0,-1,0,0,0,0,0,,,,,,,,0 6 | -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/ORIGINAL_3_DOF_ARM_description/urdf/ORIGINAL_3_DOF_ARM_description.urdf: -------------------------------------------------------------------------------- 1 | 2 | 5 | 7 | 9 | 10 | 13 | 15 | 22 | 23 | 24 | 27 | 28 | 30 | 31 | 33 | 35 | 36 | 37 | 38 | 41 | 42 | 44 | 45 | 46 | 47 | 49 | 50 | 53 | 55 | 62 | 63 | 64 | 67 | 68 | 70 | 71 | 73 | 75 | 76 | 77 | 78 | 81 | 82 | 84 | 85 | 86 | 87 | 90 | 93 | 95 | 97 | 99 | 101 | 102 | 104 | 105 | 108 | 110 | 117 | 118 | 119 | 122 | 123 | 125 | 126 | 128 | 130 | 131 | 132 | 133 | 136 | 137 | 139 | 140 | 141 | 142 | 145 | 148 | 150 | 152 | 154 | 159 | 161 | 162 | 164 | 165 | 168 | 170 | 177 | 178 | 179 | 182 | 183 | 185 | 186 | 188 | 190 | 191 | 192 | 193 | 196 | 197 | 199 | 200 | 201 | 202 | 205 | 208 | 210 | 212 | 214 | 219 | 221 | 222 | -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/Skin Link.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/ORIGINAL_3_DOF_ARM/Skin Link.SLDPRT -------------------------------------------------------------------------------- /examples/ORIGINAL_3_DOF_ARM/Stupid_basic.SLDASM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/ORIGINAL_3_DOF_ARM/Stupid_basic.SLDASM -------------------------------------------------------------------------------- /examples/TOY_BLOCK/BlockA.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/TOY_BLOCK/BlockA.SLDPRT -------------------------------------------------------------------------------- /examples/TOY_BLOCK/block_description/manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | BlockA 3 | 1.0.0 4 | 5 |

URDF Description package for BlockA

6 |

This package contains configuration data, 3D models and launch files 7 | for BlockA robot

8 |
9 | TODO 10 | 11 | BSD 12 | catkin 13 | roslaunch 14 | robot_state_publisher 15 | rviz 16 | joint_state_publisher 17 | gazebo 18 | 19 | 20 | 21 |
-------------------------------------------------------------------------------- /examples/TOY_BLOCK/block_description/meshes/block_description.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros/solidworks_urdf_exporter/aed57c32b3d32be59953f207da792b7973290529/examples/TOY_BLOCK/block_description/meshes/block_description.STL -------------------------------------------------------------------------------- /examples/TOY_BLOCK/block_description/urdf/BlockA.urdf: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 9 | 11 | 18 | 19 | 20 | 23 | 24 | 26 | 27 | 29 | 31 | 32 | 33 | 34 | 37 | 38 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /scripts/UpdateVersionInfo.ps1: -------------------------------------------------------------------------------- 1 | param ( 2 | [string]$filename 3 | ) 4 | 5 | $CommitVersion = git describe --tags --long --dirty --always 6 | $FileContent = 'using System.Reflection; 7 | 8 | [assembly: AssemblyInformationalVersion("{0}")]' -f $CommitVersion 9 | $FileContent | Out-File $filename 10 | --------------------------------------------------------------------------------