├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── docker ├── Dockerfile.aarch64.base ├── Dockerfile.x86_64.base ├── scripts │ └── workspace-entrypoint.sh └── vpi │ ├── vpi-dev-1.1.11-cuda11-x86_64-linux.deb │ └── vpi-lib-1.1.11-cuda11-x86_64-linux.deb ├── giistr-cla.md ├── isaac_ros_common ├── CMakeLists.txt ├── include │ └── isaac_ros_common │ │ └── vpi_utilities.hpp ├── package.xml └── src │ └── vpi_utilities.cpp ├── isaac_ros_test ├── isaac_ros_test │ ├── __init__.py │ ├── cpu_profiler.py │ ├── examples │ │ ├── isaac_ros_talker_comparison_test.py │ │ └── isaac_ros_talker_test.py │ ├── isaac_ros_base_test.py │ ├── json_conversion.py │ ├── profiler.py │ └── tegrastats_profiler.py ├── package.xml ├── resource │ └── isaac_ros_test ├── setup.cfg ├── setup.py └── test │ ├── test_flake8.py │ └── test_pep257.py └── scripts ├── README.md ├── run_dev.sh └── utils └── print_color.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | # Images 2 | *.gif filter=lfs diff=lfs merge=lfs -text 3 | *.jpg filter=lfs diff=lfs merge=lfs -text 4 | *.png filter=lfs diff=lfs merge=lfs -text 5 | *.psd filter=lfs diff=lfs merge=lfs -text 6 | 7 | # Archives 8 | *.gz filter=lfs diff=lfs merge=lfs -text 9 | *.tar filter=lfs diff=lfs merge=lfs -text 10 | *.zip filter=lfs diff=lfs merge=lfs -text 11 | # Documents 12 | *.pdf filter=lfs diff=lfs merge=lfs -text 13 | # Numpy data 14 | *.npy filter=lfs diff=lfs merge=lfs -text 15 | # Debian package 16 | *.deb filter=lfs diff=lfs merge=lfs -text 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore all pycache files 2 | **/__pycache__/** 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 1. Copyright & License Notices 2 | 3 | 4 | 1.1. NVIDIA CORPORATION 5 | 1.1.1. NVIDIA SOFTWARE LICENSE AGREEMENT 6 | IMPORTANT – READ BEFORE DOWNLOADING, INSTALLING, COPYING OR USING THE LICENSED SOFTWARE 7 | 8 | This Software License Agreement ("SLA”), made and entered into as of the time and date of click through action (“Effective Date”), is a legal agreement between you and NVIDIA Corporation ("NVIDIA") and governs the use of the NVIDIA computer software and the documentation made available for use with such NVIDIA software. By downloading, installing, copying, or otherwise using the NVIDIA software and/or documentation, you agree to be bound by the terms of this SLA. If you do not agree to the terms of this SLA, do not download, install, copy or use the NVIDIA software or documentation. IF YOU ARE ENTERING INTO THIS SLA ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE ENTITY TO THIS SLA, IN WHICH CASE “YOU” WILL MEAN THE ENTITY YOU REPRESENT. IF YOU DON’T HAVE SUCH AUTHORITY, OR IF YOU DON’T ACCEPT ALL THE TERMS AND CONDITIONS OF THIS SLA, THEN NVIDIA DOES NOT AGREE TO LICENSE THE LICENSED SOFTWARE TO YOU, AND YOU MAY NOT DOWNLOAD, INSTALL, COPY OR USE IT. 9 | 10 | 1. LICENSE. 11 | 12 | 1.1 License Grant. Subject to the terms of the AGREEMENT, NVIDIA hereby grants you a non-exclusive, non-transferable license, without the right to sublicense (except as expressly set forth in a Supplement), during the applicable license term unless earlier terminated as provided below, to have Authorized Users install and use the Software, including modifications (if expressly permitted in a Supplement), in accordance with the Documentation. You are only licensed to activate and use Licensed Software for which you a have a valid license, even if during the download or installation you are presented with other product options. No Orders are binding on NVIDIA until accepted by NVIDIA. Your Orders are subject to the AGREEMENT. 13 | 14 | SLA Supplements: Certain Licensed Software licensed under this SLA may be subject to additional terms and conditions that will be presented to you in a Supplement for acceptance prior to the delivery of such Licensed Software under this SLA and the applicable Supplement. Licensed Software will only be delivered to you upon your acceptance of all applicable terms. 15 | 16 | 1.2 Limited Purpose Licenses. If your license is provided for one of the purposes indicated below, then notwithstanding contrary terms in Section 1.1 or in a Supplement, such licenses are for internal use and do not include any right or license to sub-license and distribute the Licensed Software or its output in any way in any public release, however limited, and/or in any manner that provides third parties with use of or access to the Licensed Software or its functionality or output, including (but not limited to) external alpha or beta testing or development phases. Further: 17 | 18 | (i) Evaluation License. You may use evaluation licenses solely for your internal evaluation of the Licensed Software for broader adoption within your Enterprise or in connection with a NVIDIA product purchase decision, and such licenses have an expiration date as indicated by NVIDIA in its sole discretion (or ninety days from the date of download if no other duration is indicated). 19 | 20 | (ii) Educational/Academic License. You may use educational/academic licenses solely for educational purposes and all users must be enrolled or employed by an academic institution. If you do not meet NVIDIA’s academic program requirements for educational institutions, you have no rights under this license. 21 | 22 | (iii) Test/Development License. You may use test/development licenses solely for your internal development, testing and/or debugging of your software applications or for interoperability testing with the Licensed Software, and such licenses have an expiration date as indicated by NVIDIA in its sole discretion (or one year from the date of download if no other duration is indicated). 23 | 24 | 1.3 Pre-Release Licenses. With respect to alpha, beta, preview, and other pre-release Software and Documentation (“Pre-Release Licensed Software”) delivered to you under the AGREEMENT you acknowledge and agree that such Pre-Release Licensed Software (i) may not be fully functional, may contain errors or design flaws, and may have reduced or different security, privacy, accessibility, availability, and reliability standards relative to commercially provided NVIDIA software and documentation, and (ii) use of such Pre-Release Licensed Software may result in unexpected results, loss of data, project delays or other unpredictable damage or loss. THEREFORE, PRE-RELEASE LICENSED SOFTWARE IS NOT INTENDED FOR USE, AND SHOULD NOT BE USED, IN PRODUCTION OR BUSINESS-CRITICAL SYSTEMS. NVIDIA has no obligation to make available a commercial version of any Pre-Release Licensed Software and NVIDIA has the right to abandon development of Pre-Release Licensed Software at any time without liability. 25 | 26 | 1.4 Enterprise and Contractor Usage. You may allow your Enterprise employees and Contractors to access and use the Licensed Software pursuant to the terms of the AGREEMENT solely to perform work on your behalf, provided further that with respect to Contractors: (i) you obtain a written agreement from each Contractor which contains terms and obligations with respect to access to and use of Licensed Software no less protective of NVIDIA than those set forth in the AGREEMENT, and (ii) such Contractor’s access and use expressly excludes any sublicensing or distribution rights for the Licensed Software. You are responsible for the compliance with the terms and conditions of the AGREEMENT by your Enterprise and Contractors. Any act or omission that, if committed by you, would constitute a breach of the AGREEMENT shall be deemed to constitute a breach of the AGREEMENT if committed by your Enterprise or Contractors. 27 | 28 | 1.5 Services. Except as expressly indicated in an Order, NVIDIA is under no obligation to provide support for the Licensed Software or to provide any patches, maintenance, updates or upgrades under the AGREEMENT. Unless patches, maintenance, updates or upgrades are provided with their separate governing terms and conditions, they constitute Licensed Software licensed to you under the AGREEMENT. 29 | 30 | 2. LIMITATIONS. 31 | 32 | 2.1 License Restrictions. Except as expressly authorized in the AGREEMENT, you agree that you will not (nor authorize third parties to): (i) copy and use Software that was licensed to you for use in one or more NVIDIA hardware products in other unlicensed products (provided that copies solely for backup purposes are allowed); (ii) reverse engineer, decompile, disassemble (except to the extent applicable laws specifically require that such activities be permitted) or attempt to derive the source code, underlying ideas, algorithm or structure of Software provided to you in object code form; (iii) sell, transfer, assign, distribute, rent, loan, lease, sublicense or otherwise make available the Licensed Software or its functionality to third parties (a) as an application services provider or service bureau, (b) by operating hosted/virtual system environments, (c) by hosting, time sharing or providing any other type of services, or (d) otherwise by means of the internet; (iv) modify, translate or otherwise create any derivative works of any Licensed Software; (v) remove, alter, cover or obscure any proprietary notice that appears on or with the Licensed Software or any copies thereof; (vi) use the Licensed Software, or allow its use, transfer, transmission or export in violation of any applicable export control laws, rules or regulations; (vii) distribute, permit access to, or sublicense the Licensed Software as a stand-alone product; (viii) bypass, disable, circumvent or remove any form of copy protection, encryption, security or digital rights management or authentication mechanism used by NVIDIA in connection with the Licensed Software, or use the Licensed Software together with any authorization code, serial number, or other copy protection device not supplied by NVIDIA directly or through an authorized reseller; (ix) use the Licensed Software for the purpose of developing competing products or technologies or assisting a third party in such activities; (x) use the Licensed Software with any system or application where the use or failure of such system or application can reasonably be expected to threaten or result in personal injury, death, or catastrophic loss including, without limitation, use in connection with any nuclear, avionics, navigation, military, medical, life support or other life critical application (“Critical Applications”), unless the parties have entered into a Critical Applications agreement; (xi) distribute any modification or derivative work you make to the Licensed Software under or by reference to the same name as used by NVIDIA; or (xii) use the Licensed Software in any manner that would cause the Licensed Software to become subject to an Excluded License. Nothing in the AGREEMENT shall be construed to give you a right to use, or otherwise obtain access to, any source code from which the Software or any portion thereof is compiled or interpreted. You acknowledge that NVIDIA does not design, test, manufacture or certify the Licensed Software for use in the context of a Critical Application and NVIDIA shall not be liable to you or any third party, in whole or in part, for any claims or damages arising from such use. You agree to defend, indemnify and hold harmless NVIDIA and its Affiliates, and their respective employees, contractors, agents, officers and directors, from and against any and all claims, damages, obligations, losses, liabilities, costs or debt, fines, restitutions and expenses (including but not limited to attorney’s fees and costs incident to establishing the right of indemnification) arising out of or related to you and your Enterprise, and their respective employees, contractors, agents, distributors, resellers, end users, officers and directors use of Licensed Software outside of the scope of the AGREEMENT or any other breach of the terms of the AGREEMENT. 33 | 34 | 2.2 Third Party License Obligations. The Licensed Software may come bundled with, or otherwise include or be distributed with, third party software licensed by an NVIDIA supplier and/or open source software provided under an open source license (collectively, “Third Party Software”). Notwithstanding anything to the contrary herein, Third Party Software is licensed to you subject to the terms and conditions of the software license agreement accompanying such Third Party Software whether in the form of a discrete agreement, click-through license, or electronic license terms accepted at the time of installation and any additional terms or agreements provided by the third party licensor (“Third Party License Terms”). Use of the Third Party Software by you shall be governed by such Third Party License Terms, or if no Third Party License Terms apply, then the Third Party Software is provided to you as-is, without support or warranty or indemnity obligations, for use in or with the Licensed Software and not otherwise used separately. Copyright to Third Party Software is held by the copyright holders indicated in the Third Party License Terms. 35 | 36 | Audio/Video Encoders and Decoders. You acknowledge and agree that it is your sole responsibility to obtain any additional third party licenses required to make, have made, use, have used, sell, import, and offer for sale your products or services that include or incorporate any Third Party Software and content relating to audio and/or video encoders and decoders from, including but not limited to, Microsoft, Thomson, Fraunhofer IIS, Sisvel S.p.A., MPEG-LA, and Coding Technologies as NVIDIA does not grant to you under the AGREEMENT any necessary patent or other rights with respect to audio and/or video encoders and decoders. 37 | 38 | 2.3 Limited Rights. Your rights in the Licensed Software are limited to those expressly granted under the AGREEMENT and no other licenses are granted whether by implication, estoppel or otherwise. NVIDIA reserves all rights, title and interest in and to the Licensed Software not expressly granted under the AGREEMENT. 39 | 40 | 3. CONFIDENTIALITY. Neither party will use the other party’s Confidential Information, except as necessary for the performance of the AGREEMENT, nor will either party disclose such Confidential Information to any third party, except to personnel of NVIDIA and its Affiliates, you, your Enterprise, your Enterprise Contractors, and each party’s legal and financial advisors that have a need to know such Confidential Information for the performance of the AGREEMENT, provided that each such personnel, employee and Contractors are subject to a written agreement that includes confidentiality obligations consistent with those set forth herein. Each party will use all reasonable efforts to maintain the confidentiality of all of the other party’s Confidential Information in its possession or control, but in no event less than the efforts that it ordinarily uses with respect to its own Confidential Information of similar nature and importance. The foregoing obligations will not restrict either party from disclosing the other party’s Confidential Information or the terms and conditions of the AGREEMENT as required under applicable securities regulations or pursuant to the order or requirement of a court, administrative agency, or other governmental body, provided that the party required to make such disclosure (i) gives reasonable notice to the other party to enable it to contest such order or requirement prior to its disclosure (whether through protective orders or otherwise), (ii) uses reasonable effort to obtain confidential treatment or similar protection to the fullest extent possible to avoid such public disclosure, and (iii) discloses only the minimum amount of information necessary to comply with such requirements. 41 | 42 | NVIDIA Confidential Information under the AGREEMENT includes output from Licensed Software developer tools identified as “Pro” versions, where the output reveals functionality or performance data pertinent to NVIDIA hardware or software products. 43 | 44 | 4. OWNERSHIP. You are not obligated to disclose to NVIDIA any modifications that you, your Enterprise or your Contractors make to the Licensed Software as permitted under the AGREEMENT. As between the parties, all modifications are owned by NVIDIA and licensed to you under the AGREEMENT unless otherwise expressly provided in a Supplement. The Licensed Software and all modifications owned by NVIDIA, and the respective Intellectual Property Rights therein, are and will remain the sole and exclusive property of NVIDIA or its licensors. You shall not engage in any act or omission that would impair NVIDIA’s and/or its licensors’ Intellectual Property Rights in the Licensed Software or any other materials, information, processes or subject matter proprietary to NVIDIA. NVIDIA’s licensors are intended third party beneficiaries with the right to enforce provisions of the AGREEMENT with respect to their Confidential Information and/or Intellectual Property Rights. 45 | 46 | 5. FEEDBACK. You may, but you are not obligated, to provide Feedback to NVIDIA. You hereby grant NVIDIA and its Affiliates a perpetual, non-exclusive, worldwide, irrevocable license to use, reproduce, modify, license, sublicense (through multiple tiers of sublicensees), distribute (through multiple tiers of distributors) and otherwise commercialize any Feedback that you voluntarily provide without the payment of any royalties or fees to you. NVIDIA has no obligation to respond to Feedback or to incorporate Feedback into the Licensed Software. 47 | 48 | 6. NO WARRANTIES. THE LICENSED SOFTWARE AND ANY CONFIDENTIAL INFORMATION AND/OR SERVICES ARE PROVIDED BY NVIDIA “AS IS” AND “WITH ALL FAULTS,” AND NVIDIA AND ITS AFFILIATES EXPRESSLY DISCLAIM ALL WARRANTIES OF ANY KIND OR NATURE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES OF OPERABILITY, CONDITION, VALUE, ACCURACY OF DATA, OR QUALITY, AS WELL AS ANY WARRANTIES OF MERCHANTABILITY, SYSTEM INTEGRATION, WORKMANSHIP, SUITABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT, OR THE ABSENCE OF ANY DEFECTS THEREIN, WHETHER LATENT OR PATENT. NO WARRANTY IS MADE ON THE BASIS OF TRADE USAGE, COURSE OF DEALING OR COURSE OF TRADE. WITHOUT LIMITING THE FOREGOING, NVIDIA AND ITS AFFILIATES DO NOT WARRANT THAT THE LICENSED SOFTWARE OR ANY CONFIDENTIAL INFORMATION AND/OR SERVICES PROVIDED UNDER THE AGREEMENT WILL MEET YOUR REQUIREMENTS OR THAT THE OPERATION THEREOF WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ALL ERRORS WILL BE CORRECTED. 49 | 50 | 7. LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA AND ITS AFFILIATES SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, OR ANY LOST PROFITS, LOSS OF USE, LOSS OF DATA OR LOSS OF GOODWILL, OR THE COSTS OF PROCURING SUBSTITUTE PRODUCTS, ARISING OUT OF OR IN CONNECTION WITH THE AGREEMENT OR THE USE OR PERFORMANCE OF THE LICENSED SOFTWARE AND ANY CONFIDENTIAL INFORMATION AND/OR SERVICES PROVIDED UNDER THE AGREEMENT, WHETHER SUCH LIABILITY ARISES FROM ANY CLAIM BASED UPON BREACH OF CONTRACT, BREACH OF WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCT LIABILITY OR ANY OTHER CAUSE OF ACTION OR THEORY OF LIABILITY. IN NO EVENT WILL NVIDIA’S AND ITS AFFILIATES TOTAL CUMULATIVE LIABILITY UNDER OR ARISING OUT OF THE AGREEMENT EXCEED THE NET AMOUNTS RECEIVED BY NVIDIA OR ITS AFFILIATES FOR YOUR USE OF THE PARTICULAR LICENSED SOFTWARE DURING THE TWELVE (12) MONTHS BEFORE THE LIABILITY AROSE (or up to US$10.00 if you acquired the Licensed Software for no charge). THE NATURE OF THE LIABILITY, THE NUMBER OF CLAIMS OR SUITS OR THE NUMBER OF PARTIES WITHIN YOUR ENTERPRISE THAT ACCEPTED THE TERMS OF THE AGREEMENT SHALL NOT ENLARGE OR EXTEND THIS LIMIT. THE FOREGOING LIMITATIONS SHALL APPLY REGARDLESS OF WHETHER NVIDIA, ITS AFFILIATES OR ITS LICENSORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF WHETHER ANY REMEDY FAILS ITS ESSENTIAL PURPOSE. YOU ACKNOWLEDGE THAT NVIDIA’S OBLIGATIONS UNDER THE AGREEMENT ARE FOR THE BENEFIT OF YOU ONLY. The disclaimers, exclusions and limitations of liability set forth in the AGREEMENT form an essential basis of the bargain between the parties, and, absent any such disclaimers, exclusions or limitations of liability, the provisions of the AGREEMENT, including, without limitation, the economic terms, would be substantially different. 51 | 52 | 8. TERM AND TERMINATION. 53 | 54 | 8.1 AGREEMENT, Licenses and Services. This SLA shall become effective upon the Effective Date, each Supplement upon their acceptance, and both this SLA and Supplements shall continue in effect until your last access or use of the Licensed Software and/or services hereunder, unless earlier terminated as provided in this “Term and Termination” section. Each Licensed Software license ends at the earlier of (a) the expiration of the applicable license term, or (b) termination of such license or the AGREEMENT. Each service ends at the earlier of (x) the expiration of the applicable service term, (y) termination of such service or the AGREEMENT, or (z) expiration or termination of the associated license and no credit or refund will be provided upon the expiration or termination of the associated license for any service fees paid. 55 | 56 | 8.2 Termination and Effect of Expiration or Termination. NVIDIA may terminate the AGREEMENT in whole or in part: (i) if you breach any term of the AGREEMENT and fail to cure such breach within thirty (30) days following notice thereof from NVIDIA (or immediately if you violate NVIDIA’s Intellectual Property Rights); (ii) if you become the subject of a voluntary or involuntary petition in bankruptcy or any proceeding relating to insolvency, receivership, liquidation or composition for the benefit of creditors, if that petition or proceeding is not dismissed with prejudice within sixty (60) days after filing, or if you cease to do business; or (iii) if you commence or participate in any legal proceeding against NVIDIA, with respect to the Licensed Software that is the subject of the proceeding during the pendency of such legal proceeding. If you or your authorized NVIDIA reseller fail to pay license fees or service fees when due then NVIDIA may, in its sole discretion, suspend or terminate your license grants, services and any other rights provided under the AGREEMENT for the affected Licensed Software, in addition to any other remedies NVIDIA may have at law or equity. Upon any expiration or termination of the AGREEMENT, a license or a service provided hereunder, (a) any amounts owed to NVIDIA become immediately due and payable, (b) you must promptly discontinue use of the affected Licensed Software and/or service, and (c) you must promptly destroy or return to NVIDIA all copies of the affected Licensed Software and all portions thereof in your possession or control, and each party will promptly destroy or return to the other all of the other party’s Confidential Information within its possession or control. Upon written request, you will certify in writing that you have complied with your obligations under this section. Upon expiration or termination of the AGREEMENT all provisions survive except for the license grant provisions. 57 | 58 | 9. CONSENT TO COLLECTION AND USE OF INFORMATION. 59 | 60 | You hereby agree and acknowledge that the Software may access and collect data about your Enterprise computer systems as well as configures the systems in order to (a) properly optimize such systems for use with the Software, (b) deliver content through the Software, (c) improve NVIDIA products and services, and (d) deliver marketing communications. Data collected by the Software includes, but is not limited to, system (i) hardware configuration and ID, (ii) operating system and driver configuration, (iii) installed applications, (iv) applications settings, performance, and usage data, and (iv) usage metrics of the Software. To the extent that you use the Software, you hereby consent to all of the foregoing, and represent and warrant that you have the right to grant such consent. In addition, you agree that you are solely responsible for maintaining appropriate data backups and system restore points for your Enterprise systems, and that NVIDIA will have no responsibility for any damage or loss to such systems (including loss of data or access) arising from or relating to (a) any changes to the configuration, application settings, environment variables, registry, drivers, BIOS, or other attributes of the systems (or any part of such systems) initiated through the Software; or (b) installation of any Software or third party software patches initiated through the Software. In certain systems you may change your system update preferences by unchecking "Automatically check for updates" in the "Preferences" tab of the control panel for the Software. 61 | 62 | In connection with the receipt of the Licensed Software or services you may receive access to links to third party websites and services and the availability of those links does not imply any endorsement by NVIDIA. NVIDIA encourages you to review the privacy statements on those sites and services that you choose to visit so that you can understand how they may collect, use and share personal information of individuals. NVIDIA is not responsible or liable for: (i) the availability or accuracy of such links; or (ii) the products, services or information available on or through such links; or (iii) the privacy statements or practices of sites and services controlled by other companies or organizations. 63 | 64 | To the extent that you or members of your Enterprise provide to NVIDIA during registration or otherwise personal data, you acknowledge that such information will be collected, used and disclosed by NVIDIA in accordance with NVIDIA's privacy policy, available at URL http://www.nvidia.com/object/privacy_policy.html. 65 | 66 | 10. GENERAL. 67 | 68 | This SLA, any Supplements incorporated hereto, and Orders constitute the entire agreement of the parties with respect to the subject matter hereto and supersede all prior negotiations, conversations, or discussions between the parties relating to the subject matter hereto, oral or written, and all past dealings or industry custom. Any additional and/or conflicting terms and conditions on purchase order(s) or any other documents issued by you are null, void, and invalid. Any amendment or waiver under the AGREEMENT must be in writing and signed by representatives of both parties. 69 | 70 | The AGREEMENT and the rights and obligations thereunder may not be assigned by you, in whole or in part, including by merger, consolidation, dissolution, operation of law, or any other manner, without written consent of NVIDIA, and any purported assignment in violation of this provision shall be void and of no effect. NVIDIA may assign, delegate or transfer the AGREEMENT and its rights and obligations hereunder, and if to a non-Affiliate you will be notified. 71 | 72 | Each party acknowledges and agrees that the other is an independent contractor in the performance of the AGREEMENT, and each party is solely responsible for all of its employees, agents, contractors, and labor costs and expenses arising in connection therewith. The parties are not partners, joint ventures or otherwise affiliated, and neither has any authority to make any statements, representations or commitments of any kind to bind the other party without prior written consent. 73 | 74 | Neither party will be responsible for any failure or delay in its performance under the AGREEMENT (except for any payment obligations) to the extent due to causes beyond its reasonable control for so long as such force majeure event continues in effect. 75 | 76 | The AGREEMENT will be governed by and construed under the laws of the State of Delaware and the United States without regard to the conflicts of law provisions thereof and without regard to the United Nations Convention on Contracts for the International Sale of Goods. The parties consent to the personal jurisdiction of the federal and state courts located in Santa Clara County, California. You acknowledge and agree that a breach of any of your promises or agreements contained in the AGREEMENT may result in irreparable and continuing injury to NVIDIA for which monetary damages may not be an adequate remedy and therefore NVIDIA is entitled to seek injunctive relief as well as such other and further relief as may be appropriate. If any court of competent jurisdiction determines that any provision of the AGREEMENT is illegal, invalid or unenforceable, the remaining provisions will remain in full force and effect. Unless otherwise specified, remedies are cumulative. 77 | 78 | The Licensed Software has been developed entirely at private expense and is “commercial items” consisting of “commercial computer software” and “commercial computer software documentation” provided with RESTRICTED RIGHTS. Use, duplication or disclosure by the U.S. Government or a U.S. Government subcontractor is subject to the restrictions set forth in the AGREEMENT pursuant to DFARS 227.7202-3(a) or as set forth in subparagraphs (c)(1) and (2) of the Commercial Computer Software - Restricted Rights clause at FAR 52.227-19, as applicable. Contractor/manufacturer is NVIDIA, 2788 San Tomas Expressway, Santa Clara, CA 95051. 79 | 80 | You acknowledge that the Licensed Software described under the AGREEMENT is subject to export control under the U.S. Export Administration Regulations (EAR) and economic sanctions regulations administered by the U.S. Department of Treasury’s Office of Foreign Assets Control (OFAC). Therefore, you may not export, reexport or transfer in-country the Licensed Software without first obtaining any license or other approval that may be required by BIS and/or OFAC. You are responsible for any violation of the U.S. or other applicable export control or economic sanctions laws, regulations and requirements related to the Licensed Software. By accepting this SLA, you confirm that you are not a resident or citizen of any country currently embargoed by the U.S. and that you are not otherwise prohibited from receiving the Licensed Software. 81 | 82 | Any notice delivered by NVIDIA to you under the AGREEMENT will be delivered via mail, email or fax. Please direct your legal notices or other correspondence to NVIDIA Corporation, 2788 San Tomas Expressway, Santa Clara, California 95051, United States of America, Attention: Legal Department. 83 | 84 | GLOSSARY OF TERMS 85 | 86 | Certain capitalized terms, if not otherwise defined elsewhere in this SLA, shall have the meanings set forth below: 87 | 88 | a. “Affiliate” means any legal entity that Owns, is Owned by, or is commonly Owned with a party. “Own” means having more than 50% ownership or the right to direct the management of the entity. 89 | 90 | b. “AGREEMENT” means this SLA and all associated Supplements entered by the parties referencing this SLA. 91 | 92 | c. “Authorized Users” means your Enterprise individual employees and any of your Enterprise’s Contractors, subject to the terms of the “Enterprise and Contractors Usage” section. 93 | 94 | d. “Confidential Information” means the Licensed Software (unless made publicly available by NVIDIA without confidentiality obligations), and any NVIDIA business, marketing, pricing, research and development, know-how, technical, scientific, financial status, proposed new products or other information disclosed by NVIDIA to you which, at the time of disclosure, is designated in writing as confidential or proprietary (or like written designation), or orally identified as confidential or proprietary or is otherwise reasonably identifiable by parties exercising reasonable business judgment, as confidential. Confidential Information does not and will not include information that: (i) is or becomes generally known to the public through no fault of or breach of the AGREEMENT by the receiving party; (ii) is rightfully known by the receiving party at the time of disclosure without an obligation of confidentiality; (iii) is independently developed by the receiving party without use of the disclosing party’s Confidential Information; or (iv) is rightfully obtained by the receiving party from a third party without restriction on use or disclosure. 95 | 96 | e. “Contractor” means an individual who works primarily for your Enterprise on a contractor basis from your secure network. 97 | 98 | f. “Documentation” means the NVIDIA documentation made available for use with the Software, including (without limitation) user manuals, datasheets, operations instructions, installation guides, release notes and other materials provided to you under the AGREEMENT. 99 | 100 | g. “Enterprise” means you or any company or legal entity for which you accepted the terms of this SLA, and their subsidiaries of which your company or legal entity owns more than fifty percent (50%) of the issued and outstanding equity. 101 | 102 | h. “Excluded License” includes, without limitation, a software license that requires as a condition of use, modification, and/or distribution that software be (i) disclosed or distributed in source code form; (ii) licensed for the purpose of making derivative works; or (iii) redistributable at no charge. 103 | 104 | i. “Feedback” means any and all suggestions, feature requests, comments or other feedback regarding the Licensed Software, including possible enhancements or modifications thereto. 105 | 106 | j. “Intellectual Property Rights” means all patent, copyright, trademark, trade secret, trade dress, trade names, utility models, mask work, moral rights, rights of attribution or integrity service marks, master recording and music publishing rights, performance rights, author’s rights, database rights, registered design rights and any applications for the protection or registration of these rights, or other intellectual or industrial property rights or proprietary rights, howsoever arising and in whatever media, whether now known or hereafter devised, whether or not registered, (including all claims and causes of action for infringement, misappropriation or violation and all rights in any registrations and renewals), worldwide and whether existing now or in the future. 107 | 108 | k. “Licensed Software” means Software, Documentation and all modifications owned by NVIDIA. 109 | 110 | l. “Order” means a purchase order issued by you, a signed purchase agreement with you, or other ordering document issued by you to NVIDIA or a NVIDIA authorized reseller (including any on-line acceptance process) that references and incorporates the AGREEMENT and is accepted by NVIDIA. 111 | 112 | m. “Software” means the NVIDIA software programs licensed to you under the AGREEMENT including, without limitation, libraries, sample code, utility programs and programming code. 113 | 114 | n. “Supplement” means the additional terms and conditions beyond those stated in this SLA that apply to certain Licensed Software licensed hereunder. 115 | 116 | Notices 117 | Notice 118 | THE INFORMATION IN THIS GUIDE AND ALL OTHER INFORMATION CONTAINED IN NVIDIA DOCUMENTATION REFERENCED IN THIS GUIDE IS PROVIDED “AS IS.” NVIDIA MAKES NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO THE INFORMATION FOR THE PRODUCT, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. Notwithstanding any damages that customer might incur for any reason whatsoever, NVIDIA’s aggregate and cumulative liability towards customer for the product described in this guide shall be limited in accordance with the NVIDIA terms and conditions of sale for the product. 119 | 120 | THE NVIDIA PRODUCT DESCRIBED IN THIS GUIDE IS NOT FAULT TOLERANT AND IS NOT DESIGNED, MANUFACTURED OR INTENDED FOR USE IN CONNECTION WITH THE DESIGN, CONSTRUCTION, MAINTENANCE, AND/OR OPERATION OF ANY SYSTEM WHERE THE USE OR A FAILURE OF SUCH SYSTEM COULD RESULT IN A SITUATION THAT THREATENS THE SAFETY OF HUMAN LIFE OR SEVERE PHYSICAL HARM OR PROPERTY DAMAGE (INCLUDING, FOR EXAMPLE, USE IN CONNECTION WITH ANY NUCLEAR, AVIONICS, LIFE SUPPORT OR OTHER LIFE CRITICAL APPLICATION). NVIDIA EXPRESSLY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR SUCH HIGH RISK USES. NVIDIA SHALL NOT BE LIABLE TO CUSTOMER OR ANY THIRD PARTY, IN WHOLE OR IN PART, FOR ANY CLAIMS OR DAMAGES ARISING FROM SUCH HIGH RISK USES. 121 | 122 | NVIDIA makes no representation or warranty that the product described in this guide will be suitable for any specified use without further testing or modification. Testing of all parameters of each product is not necessarily performed by NVIDIA. It is customer’s sole responsibility to ensure the product is suitable and fit for the application planned by customer and to do the necessary testing for the application in order to avoid a default of the application or the product. Weaknesses in customer’s product designs may affect the quality and reliability of the NVIDIA product and may result in additional or different conditions and/or requirements beyond those contained in this guide. NVIDIA does not accept any liability related to any default, damage, costs or problem which may be based on or attributable to: (i) the use of the NVIDIA product in any manner that is contrary to this guide, or (ii) customer product designs. 123 | 124 | Other than the right for customer to use the information in this guide with the product, no other license, either expressed or implied, is hereby granted by NVIDIA under this guide. Reproduction of information in this guide is permissible only if reproduction is approved by NVIDIA in writing, is reproduced without alteration, and is accompanied by all associated conditions, limitations, and notices. 125 | 126 | Trademarks 127 | NVIDIA, the NVIDIA logo, and cuBLAS, CUDA, cuDNN, cuFFT, cuSPARSE, DIGITS, DGX, DGX-1, DGX Station, GRID, Jetson, Kepler, NGX, NVIDIA GPU Cloud, Maxwell, NCCL, NVLink, Pascal, Tegra, TensorRT, Tesla and Volta are trademarks and/or registered trademarks of NVIDIA Corporation in the Unites States and other countries. Other company and product names may be trademarks of the respective companies with which they are associated. 128 | 129 | Copyright 130 | © 2021 NVIDIA Corporation. All rights reserved. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Isaac ROS Common 2 | 3 | --- 4 | **WARNING** 5 | 6 | Isaac ROS Common has moved to [NVIDIA-ISAAC-ROS](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_common) (2021-10-20). Please visit [here](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_common) to find new development and file issues. 7 | 8 | --- 9 | 10 | Isaac ROS common utilities for use in conjunction with the Isaac ROS suite of packages. 11 | Note: Please refer to `scripts/README.md` for script used to setup dev environment 12 | -------------------------------------------------------------------------------- /docker/Dockerfile.aarch64.base: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION is strictly prohibited. 8 | 9 | # Dockder file to aarch64 based Jetson device 10 | ARG BASE_IMAGE=dustynv/ros:foxy-ros-base-l4t-r32.6.1 11 | FROM ${BASE_IMAGE} 12 | 13 | # Disable terminal interaction for apt 14 | ENV DEBIAN_FRONTEND=noninteractive 15 | 16 | # Fundamentals 17 | RUN apt-get update && apt-get install -y \ 18 | build-essential \ 19 | cmake \ 20 | curl \ 21 | git \ 22 | sudo \ 23 | unzip \ 24 | vim \ 25 | wget \ 26 | software-properties-common \ 27 | && rm -rf /var/lib/apt/lists/* 28 | 29 | # Install OpenCV dependencies 30 | RUN apt-get update && apt-get install -y \ 31 | libavformat-dev \ 32 | libjpeg-dev \ 33 | libopenjp2-7-dev \ 34 | libpng-dev \ 35 | libpq-dev \ 36 | libswscale-dev \ 37 | libtbb2 \ 38 | libtbb-dev \ 39 | libtiff-dev \ 40 | pkg-config \ 41 | yasm \ 42 | && rm -rf /var/lib/apt/lists/* 43 | 44 | # Install additional packages needed for ROS2 dependencies 45 | RUN apt-get update && apt-get install -y \ 46 | python3-distutils \ 47 | libboost-all-dev \ 48 | libboost-dev \ 49 | && rm -rf /var/lib/apt/lists/* 50 | 51 | # sklearn dependencies 52 | RUN apt-get update && apt-get install -y \ 53 | gfortran \ 54 | libatlas-base-dev \ 55 | python3-scipy \ 56 | && rm -rf /var/lib/apt/lists/* 57 | 58 | # sklearn Python dependencies 59 | RUN python3 -m pip install -U \ 60 | Cython \ 61 | wheel 62 | 63 | # Install sklearn 64 | RUN python3 -m pip install -U \ 65 | scikit-learn 66 | 67 | # Install Git-LFS 68 | RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \ 69 | apt-get update && apt-get install -y \ 70 | git-lfs \ 71 | && rm -rf /var/lib/apt/lists/* 72 | 73 | # Install Realsense 74 | RUN apt update \ 75 | && apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE \ 76 | && add-apt-repository -y "deb https://librealsense.intel.com/Debian/apt-repo bionic main" -u \ 77 | && apt-get install -y rsync librealsense2-utils librealsense2-dev \ 78 | && rm -rf /var/lib/apt/lists/* 79 | 80 | # Update environment 81 | ENV LD_LIBRARY_PATH="/opt/nvidia/vpi1/lib64:${LD_LIBRARY_PATH}" 82 | ENV LD_LIBRARY_PATH="/usr/lib/aarch64-linux-gnu/tegra:${LD_LIBRARY_PATH}" 83 | ENV LD_LIBRARY_PATH="/usr/local/cuda-10.2/targets/aarch64-linux/lib:${LD_LIBRARY_PATH}" 84 | ENV LD_LIBRARY_PATH="/usr/lib/aarch64-linux-gnu/tegra-egl:${LD_LIBRARY_PATH}" 85 | 86 | RUN echo "source /opt/ros/foxy/install/setup.bash" > /opt/ros/foxy/setup.bash 87 | 88 | # Restore using the default Foxy DDS middleware: FastRTPS 89 | ENV RMW_IMPLEMENTATION=rmw_fastrtps_cpp 90 | 91 | ### ----------------------------- 92 | 93 | # Setup non-root admin user 94 | ARG USERNAME=admin 95 | ARG USER_UID=1000 96 | ARG USER_GID=1001 97 | 98 | # Create the 'admin' user 99 | RUN groupadd --gid $USER_GID $USERNAME \ 100 | && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ 101 | && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ 102 | && chmod 0440 /etc/sudoers.d/$USERNAME \ 103 | && adduser admin video && adduser admin sudo 104 | 105 | COPY scripts/workspace-entrypoint.sh /home/$USERNAME/workspace-entrypoint.sh 106 | RUN chmod +x /home/$USERNAME/workspace-entrypoint.sh 107 | 108 | -------------------------------------------------------------------------------- /docker/Dockerfile.x86_64.base: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION is strictly prohibited. 8 | # 9 | # Docker file to build on x86_64 10 | ARG BASE_IMAGE=nvidia/cuda:11.2.0-devel-ubuntu20.04 11 | FROM ${BASE_IMAGE} 12 | 13 | # disable terminal interaction for apt 14 | ENV DEBIAN_FRONTEND=noninteractive 15 | 16 | # Fundamentals 17 | RUN apt-get update && apt-get install -y \ 18 | bash-completion \ 19 | build-essential \ 20 | clang-format \ 21 | cmake \ 22 | curl \ 23 | git \ 24 | gnupg2 \ 25 | locales \ 26 | lsb-release \ 27 | rsync \ 28 | software-properties-common \ 29 | wget \ 30 | vim \ 31 | mlocate \ 32 | && rm -rf /var/lib/apt/lists/* 33 | 34 | # Python basics 35 | RUN apt-get update && apt-get install -y \ 36 | python3-flake8 \ 37 | python3-opencv \ 38 | python3-pip \ 39 | python3-pytest-cov \ 40 | python3-setuptools \ 41 | && rm -rf /var/lib/apt/lists/* 42 | 43 | # Video utilities 44 | RUN apt-get update && apt-get install -y \ 45 | v4l-utils \ 46 | mesa-utils \ 47 | libcanberra-gtk-module \ 48 | libcanberra-gtk3-module \ 49 | && rm -rf /var/lib/apt/lists/* 50 | 51 | # Core dev libraries 52 | RUN apt-get update && apt-get install -y \ 53 | libasio-dev \ 54 | libbullet-dev \ 55 | libtinyxml2-dev \ 56 | libcunit1-dev \ 57 | && rm -rf /var/lib/apt/lists/* 58 | 59 | # Python3 (PIP) 60 | RUN python3 -m pip install -U \ 61 | argcomplete \ 62 | autopep8 \ 63 | flake8 \ 64 | flake8-blind-except \ 65 | flake8-builtins \ 66 | flake8-class-newline \ 67 | flake8-comprehensions \ 68 | flake8-deprecated \ 69 | flake8-docstrings \ 70 | flake8-import-order \ 71 | flake8-quotes \ 72 | pytest-repeat \ 73 | pytest-rerunfailures \ 74 | pytest \ 75 | pydocstyle \ 76 | scikit-learn 77 | 78 | # Install Git-LFS 79 | RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \ 80 | apt-get update && apt-get install -y \ 81 | git-lfs \ 82 | && rm -rf /var/lib/apt/lists/* 83 | 84 | # Install VPI packages 85 | ARG HAS_GPU 86 | COPY vpi/*.deb /opt/install/ 87 | RUN if [ "$HAS_GPU" = "true" ]; then \ 88 | dpkg -i /opt/install/vpi-lib-1.1.11-cuda11-x86_64-linux.deb; \ 89 | dpkg -i /opt/install/vpi-dev-1.1.11-cuda11-x86_64-linux.deb; \ 90 | updatedb; \ 91 | fi 92 | 93 | # Setup ROS2 Foxy 94 | RUN locale-gen en_US en_US.UTF-8 95 | RUN update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 96 | ENV LANG=en_US.UTF-8 97 | 98 | RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - 99 | RUN sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list' 100 | 101 | RUN apt-get update && apt-get install -y \ 102 | python3-colcon-common-extensions \ 103 | python3-rosdep \ 104 | python3-vcstool \ 105 | ros-foxy-camera-calibration-parsers \ 106 | ros-foxy-camera-info-manager \ 107 | ros-foxy-desktop \ 108 | ros-foxy-launch-testing-ament-cmake \ 109 | ros-foxy-rqt* \ 110 | ros-foxy-turtlesim \ 111 | ros-foxy-v4l2-camera \ 112 | ros-foxy-realsense2-camera \ 113 | && rm -rf /var/lib/apt/lists/* 114 | 115 | RUN rosdep init 116 | 117 | # Install Realsense 118 | RUN apt update \ 119 | && apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE \ 120 | || apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE \ 121 | && add-apt-repository -y "deb https://librealsense.intel.com/Debian/apt-repo bionic main" -u \ 122 | && apt-get install -y librealsense2-utils librealsense2-dev 123 | 124 | # Restore using the default Foxy DDS middleware: FastRTPS 125 | ENV RMW_IMPLEMENTATION=rmw_fastrtps_cpp 126 | 127 | # Setup non-root admin user 128 | ARG USERNAME=admin 129 | ARG USER_UID=1000 130 | ARG USER_GID=1001 131 | 132 | # Create the 'admin' user 133 | RUN groupadd --gid $USER_GID $USERNAME \ 134 | && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ 135 | && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ 136 | && chmod 0440 /etc/sudoers.d/$USERNAME \ 137 | && adduser admin video && adduser admin sudo 138 | 139 | COPY scripts/workspace-entrypoint.sh /home/$USERNAME/workspace-entrypoint.sh 140 | RUN chmod +x /home/$USERNAME/workspace-entrypoint.sh 141 | 142 | -------------------------------------------------------------------------------- /docker/scripts/workspace-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # NVIDIA CORPORATION and its licensors retain all intellectual property 6 | # and proprietary rights in and to this software, related documentation 7 | # and any modifications thereto. Any use, reproduction, disclosure or 8 | # distribution of this software and related documentation without an express 9 | # license agreement from NVIDIA CORPORATION is strictly prohibited. 10 | 11 | # Build ROS dependency 12 | echo "source /opt/ros/foxy/setup.bash" >> ~/.bashrc 13 | source /opt/ros/foxy/setup.bash 14 | 15 | sudo apt-get update 16 | rosdep update 17 | 18 | $@ 19 | -------------------------------------------------------------------------------- /docker/vpi/vpi-dev-1.1.11-cuda11-x86_64-linux.deb: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:cc330dc311803789b573283beb212fe44b307d57ff63565bc570ffbf75a48a0d 3 | size 55790 4 | -------------------------------------------------------------------------------- /docker/vpi/vpi-lib-1.1.11-cuda11-x86_64-linux.deb: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:a2ff7114caa50d4a2fd31fb675f1d1c23e1e06d2dda4e1fd9921d126d5a89f66 3 | size 16271658 4 | -------------------------------------------------------------------------------- /giistr-cla.md: -------------------------------------------------------------------------------- 1 | ## Individual Contributor License Agreement (CLA) 2 | 3 | **Thank you for submitting your contributions to this project.** 4 | 5 | By signing this CLA, you agree that the following terms apply to all of your past, present and future contributions 6 | to the project. 7 | 8 | ### License. 9 | 10 | You hereby represent that all present, past and future contributions are governed by the 11 | [MIT License](https://opensource.org/licenses/MIT) 12 | copyright statement. 13 | 14 | This entails that to the extent possible under law, you transfer all copyright and related or neighboring rights 15 | of the code or documents you contribute to the project itself or its maintainers. 16 | Furthermore you also represent that you have the authority to perform the above waiver 17 | with respect to the entirety of you contributions. 18 | 19 | ### Moral Rights. 20 | 21 | To the fullest extent permitted under applicable law, you hereby waive, and agree not to 22 | assert, all of your “moral rights” in or relating to your contributions for the benefit of the project. 23 | 24 | ### Third Party Content. 25 | 26 | If your Contribution includes or is based on any source code, object code, bug fixes, configuration changes, tools, 27 | specifications, documentation, data, materials, feedback, information or other works of authorship that were not 28 | authored by you (“Third Party Content”) or if you are aware of any third party intellectual property or proprietary 29 | rights associated with your Contribution (“Third Party Rights”), 30 | then you agree to include with the submission of your Contribution full details respecting such Third Party 31 | Content and Third Party Rights, including, without limitation, identification of which aspects of your 32 | Contribution contain Third Party Content or are associated with Third Party Rights, the owner/author of the 33 | Third Party Content and Third Party Rights, where you obtained the Third Party Content, and any applicable 34 | third party license terms or restrictions respecting the Third Party Content and Third Party Rights. For greater 35 | certainty, the foregoing obligations respecting the identification of Third Party Content and Third Party Rights 36 | do not apply to any portion of a Project that is incorporated into your Contribution to that same Project. 37 | 38 | ### Representations. 39 | 40 | You represent that, other than the Third Party Content and Third Party Rights identified by 41 | you in accordance with this Agreement, you are the sole author of your Contributions and are legally entitled 42 | to grant the foregoing licenses and waivers in respect of your Contributions. If your Contributions were 43 | created in the course of your employment with your past or present employer(s), you represent that such 44 | employer(s) has authorized you to make your Contributions on behalf of such employer(s) or such employer 45 | (s) has waived all of their right, title or interest in or to your Contributions. 46 | 47 | ### Disclaimer. 48 | 49 | To the fullest extent permitted under applicable law, your Contributions are provided on an "as is" 50 | basis, without any warranties or conditions, express or implied, including, without limitation, any implied 51 | warranties or conditions of non-infringement, merchantability or fitness for a particular purpose. You are not 52 | required to provide support for your Contributions, except to the extent you desire to provide support. 53 | 54 | ### No Obligation. 55 | 56 | You acknowledge that the maintainers of this project are under no obligation to use or incorporate your contributions 57 | into the project. The decision to use or incorporate your contributions into the project will be made at the 58 | sole discretion of the maintainers or their authorized delegates. -------------------------------------------------------------------------------- /isaac_ros_common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION is strictly prohibited. 8 | 9 | cmake_minimum_required(VERSION 3.5) 10 | project(isaac_ros_common) 11 | 12 | # Default to C++17 13 | if(NOT CMAKE_CXX_STANDARD) 14 | set(CMAKE_CXX_STANDARD 17) 15 | endif() 16 | 17 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") 18 | add_compile_options(-Wall -Wextra -Wpedantic) 19 | endif() 20 | 21 | find_package(ament_cmake_auto REQUIRED) 22 | ament_auto_find_build_dependencies() 23 | 24 | # Find VPI dependency 25 | find_package(vpi REQUIRED) 26 | 27 | ament_auto_add_library(${PROJECT_NAME} SHARED 28 | src/vpi_utilities.cpp 29 | ) 30 | 31 | target_link_libraries(${PROJECT_NAME} vpi) 32 | 33 | install(TARGETS ${PROJECT_NAME} 34 | ARCHIVE DESTINATION lib 35 | LIBRARY DESTINATION lib 36 | RUNTIME DESTINATION bin 37 | ) 38 | 39 | if(BUILD_TESTING) 40 | find_package(ament_lint_auto REQUIRED) 41 | 42 | # Ignore copyright notices since we use custom JetPack EULA 43 | set(ament_cmake_copyright_FOUND TRUE) 44 | 45 | ament_lint_auto_find_test_dependencies() 46 | 47 | endif() 48 | 49 | ament_auto_package() 50 | -------------------------------------------------------------------------------- /isaac_ros_common/include/isaac_ros_common/vpi_utilities.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * NVIDIA CORPORATION and its licensors retain all intellectual property 5 | * and proprietary rights in and to this software, related documentation 6 | * and any modifications thereto. Any use, reproduction, disclosure or 7 | * distribution of this software and related documentation without an express 8 | * license agreement from NVIDIA CORPORATION is strictly prohibited. 9 | */ 10 | 11 | #ifndef ISAAC_ROS_COMMON__VPI_UTILITIES_HPP_ 12 | #define ISAAC_ROS_COMMON__VPI_UTILITIES_HPP_ 13 | 14 | #include "rclcpp/rclcpp.hpp" 15 | #include "vpi/VPI.h" 16 | 17 | // VPI status check macro 18 | #define CHECK_STATUS(STMT) \ 19 | do { \ 20 | VPIStatus status = (STMT); \ 21 | if (status != VPI_SUCCESS) { \ 22 | char buffer[VPI_MAX_STATUS_MESSAGE_LENGTH]; \ 23 | vpiGetLastStatusMessage(buffer, sizeof(buffer)); \ 24 | std::ostringstream ss; \ 25 | ss << vpiStatusGetName(status) << ": " << buffer; \ 26 | throw std::runtime_error(ss.str()); \ 27 | } \ 28 | } while (0); 29 | 30 | namespace isaac_ros 31 | { 32 | namespace common 33 | { 34 | 35 | /** 36 | * @brief Declare and parse ROS2 parameter into VPI backend flags 37 | * 38 | * @param node The node to declare the parameter with 39 | * @param default_backends The default backends to use if given invalid input 40 | * @return uint32_t The resulting VPI backend flags 41 | */ 42 | uint32_t DeclareVPIBackendParameter(rclcpp::Node * node, uint32_t default_backends) noexcept; 43 | 44 | } // namespace common 45 | 46 | } // namespace isaac_ros 47 | 48 | #endif // ISAAC_ROS_COMMON__VPI_UTILITIES_HPP_ 49 | -------------------------------------------------------------------------------- /isaac_ros_common/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | 15 | isaac_ros_common 16 | 0.9.0 17 | Utilities for performing common functions in Isaac ROS packages 18 | 19 | Hemal Shah 20 | JetPack EULA 21 | https://developer.nvidia.com/blog/accelerating-ai-modules-for-ros-and-ros-2-on-jetson/ 22 | Jaiveer Singh 23 | 24 | ament_cmake_auto 25 | 26 | rclcpp 27 | vpi 28 | 29 | ament_lint_auto 30 | ament_lint_common 31 | 32 | 33 | ament_cmake 34 | 35 | 36 | -------------------------------------------------------------------------------- /isaac_ros_common/src/vpi_utilities.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * NVIDIA CORPORATION and its licensors retain all intellectual property 5 | * and proprietary rights in and to this software, related documentation 6 | * and any modifications thereto. Any use, reproduction, disclosure or 7 | * distribution of this software and related documentation without an express 8 | * license agreement from NVIDIA CORPORATION is strictly prohibited. 9 | */ 10 | 11 | #include "isaac_ros_common/vpi_utilities.hpp" 12 | 13 | #include 14 | #include 15 | 16 | namespace isaac_ros 17 | { 18 | namespace common 19 | { 20 | 21 | namespace 22 | { 23 | 24 | // Map from human-friendly backend string to VPI backend as uint32_t 25 | const std::unordered_map g_str_to_vpi_backend({ 26 | {"CPU", VPI_BACKEND_CPU}, 27 | {"CUDA", VPI_BACKEND_CUDA}, 28 | {"PVA", VPI_BACKEND_PVA}, 29 | {"VIC", VPI_BACKEND_VIC}, 30 | {"NVENC", VPI_BACKEND_NVENC}, 31 | {"TEGRA", VPI_BACKEND_TEGRA}, 32 | {"ALL", VPI_BACKEND_ALL}, 33 | }); 34 | 35 | } // namespace 36 | 37 | uint32_t DeclareVPIBackendParameter(rclcpp::Node * node, uint32_t default_backends) noexcept 38 | { 39 | const std::string DEFAULT_BACKENDS_STRING{""}; 40 | const std::string backends_string{node->declare_parameter("backends", DEFAULT_BACKENDS_STRING)}; 41 | 42 | // If the ROS2 parameter is still at the default value, then return the default backend 43 | if (backends_string == DEFAULT_BACKENDS_STRING) { 44 | return default_backends; 45 | } 46 | 47 | // Final backend to be returned after combining all requested backends 48 | uint32_t backends{}; 49 | 50 | std::stringstream stream{backends_string}; 51 | while (stream.good()) { 52 | // Extract next backend delimited by commas 53 | std::string backend_str; 54 | std::getline(stream, backend_str, ','); 55 | 56 | // Search the map for the backend 57 | auto backend_it{g_str_to_vpi_backend.find(backend_str)}; 58 | if (backend_it != g_str_to_vpi_backend.end()) { 59 | // If found, bitwise-or the backend to add it into the allowable backends 60 | backends |= backend_it->second; 61 | } else { 62 | // Otherwise, log an error with all allowable backends 63 | std::ostringstream os{}; 64 | os << "Backend '" << backend_str << "' from requested backends '" << backends_string << 65 | "' not recognized. Backend must be one of:" << 66 | std::endl; 67 | std::for_each( 68 | g_str_to_vpi_backend.begin(), g_str_to_vpi_backend.end(), [&os](auto & entry) { 69 | os << entry.first << std::endl; 70 | }); 71 | 72 | RCLCPP_ERROR(node->get_logger(), os.str()); 73 | 74 | // Return default backends due to error 75 | return default_backends; 76 | } 77 | } 78 | 79 | // Once all backends have been bitwise-or'ed together, return the result 80 | return backends; 81 | } 82 | 83 | } // namespace common 84 | } // namespace isaac_ros 85 | -------------------------------------------------------------------------------- /isaac_ros_test/isaac_ros_test/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION is strictly prohibited. 8 | 9 | """Imports for isaac_ros_test module.""" 10 | 11 | from .cpu_profiler import CPUProfiler 12 | from .isaac_ros_base_test import IsaacROSBaseTest 13 | from .json_conversion import JSONConversion 14 | from .tegrastats_profiler import TegrastatsProfiler 15 | 16 | __all__ = [ 17 | 'CPUProfiler', 18 | 'IsaacROSBaseTest', 19 | 'JSONConversion', 20 | 'TegrastatsProfiler' 21 | ] 22 | -------------------------------------------------------------------------------- /isaac_ros_test/isaac_ros_test/cpu_profiler.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION is strictly prohibited. 8 | 9 | """CPU profiler class to measure performance of benchmark tests on x86.""" 10 | 11 | from pathlib import Path 12 | from threading import Thread 13 | from typing import Dict, Tuple 14 | 15 | import numpy as np 16 | import psutil 17 | 18 | from .profiler import Profiler 19 | 20 | 21 | class CPUProfiler(Profiler): 22 | """CPU profiler class to measure CPU performance of benchmark tests.""" 23 | 24 | def __init__(self): 25 | """Construct CPU profiler.""" 26 | super().__init__() 27 | 28 | def start_profiling(self, log_dir: Path, interval: float = 1.0) -> Path: 29 | """ 30 | Start CPU profiling thread to keep track of performance metrics. 31 | 32 | Parameters 33 | ---------- 34 | log_dir : Path 35 | Path to write the logs to 36 | 37 | interval: float 38 | The interval between measurements, in seconds 39 | 40 | """ 41 | super().start_profiling(log_dir) 42 | 43 | # While the is_running flag is true, log CPU usage 44 | def psutil_log(): 45 | with open(self.logfile_path, 'w+') as logfile: 46 | while self.is_running: 47 | logfile.write( 48 | f'{psutil.cpu_percent(interval=interval, percpu=True)}\n') 49 | 50 | self.psutil_thread = Thread(target=psutil_log) 51 | self.psutil_thread.start() 52 | 53 | return self.logfile_path 54 | 55 | def stop_profiling(self): 56 | """Stop profiling after running start_profiling().""" 57 | super().stop_profiling() 58 | 59 | # Now that the is_running flag has been set to false, wait for thread to stop 60 | self.psutil_thread.join() 61 | 62 | def get_results(self, logfile_path: Path = None) -> Dict[str, Tuple[str, str]]: 63 | """ 64 | Return a labelled dictionary of results parsed from the logfile. 65 | 66 | This should only be called after calling start_profiling() and stop_profiling(). 67 | 68 | Returns 69 | ------- 70 | Dict[str, str] 71 | Dictionary mapping label: (value, units) 72 | 73 | """ 74 | assert not self.is_running, 'Cannot collect results until profiler has been stopped!' 75 | 76 | logfile_path = self.logfile_path if logfile_path is None else logfile_path 77 | assert self.logfile_path is not None, 'No logfile to read results from!' 78 | 79 | data = {} 80 | with open(logfile_path) as logfile: 81 | cpu_values = [] 82 | for line in logfile.readlines(): 83 | # Remove brackets from line before splitting entries by comma 84 | cpu_values.append(np.mean([float(v) 85 | for v in line[1:-2].split(',')])) 86 | 87 | cpu_values = np.array(cpu_values) 88 | data['cpu_mean'] = np.mean(cpu_values) 89 | data['cpu_dev'] = np.std(cpu_values) 90 | data['cpu_min'] = np.min(cpu_values) 91 | data['cpu_max'] = np.max(cpu_values) 92 | data['cpu_baseline'] = cpu_values[0] 93 | 94 | return data 95 | -------------------------------------------------------------------------------- /isaac_ros_test/isaac_ros_test/examples/isaac_ros_talker_comparison_test.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION is strictly prohibited. 8 | 9 | """Example to show how a comparison test can be written with isaac_ros_test.""" 10 | 11 | import time 12 | 13 | from isaac_ros_test import IsaacROSBaseTest 14 | import launch_ros 15 | import pytest 16 | import rclpy 17 | from std_msgs.msg import String 18 | 19 | 20 | @pytest.mark.rostest 21 | def generate_test_description(): 22 | """Generate launch description with all ROS2 nodes for testing.""" 23 | nodes = [ 24 | # Normally, we will compare our custom implementation to a reference implementation, 25 | # but for the sake of example here we will compare two separate reference implementations. 26 | launch_ros.actions.Node( 27 | package='demo_nodes_cpp', 28 | executable='talker_loaned_message', 29 | namespace=IsaacROSTalkerComparisonTest.generate_namespace('custom') 30 | ), 31 | launch_ros.actions.Node( 32 | package='demo_nodes_cpp', 33 | executable='talker', 34 | namespace=IsaacROSTalkerComparisonTest.generate_namespace( 35 | 'reference') 36 | ) 37 | ] 38 | 39 | return IsaacROSTalkerComparisonTest.generate_test_description(nodes) 40 | 41 | 42 | class IsaacROSTalkerComparisonTest(IsaacROSBaseTest): 43 | """Comparison tests for demo_nodes_cpp's talker node.""" 44 | 45 | def test_messages_match(self) -> None: 46 | """Expect the messages sent to output topics to match.""" 47 | TIMEOUT = 10 # Seconds before this test times out 48 | # Minimum number of messages that must be received 49 | MESSAGES_RECEIVED_COUNT = 5 50 | 51 | received_messages = {} 52 | 53 | custom_namespace = self.generate_namespace('custom', 'chatter') 54 | reference_namespace = self.generate_namespace('reference', 'chatter') 55 | 56 | custom_sub, reference_sub = self.create_logging_subscribers( 57 | [(custom_namespace, String), 58 | (reference_namespace, String)], 59 | received_messages, 60 | use_namespace_lookup=False, 61 | accept_multiple_messages=True 62 | ) 63 | 64 | try: 65 | # Wait until the nodes publish messages over the ROS topic 66 | end_time = time.time() + TIMEOUT 67 | done = False 68 | while time.time() < end_time: 69 | rclpy.spin_once(self.node, timeout_sec=0.1) 70 | 71 | if all([ 72 | len(messages) >= MESSAGES_RECEIVED_COUNT 73 | for messages in received_messages.values() 74 | ]): 75 | done = True 76 | break 77 | 78 | self.assertTrue(done, 79 | f'Expected {MESSAGES_RECEIVED_COUNT} messages but received' 80 | f'{len(received_messages)} messages on topic.' 81 | ) 82 | 83 | for custom_msg, reference_msg in zip( 84 | received_messages[custom_namespace], received_messages[reference_namespace] 85 | ): 86 | # We ignore the message number typically included in the talker's output to 87 | # avoid synchronization errors 88 | self.assertEqual(custom_msg.data[:-1], reference_msg.data[:-1]) 89 | 90 | finally: 91 | self.node.destroy_subscription(custom_sub) 92 | self.node.destroy_subscription(reference_sub) 93 | -------------------------------------------------------------------------------- /isaac_ros_test/isaac_ros_test/examples/isaac_ros_talker_test.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION is strictly prohibited. 8 | 9 | """Example to show how an integration test can be written with isaac_ros_test.""" 10 | 11 | import time 12 | 13 | from isaac_ros_test import IsaacROSBaseTest 14 | import launch_ros 15 | import pytest 16 | import rclpy 17 | from std_msgs.msg import String 18 | 19 | 20 | @pytest.mark.rostest 21 | def generate_test_description(): 22 | """Generate launch description with all ROS2 nodes for testing.""" 23 | nodes = [ 24 | launch_ros.actions.Node(package='demo_nodes_cpp', 25 | executable='talker', 26 | namespace=IsaacROSTalkerTest.generate_namespace()) 27 | ] 28 | 29 | return IsaacROSTalkerTest.generate_test_description(nodes) 30 | 31 | 32 | class IsaacROSTalkerTest(IsaacROSBaseTest): 33 | """Tests for demo_nodes_cpp's talker node.""" 34 | 35 | def test_messages_received(self) -> None: 36 | """Expect the node to send messages to output topic.""" 37 | TIMEOUT = 10 # Seconds before this test times out 38 | # Minimum number of messages that must be received 39 | MESSAGES_RECEIVED_COUNT = 5 40 | 41 | received_messages = [] 42 | 43 | sub = self.node.create_subscription( 44 | String, 45 | self.generate_namespace('chatter'), 46 | lambda msg: received_messages.append(msg), 47 | 10, 48 | ) 49 | 50 | try: 51 | # Wait until the node publishes messages over the ROS topic 52 | end_time = time.time() + TIMEOUT 53 | done = False 54 | while time.time() < end_time: 55 | rclpy.spin_once(self.node, timeout_sec=0.1) 56 | 57 | if len(received_messages) >= MESSAGES_RECEIVED_COUNT: 58 | done = True 59 | break 60 | 61 | self.assertTrue(done, 62 | f'Expected {MESSAGES_RECEIVED_COUNT} messages but received' 63 | f'{len(received_messages)} messages on topic.' 64 | ) 65 | 66 | finally: 67 | self.node.destroy_subscription(sub) 68 | -------------------------------------------------------------------------------- /isaac_ros_test/isaac_ros_test/isaac_ros_base_test.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION is strictly prohibited. 8 | 9 | """Base test class for all Isaac ROS tests.""" 10 | 11 | import functools 12 | from pathlib import Path 13 | import time 14 | from typing import Any, Callable, Dict, Iterable, Tuple 15 | import unittest 16 | 17 | from cv_bridge import CvBridge 18 | import launch 19 | import launch_testing.actions 20 | import numpy as np 21 | import rclpy 22 | from rclpy.subscription import Subscription 23 | from sensor_msgs.msg import CameraInfo, Image 24 | 25 | 26 | class IsaacROSBaseTest(unittest.TestCase): 27 | """Base class for all Isaac ROS integration tests.""" 28 | 29 | DEFAULT_NAMESPACE = 'isaac_ros_test' 30 | DEFAULT_QOS = 10 31 | 32 | def for_each_test_case(subfolder: Path = '') -> Callable: 33 | """ 34 | Create a decorator to run a test function on each of several test case folders. 35 | 36 | Parameters 37 | ---------- 38 | subfolder : Path, optional 39 | Subfolder under test_cases/ to iterate through, by default '' 40 | 41 | Returns 42 | ------- 43 | Callable 44 | Decorator that will iterate in the specified folder or subfolder 45 | 46 | """ 47 | def test_case_decorator(test_fn: Callable[[Path], None]) -> Callable[[], None]: 48 | """ 49 | Decorate a test function to run on each folder under a specified path. 50 | 51 | Parameters 52 | ---------- 53 | test_fn : Callable[[Path], None] 54 | The test function to run on each case, with the case's path passed in 55 | 56 | Returns 57 | ------- 58 | Callable[[], None] 59 | The wrapped function that iterates over all test cases 60 | 61 | """ 62 | @functools.wraps(test_fn) 63 | def wrapper(self): 64 | for test_folder in (self.filepath / 'test_cases' / subfolder).iterdir(): 65 | if (test_folder / 'SKIP').exists(): # Skip folders with SKIP file 66 | self.node.get_logger().info( 67 | f'Skipping folder: {test_folder}') 68 | else: 69 | self.node.get_logger().info( 70 | f'Starting test for case: {test_folder}') 71 | test_fn(self, test_folder) 72 | return wrapper 73 | 74 | return test_case_decorator 75 | 76 | @classmethod 77 | def generate_namespace(cls, *tokens: Iterable[str], absolute=True) -> str: 78 | """ 79 | Generate a namespace with an optional list of tokens. 80 | 81 | This function is a utility for producing namespaced topic and service names in 82 | such a way that there are no collisions between 'dummy' nodes running for testing 83 | and 'normal' nodes running on the same machine. 84 | 85 | Parameters 86 | ---------- 87 | tokens : Iterable[str] 88 | List of tokens to include in the namespace. Often used to generate 89 | separate namespaces for Isaac ROS and reference implementations. 90 | 91 | absolute: bool 92 | Whether or not to generate an absolute namespace, by default True. 93 | 94 | Returns 95 | ------- 96 | str 97 | The generated namespace as a slash-delimited string 98 | 99 | """ 100 | return ('/' if absolute else '') + '/'.join([cls.DEFAULT_NAMESPACE, *tokens]) 101 | 102 | def generate_namespace_lookup( 103 | self, topic_names: Iterable[str], *tokens: Iterable[str], absolute: bool = True 104 | ) -> None: 105 | """ 106 | Save a lookup dictionary mapping topics from friendly names to namespaced names. 107 | 108 | Parameters 109 | ---------- 110 | topic_names : Iterable[str] 111 | The friendly topic names to produce namespaced names for 112 | tokens : Iterable[str] 113 | List of tokens to include in the namespace. 114 | Passed directly to generate_namespace 115 | absolute : bool, optional 116 | Whether or not to generate an absolute namespace, by default True. 117 | Passed directly to generate_namespace 118 | 119 | """ 120 | self.namespaces = { 121 | topic: self.generate_namespace(*tokens, topic, absolute=absolute) 122 | for topic in topic_names 123 | } 124 | 125 | @classmethod 126 | def generate_test_description( 127 | cls, nodes: Iterable[launch.Action], node_startup_delay: float = 2.0 128 | ) -> launch.LaunchDescription: 129 | """ 130 | Generate a test launch description. 131 | 132 | The nodes included in this launch description will be launched as a test fixture 133 | immediately before the first test in the test class runs. Note that the graph is 134 | NOT shut down or re-launched between tests within the same class. 135 | 136 | Parameters 137 | ---------- 138 | nodes : Iterable[launch.Action] 139 | List of Actions to launch before running the test. 140 | node_startup_delay : float, optional 141 | Seconds to delay by to account for node startup, by default 2.0 142 | 143 | Returns 144 | ------- 145 | launch.LaunchDescription 146 | The LaunchDescription object to launch before running the test 147 | 148 | """ 149 | return launch.LaunchDescription( 150 | nodes + [ 151 | # Start tests after a fixed delay for node startup 152 | launch.actions.TimerAction( 153 | period=node_startup_delay, actions=[launch_testing.actions.ReadyToTest()]) 154 | ] 155 | ) 156 | 157 | def assertImagesEqual( 158 | self, actual: np.ndarray, expected: np.ndarray, threshold_fraction: float = 0.01 159 | ) -> None: 160 | """ 161 | Assert that two images are equal within tolerance. 162 | 163 | Parameters 164 | ---------- 165 | actual : np.ndarray 166 | Actual image received 167 | expected : np.ndarray 168 | Expected image to match against 169 | threshold_fraction : float, optional 170 | The fraction of allowable variation between the images, by default 0.01. 171 | A value of 0 means a pixel-perfect match is required. A value of 1 means 172 | that even the biggest possible difference (full-white against full-black) 173 | will count as a match. 174 | 175 | """ 176 | self.assertTupleEqual(actual.shape, expected.shape) 177 | difference = np.linalg.norm(actual - expected) 178 | threshold_pixels = threshold_fraction * actual.size * 255 179 | self.assertLessEqual( 180 | difference, threshold_pixels, 181 | f'Image difference of {difference} pixels is larger than ' 182 | f'threshold of {threshold_pixels} pixels!' 183 | ) 184 | 185 | def create_logging_subscribers( 186 | self, 187 | subscription_requests: Iterable[Tuple[str, Any]], 188 | received_messages: Dict[str, Iterable], 189 | use_namespace_lookup: bool = True, 190 | accept_multiple_messages: bool = False, 191 | add_received_message_timestamps: bool = False 192 | ) -> Iterable[Subscription]: 193 | """ 194 | Create subscribers that log any messages received to the passed-in dictionary. 195 | 196 | Parameters 197 | ---------- 198 | subscription_requests : Iterable[Tuple[str, Any]] 199 | List of topic names and topic types to subscribe to. 200 | 201 | received_messages : Dict[str, Iterable] 202 | Output dictionary mapping topic name to list of messages received 203 | 204 | use_namespace_lookup : bool 205 | Whether the object's namespace dictionary should be used for topic 206 | namespace remapping, by default True 207 | 208 | accept_multiple_messages : bool 209 | Whether the generated subscription callbacks should accept multiple messages, 210 | by default False 211 | 212 | add_received_message_timestamps : bool 213 | Whether the generated subscription callbacks should add a timestamp to the messages, 214 | by default False 215 | 216 | Returns 217 | ------- 218 | Iterable[Subscription] 219 | List of subscribers, passing the unsubscribing responsibility to the caller 220 | 221 | """ 222 | received_messages.clear() 223 | if accept_multiple_messages: 224 | for topic, _ in subscription_requests: 225 | received_messages[topic] = [] 226 | 227 | def make_callback(topic): 228 | def callback(msg): 229 | if accept_multiple_messages: 230 | if add_received_message_timestamps: 231 | received_messages[topic].append((msg, time.time())) 232 | else: 233 | received_messages[topic].append(msg) 234 | else: 235 | self.assertTrue(topic not in received_messages, 236 | f'Already received a message on topic {topic}!') 237 | received_messages[topic] = msg 238 | 239 | return callback 240 | 241 | subscriptions = [self.node.create_subscription( 242 | msg_type, 243 | self.namespaces[topic] if use_namespace_lookup else topic, 244 | make_callback(topic), 245 | self.DEFAULT_QOS, 246 | ) for topic, msg_type in subscription_requests] 247 | 248 | return subscriptions 249 | 250 | def synchronize_timestamps( 251 | self, 252 | image: Image, 253 | camera_info: CameraInfo 254 | ) -> Tuple[Image, CameraInfo]: 255 | """ 256 | Create subscribers that log any messages received to the passed-in dictionary. 257 | 258 | Parameters 259 | ---------- 260 | image : Image 261 | Image message to synchronize timestamp with camera_info 262 | 263 | camera_info : CameraInfo 264 | CameraInfo to synchronize timestamp with image 265 | 266 | Returns 267 | ------- 268 | Tuple[Image, CameraInfo] 269 | Same input image and camera info but now with equal timestamps 270 | 271 | """ 272 | timestamp = self.node.get_clock().now().to_msg() 273 | image.header.stamp = timestamp 274 | camera_info.header.stamp = timestamp 275 | 276 | return image, camera_info 277 | 278 | @classmethod 279 | def setUpClass(cls) -> None: 280 | """Set up before first test method.""" 281 | # Initialize the ROS context for the test node 282 | rclpy.init() 283 | 284 | @classmethod 285 | def tearDownClass(cls) -> None: 286 | """Tear down after last test method.""" 287 | # Shutdown the ROS context 288 | rclpy.shutdown() 289 | 290 | def setUp(self) -> None: 291 | """Set up before each test method.""" 292 | # Create a ROS node for tests 293 | self.node = rclpy.create_node( 294 | 'isaac_ros_base_test_node', namespace=self.generate_namespace()) 295 | self.bridge = CvBridge() 296 | 297 | def tearDown(self) -> None: 298 | """Tear down after each test method.""" 299 | self.node.destroy_node() 300 | -------------------------------------------------------------------------------- /isaac_ros_test/isaac_ros_test/json_conversion.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION is strictly prohibited. 8 | 9 | """Utilities to convert ROS2 messages to and from human-readable JSON.""" 10 | 11 | import json 12 | from pathlib import Path 13 | from typing import Dict, Tuple 14 | 15 | import cv2 16 | from cv_bridge import CvBridge 17 | from sensor_msgs.msg import CameraInfo, Image 18 | 19 | 20 | class JSONConversion: 21 | """Class for JSON conversion utilities.""" 22 | 23 | @staticmethod 24 | def load_from_json(json_filepath: Path) -> Dict: 25 | """ 26 | Load a dictionary from a JSON filepath. 27 | 28 | Parameters 29 | ---------- 30 | json_filepath : Path 31 | The path to a JSON file containing the object 32 | 33 | Returns 34 | ------- 35 | Dict 36 | Generated dictionary containing object fields 37 | 38 | """ 39 | with open(json_filepath) as json_file: 40 | return json.load(json_file) 41 | 42 | @staticmethod 43 | def save_to_json(obj: Dict, json_filepath: Path) -> None: 44 | """ 45 | Save an arbitrary object to a JSON filepath. 46 | 47 | Parameters 48 | ---------- 49 | obj : Dict 50 | The object to save, as a dictionary 51 | 52 | json_filepath : Path 53 | The path to the JSON file to save the object to 54 | 55 | """ 56 | with open(json_filepath, 'w+') as json_file: 57 | json.dump(obj, json_file, indent=2) 58 | 59 | @staticmethod 60 | def load_camera_info_from_json(json_filepath: Path) -> CameraInfo: 61 | """ 62 | Load a CameraInfo message from a JSON filepath. 63 | 64 | Parameters 65 | ---------- 66 | json_filepath : Path 67 | The path to a JSON file containing the CameraInfo fields 68 | 69 | Returns 70 | ------- 71 | CameraInfo 72 | Generated CameraInfo message 73 | 74 | """ 75 | camera_info_json = JSONConversion.load_from_json(json_filepath) 76 | 77 | camera_info = CameraInfo() 78 | camera_info.header.frame_id = camera_info_json['header']['frame_id'] 79 | camera_info.width = camera_info_json['width'] 80 | camera_info.height = camera_info_json['height'] 81 | camera_info.distortion_model = camera_info_json['distortion_model'] 82 | camera_info.d = camera_info_json['D'] 83 | camera_info.k = camera_info_json['K'] 84 | camera_info.r = camera_info_json['R'] 85 | camera_info.p = camera_info_json['P'] 86 | 87 | return camera_info 88 | 89 | @staticmethod 90 | def save_camera_info_to_json(camera_info: CameraInfo, json_filepath: Path) -> None: 91 | """ 92 | Save a CameraInfo message to a JSON filepath. 93 | 94 | Parameters 95 | ---------- 96 | camera_info : CameraInfo 97 | The message to save to JSON 98 | 99 | json_filepath : Path 100 | The path to save the JSON file 101 | 102 | """ 103 | camera_info_json = {} 104 | 105 | camera_info_json['header'] = {} 106 | camera_info_json['header']['frame_id'] = camera_info.header.frame_id 107 | 108 | camera_info_json['width'] = camera_info.width 109 | camera_info_json['height'] = camera_info.height 110 | camera_info_json['distortion_model'] = camera_info.distortion_model 111 | 112 | camera_info_json['D'] = camera_info.d.tolist() 113 | camera_info_json['K'] = camera_info.k.tolist() 114 | camera_info_json['R'] = camera_info.r.tolist() 115 | camera_info_json['P'] = camera_info.p.tolist() 116 | 117 | JSONConversion.save_to_json(camera_info_json, json_filepath) 118 | 119 | @staticmethod 120 | def load_image_from_json(json_filepath: Path) -> Image: 121 | """ 122 | Load an Image message from a JSON filepath. 123 | 124 | Parameters 125 | ---------- 126 | json_filepath : Path 127 | The path to a JSON file containing the Image fields 128 | 129 | Returns 130 | ------- 131 | Image 132 | Generated Image message 133 | 134 | """ 135 | image_json = JSONConversion.load_from_json(json_filepath) 136 | 137 | # Load the main image data from a JSON-specified image file 138 | image = CvBridge().cv2_to_imgmsg(cv2.imread( 139 | str(json_filepath.parent / image_json['image']))) 140 | 141 | image.encoding = image_json['encoding'] 142 | 143 | return image 144 | 145 | @staticmethod 146 | def save_image_to_json( 147 | image: Image, json_filepath: Path, image_filename: str = 'image_raw.jpg') -> None: 148 | """ 149 | Save an Image message to a JSON filepath. 150 | 151 | Parameters 152 | ---------- 153 | image : Image 154 | The message to save to JSON 155 | 156 | json_filepath : Path 157 | The path to save the JSON file 158 | 159 | image_filename : str 160 | The filename to save the image data to, by default image_raw.jpg 161 | 162 | """ 163 | # Load the main image data from a JSON-specified image file 164 | cv2.imwrite(str(json_filepath.parent / 165 | image_filename), CvBridge().imgmsg_to_cv2(image)) 166 | 167 | image_json = {} 168 | image_json['image'] = image_filename 169 | image_json['encoding'] = image.encoding 170 | 171 | JSONConversion.save_to_json(image_json, json_filepath) 172 | 173 | @staticmethod 174 | def load_chessboard_image_from_json(json_filepath: Path) -> Tuple[Image, Tuple[int, int]]: 175 | """ 176 | Load a chessboard Image message from a JSON filepath. 177 | 178 | Parameters 179 | ---------- 180 | json_filepath : Path 181 | The path to a JSON file containing the Image fields 182 | 183 | Returns 184 | ------- 185 | Tuple[Image, Tuple[int, int]] 186 | Generated Image message and tuple of chessboard dimensions as (width, height) 187 | 188 | """ 189 | image_json = JSONConversion.load_from_json(json_filepath) 190 | 191 | # Load the chessboard dimensions from JSON 192 | chessboard_dimensions = ( 193 | image_json['chessboard']['width'], image_json['chessboard']['height']) 194 | 195 | # Return the loaded image along with the dimensions 196 | return JSONConversion.load_image_from_json(json_filepath), \ 197 | chessboard_dimensions 198 | -------------------------------------------------------------------------------- /isaac_ros_test/isaac_ros_test/profiler.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION is strictly prohibited. 8 | 9 | """Profiler base class to measure the performance of benchmark tests.""" 10 | 11 | from abc import ABC, abstractmethod 12 | from datetime import datetime 13 | from pathlib import Path 14 | from typing import Dict, Tuple 15 | 16 | 17 | class Profiler(ABC): 18 | """Profiler base class to measure the performance of benchmark tests.""" 19 | 20 | @abstractmethod 21 | def __init__(self): 22 | """Construct profiler.""" 23 | self.is_running = False 24 | 25 | # Logfile path is generated once start_profiling() is called 26 | self.logfile_path = None 27 | 28 | @abstractmethod 29 | def start_profiling(self, log_dir: Path) -> None: 30 | """ 31 | Run profiling program to keep track of performance metrics. 32 | 33 | Parameters 34 | ---------- 35 | log_dir : Path 36 | Path to write the logs to 37 | 38 | """ 39 | assert not self.is_running, 'Profiler has already been started!' 40 | self.is_running = True 41 | 42 | # Create logfile parent folders if they don't exist already 43 | log_dir.mkdir(parents=True, exist_ok=True) 44 | 45 | self.logfile_path = log_dir / \ 46 | f'{type(self).__name__}_{datetime.timestamp(datetime.now())}.log' 47 | 48 | return self.logfile_path 49 | 50 | @abstractmethod 51 | def stop_profiling(self) -> None: 52 | """Stop profiling after running start_profiling().""" 53 | assert self.is_running, 'Profiler was not yet started!' 54 | self.is_running = False 55 | 56 | @abstractmethod 57 | def get_results(self, logfile_path: Path = None) -> Dict[str, Tuple[str, str]]: 58 | """ 59 | Return a labelled dictionary of results parsed from the logfile. 60 | 61 | This should only be called after calling start_profiling() and stop_profiling(). 62 | 63 | Returns 64 | ------- 65 | Dict[str, str] 66 | Dictionary mapping label: (value, units) 67 | 68 | """ 69 | return 70 | -------------------------------------------------------------------------------- /isaac_ros_test/isaac_ros_test/tegrastats_profiler.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION is strictly prohibited. 8 | 9 | """Tegrastats profiler class to measure CPU and GPU performance of benchmark tests.""" 10 | 11 | from datetime import datetime 12 | import os 13 | import re 14 | import subprocess 15 | from typing import Dict 16 | 17 | import numpy as np 18 | 19 | from .profiler import Profiler 20 | 21 | 22 | class TegrastatsProfiler(Profiler): 23 | """Tegrastats profiler class to measure CPU and GPU performance of benchmark tests.""" 24 | 25 | def __init__(self, command_path: str = '/tegrastats'): 26 | """ 27 | Construct Tegrastats profiler. 28 | 29 | Parameters 30 | ---------- 31 | command_path : str 32 | Path to invoke the profiler binary 33 | 34 | """ 35 | self.tegrastats_path = command_path 36 | self.profiler_running = False 37 | 38 | def start_profiling(self, interval: float, log_dir: str) -> str: 39 | """ 40 | Run tegrastats profiling program to keep track of performance metrics. 41 | 42 | Parameters 43 | ---------- 44 | interval : float 45 | Interval for the profiler 46 | log_dir : str 47 | Path to write the logs to 48 | 49 | Returns 50 | ------- 51 | str 52 | The path to the file where the profiler will write its logs to. If start_profiling() 53 | is called when the profiler is still running, return an empty string 54 | 55 | """ 56 | if not self.profiler_running: 57 | file_name = str(datetime.timestamp(datetime.now())) + '.txt' 58 | file_path = os.path.join(log_dir, file_name) 59 | subprocess.Popen([self.tegrastats_path, '--interval', 60 | str(interval), '--logfile', file_path]) 61 | self.profiler_running = True 62 | return file_path 63 | else: 64 | print('Profiler is already running.') 65 | return '' 66 | 67 | def stop_profiling(self): 68 | """Stop profiling after running start_profiling().""" 69 | if self.profiler_running: 70 | subprocess.Popen([self.tegrastats_path, '--stop']) 71 | self.profiler_running = False 72 | 73 | def print_profiling_results(self, logfile_path: str) -> Dict[str, float]: 74 | """ 75 | Parse Tegrastats profiling results from the logs and print them. 76 | 77 | This should only be called after calling start_profiling() and stop_profiling(). 78 | 79 | Parameters 80 | ---------- 81 | logfile_path : str 82 | The path to the logfile that will be parsed 83 | 84 | Returns 85 | ------- 86 | Dict[str, float] 87 | Dictionary where each key is the metric name, and the value is the metric's value 88 | 89 | """ 90 | data = {} 91 | gpu_values = [] 92 | cpu_values = [] 93 | with open(logfile_path) as file: 94 | for line in file.readlines(): 95 | fields = line.split() 96 | GPU = fields[13] 97 | CPU = fields[9][1:-1] 98 | gpu_values.append(float(GPU[:-1])) 99 | cpu_array = re.split('%@[0-9]+[,]?', CPU) 100 | cpu_array = [float(value) for value in cpu_array[:-1]] 101 | cpu_values.append(np.mean(cpu_array)) 102 | data['gpu_mean'] = np.mean(gpu_values) 103 | data['gpu_deviation'] = np.std(gpu_values) 104 | data['gpu_max'] = max(gpu_values) 105 | data['gpu_min'] = min(gpu_values) 106 | data['cpu_mean'] = np.mean(cpu_values) 107 | data['cpu_dev'] = np.std(cpu_values) 108 | data['cpu_max'] = max(cpu_values) 109 | data['cpu_min'] = min(cpu_values) 110 | return data 111 | -------------------------------------------------------------------------------- /isaac_ros_test/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | 15 | isaac_ros_test 16 | 0.9.0 17 | Isaac ROS testing utilities 18 | 19 | Hemal Shah 20 | JetPack EULA 21 | https://developer.nvidia.com/blog/accelerating-ai-modules-for-ros-and-ros-2-on-jetson/ 22 | Ethan Yu 23 | Isaac Chang 24 | Jaiveer Singh 25 | 26 | ament_flake8 27 | ament_pep257 28 | python3-pytest 29 | 30 | 31 | ament_python 32 | 33 | 34 | -------------------------------------------------------------------------------- /isaac_ros_test/resource/isaac_ros_test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NVIDIA-AI-IOT/isaac_ros_common/034ee8b18ec363ddc85a75d8464998cb5a6c6bfa/isaac_ros_test/resource/isaac_ros_test -------------------------------------------------------------------------------- /isaac_ros_test/setup.cfg: -------------------------------------------------------------------------------- 1 | [develop] 2 | script_dir=$base/lib/isaac_ros_test 3 | [install] 4 | install_scripts=$base/lib/isaac_ros_test 5 | -------------------------------------------------------------------------------- /isaac_ros_test/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | package_name = 'isaac_ros_test' 4 | 5 | setup( 6 | name=package_name, 7 | version='0.1.0', 8 | packages=[package_name], 9 | data_files=[ 10 | ('share/ament_index/resource_index/packages', 11 | ['resource/' + package_name]), 12 | ('share/' + package_name, ['package.xml']), 13 | ], 14 | install_requires=['setuptools'], 15 | zip_safe=True, 16 | maintainer='Jaiveer Singh', 17 | maintainer_email='jaiveers@nvidia.com', 18 | description='Isaac ROS testing utilities', 19 | license='MIT', 20 | tests_require=['pytest'], 21 | entry_points={ 22 | 'console_scripts': [ 23 | ], 24 | }, 25 | ) 26 | -------------------------------------------------------------------------------- /isaac_ros_test/test/test_flake8.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from ament_flake8.main import main_with_errors 16 | import pytest 17 | 18 | 19 | @pytest.mark.flake8 20 | @pytest.mark.linter 21 | def test_flake8(): 22 | rc, errors = main_with_errors(argv=[]) 23 | assert rc == 0, \ 24 | 'Found %d code style errors / warnings:\n' % len(errors) + \ 25 | '\n'.join(errors) 26 | -------------------------------------------------------------------------------- /isaac_ros_test/test/test_pep257.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from ament_pep257.main import main 16 | import pytest 17 | 18 | 19 | @pytest.mark.linter 20 | @pytest.mark.pep257 21 | def test_pep257(): 22 | rc = main(argv=['.']) 23 | assert rc == 0, 'Found code style errors / warnings' 24 | -------------------------------------------------------------------------------- /scripts/README.md: -------------------------------------------------------------------------------- 1 | # Isaac ROS Dev Build Scripts 2 | 3 | 4 | For Jetson or x86_64: 5 | `run_dev.sh` creates a dev environment with ROS2 installed. By default, the directory `/workspace` in the container is mapped from `~/workspaces/isaac_ros-dev` on the host machine, but the directory the container is mapping from can be replaced by running the script and passing a path as the first argument: 6 | `run_dev.sh ` 7 | -------------------------------------------------------------------------------- /scripts/run_dev.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # 3 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # NVIDIA CORPORATION and its licensors retain all intellectual property 6 | # and proprietary rights in and to this software, related documentation 7 | # and any modifications thereto. Any use, reproduction, disclosure or 8 | # distribution of this software and related documentation without an express 9 | # license agreement from NVIDIA CORPORATION is strictly prohibited. 10 | 11 | ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 12 | source $ROOT/utils/print_color.sh 13 | 14 | function usage() { 15 | print_info "Usage: run_dev.sh" {isaac_ros_dev directory path OPTIONAL} 16 | print_into "Copyright (c) 2021, NVIDIA CORPORATION." 17 | } 18 | 19 | ISAAC_ROS_DEV_DIR="$1" 20 | if [[ -z "$ISAAC_ROS_DEV_DIR" ]]; then 21 | ISAAC_ROS_DEV_DIR="$HOME/workspaces/isaac_ros-dev" 22 | print_warning "isaac_ros_dev not specified, assuming $ISAAC_ROS_DEV_DIR" 23 | else 24 | shift 1 25 | fi 26 | 27 | ON_EXIT=() 28 | function cleanup { 29 | for command in "${ON_EXIT[@]}" 30 | do 31 | $command 32 | done 33 | } 34 | trap cleanup EXIT 35 | 36 | pushd . 37 | cd $ROOT 38 | ON_EXIT+=("popd") 39 | 40 | PLATFORM="$(uname -m)" 41 | 42 | BASE_NAME="isaac_ros_dev-$PLATFORM" 43 | CONTAINER_NAME="$BASE_NAME-container" 44 | 45 | # Arguments for docker build 46 | BUILD_ARGS+=("--build-arg USERNAME="admin"") 47 | BUILD_ARGS+=("--build-arg USER_UID=`id -u`") 48 | BUILD_ARGS+=("--build-arg USED_GID=`id -g`") 49 | 50 | # Check if GPU is installed 51 | if [[ $PLATFORM == "x86_64" ]]; then 52 | if type nvidia-smi &>/dev/null; then 53 | GPU_ATTACHED=(`nvidia-smi -a | grep "Attached GPUs"`) 54 | if [ ! -z $GPU_ATTACHED ]; then 55 | BUILD_ARGS+=("--build-arg HAS_GPU="true"") 56 | fi 57 | fi 58 | fi 59 | 60 | # Build image 61 | print_info "Building $PLATFORM base as image: $BASE_NAME" 62 | docker build -f $ROOT/../docker/Dockerfile.$PLATFORM.base \ 63 | -t $BASE_NAME \ 64 | ${BUILD_ARGS[@]} \ 65 | $ROOT/../docker 66 | 67 | # Map host's display socket to docker 68 | DOCKER_ARGS+=("-v /tmp/.X11-unix:/tmp/.X11-unix") 69 | DOCKER_ARGS+=("-e DISPLAY") 70 | DOCKER_ARGS+=("-e NVIDIA_VISIBLE_DEVICES=all") 71 | DOCKER_ARGS+=("-e NVIDIA_DRIVER_CAPABILITIES=all") 72 | 73 | if [[ $PLATFORM == "aarch64" ]]; then 74 | DOCKER_ARGS+=("-v /opt/nvidia:/opt/nvidia") 75 | DOCKER_ARGS+=("-v /usr/bin/tegrastats:/usr/bin/tegrastats") 76 | DOCKER_ARGS+=("-v /usr/share/vpi1:/usr/share/vpi1") 77 | DOCKER_ARGS+=("-v /usr/lib/aarch64-linux-gnu/tegra:/usr/lib/aarch64-linux-gnu/tegra") 78 | DOCKER_ARGS+=("-v /usr/local/cuda-10.2/targets/aarch64-linux/lib:/usr/local/cuda-10.2/targets/aarch64-linux/lib") 79 | DOCKER_ARGS+=("-v /usr/lib/aarch64-linux-gnu/tegra-egl:/usr/lib/aarch64-linux-gnu/tegra-egl") 80 | DOCKER_ARGS+=("-v /usr/lib/aarch64-linux-gnu/libcudnn.so.8.2.1:/usr/lib/aarch64-linux-gnu/libcudnn.so.8.2.1") 81 | DOCKER_ARGS+=("-v /dev/video*:/dev/video*") 82 | fi 83 | 84 | # Run container from image 85 | print_info "Running $CONTAINER_NAME" 86 | docker run -it --rm \ 87 | --privileged --network host \ 88 | ${DOCKER_ARGS[@]} \ 89 | -v $ISAAC_ROS_DEV_DIR:/workspaces/isaac_ros-dev \ 90 | --name "$CONTAINER_NAME" \ 91 | --gpus all \ 92 | --user="admin" \ 93 | --entrypoint /home/admin/workspace-entrypoint.sh \ 94 | $@ \ 95 | $BASE_NAME \ 96 | /bin/bash 97 | 98 | 99 | -------------------------------------------------------------------------------- /scripts/utils/print_color.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # 3 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # NVIDIA CORPORATION and its licensors retain all intellectual property 6 | # and proprietary rights in and to this software, related documentation 7 | # and any modifications thereto. Any use, reproduction, disclosure or 8 | # distribution of this software and related documentation without an express 9 | # license agreement from NVIDIA CORPORATION is strictly prohibited. 10 | 11 | function print_color { 12 | tput setaf $1 13 | echo "$2" 14 | tput sgr0 15 | } 16 | 17 | function print_error { 18 | print_color 1 "$1" 19 | } 20 | 21 | function print_warning { 22 | print_color 3 "$1" 23 | } 24 | 25 | function print_info { 26 | print_color 2 "$1" 27 | } 28 | --------------------------------------------------------------------------------