Nom : rvizDisplay.py (rvizdisplay.py)
Créateur : Edouard Capellier
Taille : 2.03Ko
Création : 18/02/2021 14:17
Licence : Creative Commons (CC BY 4.0)
Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors.
Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public.
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
Section 1 – Definitions.
Section 2 – Scope.
Section 3 – License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
If You Share the Licensed Material (including in modified form), You must:
Section 4 – Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
Section 5 – Disclaimer of Warranties and Limitation of Liability.
Section 6 – Term and Termination.
Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
Section 7 – Other Terms and Conditions.
Section 8 – Interpretation.
Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
Creative Commons may be contacted at creativecommons.org.
import rospy import numpy as np from sensor_msgs.msg import PointCloud2, PointField import glob import os NODE_NAME = "lidar_road_labels" OUT_TOPIC = "labelled_scan" FRAME_NAME = "velodyne" HEIGHT = 32 WIDTH = 1800 rospy.init_node(NODE_NAME) pc_pub = rospy.Publisher(OUT_TOPIC, PointCloud2, queue_size=10) msg = PointCloud2() msg.header.frame_id = FRAME_NAME msg.fields = [PointField('x', 0, PointField.FLOAT32, 1), PointField('y', 4, PointField.FLOAT32, 1), PointField('z', 8, PointField.FLOAT32, 1), PointField('ro', 12, PointField.FLOAT32, 1), PointField('phi', 16, PointField.FLOAT32, 1), PointField('theta', 20, PointField.FLOAT32, 1), PointField('intensity', 24, PointField.FLOAT32, 1), PointField('validity', 28, PointField.FLOAT32, 1), PointField('label', 32, PointField.FLOAT32, 1)] msg.point_step = 36 msg.is_bigendian = False msg.is_dense = True msg.height, msg.width = HEIGHT, WIDTH msg.row_step = msg.point_step * msg.width locations = os.listdir("./") locationsFinal = list(locations) print("Available locations:") idx = 0 for location in locations: if(os.path.isdir(os.path.join("./",location))): idx = idx+1 print(str(idx)+". " + location) else: locationsFinal.remove(location) n = 0 print("Type the index of the location you want to display") while((n<1) or (n>len(locationsFinal))): valueFromUser = raw_input() if(valueFromUser.isdigit()): n = int(valueFromUser) else: n = 0 if((n<1) or (n>len(locationsFinal))): print("Invalid value entered. Please enter a valid location index.") print("Selected "+locationsFinal[n-1]+". Iterating over the labelled scans.") scans = os.listdir("./"+locationsFinal[n-1]+"/scans") for scan in scans: print("Displaying scan "+scan[:-4]) msg.data = np.load("./"+locationsFinal[n-1]+"/scans/"+scan)[:,12:1812,:].tostring() msg.header.stamp = rospy.Time.now() pc_pub.publish(msg) raw_input("Press enter for the next scan")