Git Product home page Git Product logo

2m-distance-sensor's Introduction

REV Robotics 2M Distance Sensor

roboRIO library for the REV Robotics 2M Distance Sensor

Installing For C++/Java

Download the latest REV-2m-Distance-Sensor-roboRIO-SDK-[version].zip from the release tab and unzip it.

Inside REV-2m-Distance-Sensor-roboRIO-SDK-[version] there will be vendordeps and maven folders. Copy the file REV2mDistanceSensor.json under vendordeps to the frc vendordeps folder on your machine. It is typically located in the following places:

  • Windows: C:\Users\Public\wpilib\2024\vendordeps
  • Mac/Linux: ~/wpilib/2024/vendordeps

Next, merge the maven folder with the frc maven folder on your machine, typically located at:

  • Windows: C:\Users\Public\wpilib\2024\maven
  • Mac/Linux: ~/wpilib/2024/maven

In order to use these libraries in your robot code, open a project in VsCode.

  • Press Ctrl-Shift-P to open the WPI commands window.
  • Select WPILib: Manage Vendor Libraries
  • Select Install new libraries (offline)
  • Select the check box next to REV2mDistanceSensor and press OK

The REV2mDistance sensor library can now be used in your code.

Installing For LabVIEW

Download the rev-2m-distance-sensor_1.0.0-0_windows_x64.nipkg installer under the releases tab. Simply run the installer and you will have access to REV2mDistanceSensor functions in your projects.

Examples

Examples for this library can be found in the Examples folder for both C++ and Java.

2m-distance-sensor's People

Contributors

jfabellera avatar noahandrews avatar ryanj1234 avatar thefallen127 avatar willtoth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

2m-distance-sensor's Issues

libDistanceSensorDriver not getting downloaded to Roborio

We ran into a problem where the libdistanceSensorDriver was not getting downloaded to the Roboio. We fixed the problem by editing the Rev2mDistanceSensor.json and set "sharedLibary" to True for this library. The Gradle build then copied the file to the Roborio. Not sure this was the correct method but it did work. Others may be having this issue.

File path for I2C.h should be <hal/I2C.h

As part of the porting for 2020, please change the include file path for I2C.h. It should be <hal/I2C.h> rather than <HAL/I2C.h>. I am able to compile things using the library successfully on Windows (case-insensitive filenames) but not on linux.

In file included from /home/hauser/sciborgs-2020/robot-2020/robot/src/subsystems/the_robot/trenchController.h:49:0,
                 from /home/hauser/sciborgs-2020/robot-2020/robot/src/subsystems/the_robot/TheRobotSetup.cpp:32:
/home/hauser/.gradle/caches/transforms-2/files-2.1/deb540110fe5084595fa2d5c06e4659b/DistanceSensor-cpp-0.0.6-headers/rev/Rev2mDistanceSensor.h:38:10: fatal error: HAL/I2C.h: No such file or directory
 #include <HAL/I2C.h>
          ^~~~~~~~~~~
compilation terminated.

Having a working vendordep.json for 2020 for this library and having it work on linux would greatly simplify our development and continuous integration tooling. Thanks.

Originally posted by @chauser in #6 (comment)

Is this published to maven?

A RobotPy user would like us to support this sensor, but the provided vendor json doesn't point at valid artifacts.

Allow changingI2C address of the sensor

Hello. Can we add a parameter to the constructor of the Rev2mDistanceSensor class to to override the I2C address? We figured out a way to change the address of the device at power-up so this would be useful to enable multiple devices on the same I2C bus.

ST source needs abs() modification to compile for x86

When compiling for x86, compiler errors out since call to function abs() is ambiguous. Current workaround is to cast args in abs() as double for the x86 build. The compiler for the x86 build uses include -D__WINDOWS__ which is used with #ifdef to create a separate call to abs() for x86 only. For native roboRIO builds abs() is left untouched.

xTalkCorrection = abs((double)diff1_mcps/diff2_mcps);

LabVIEW does not load shared library correctly

2m Distance Sensor depends on libDistanceSensorDriver.so, which is the compiled VL53L0X vendor driver. This is copied over to the roboRIO when a LabVIEW project is run, but any function calls made to this library will fail due to it not being found if a user has only used LabVIEW for the 2m Distance Sensor.

If a project is created in C++/Java using the 2m Distance Sensor, the gradle deploy process copies this shared library over, gives it the proper permissions and runs ldconfig to link the library. After doing this, any LabVIEW project can use the shared library.

This is currently noted as a workaround for installing LabVIEW, but should be fixed so users do not have to load a C++/Java project to their roboRIO before running LabVIEW.

Python example?

I'm looking to wire up the 2m sensors to a Raspberry Pi for an 8th grade intro to engineering class. Any tips or sample code for reading the sensor via Python?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.