LibCu Software Library

The LibCu C++/Java software library supports Copperforge devices including the Lasershark (Cu//2A21). Both online and offline installations are supported.

LibCu follows WPILib/FRC vendor library standards and is compatible with WPILib 2020.+

Installation

Warning

LibCu is currently C++/Java only, and is not yet available for LabVIEW

Online Installation

If your development computer is connected to the internet, you should use the online method to install the LibCu C++/Java API:

  1. Open your robot project in VSCode.

  2. Click the WPILib icon in the top right or press Ctrl+Shift+P to open the WPILib/VS Code Command Palette.

  3. Select Manage Vendor Libraries.

  4. Select Install new library (online).

  5. Enter the following installation URL and press Enter:

Offline Installation

  1. Download the latest LibCu C++/Java API from the following URL:

  2. Download and unzip the file into the C:\Users\Public\wpilib\2020\ directory:

    C:\Users\Public\wpilib\2020\maven

    C:\Users\Public\wpilib\2020\vendordeps

  3. Follow the offline installation instructions on WPILib’s FRC-Docs Adding an Offline-installed Library page.

API Docs

namespace libcu
{
class Lasershark : public frc::Sendable,
                   public frc::SendableHelper<Lasershark>
{
public:
    /**
     * Construct a new Lasershark on a given digital input channel.
     *
     * @param channel The channel to which to attach.
     */
    explicit Lasershark(int channel);

    /**
     * Construct a new Lasershark attached to a DigitalSource object.
     *
     * @param source The digital source to which to attach.
     */
    explicit Lasershark(frc::DigitalSource &source);

    /**
     * Construct a new Lasershark attached to a DigitalSource object.
     *
     * @param source The digital source to which to attach.
     */
    explicit Lasershark(frc::DigitalSource *source);

    /**
     * Construct a new Lasershark attached to a DigitalSource object.
     *
     * @param source The digital source to which to attach.
     */
    explicit Lasershark(std::shared_ptr<frc::DigitalSource> source);

    /**
     * Get the distance reported by the LiDAR sensor. See WPILib Units library guide.
     */
    units::foot_t GetDistance();
};
} // namespace libcu
package com.cuforge.libcu;

public class Lasershark implements Sendable {

    /**
     * Construct a new Lasershark on a given digital input channel.
     *
     * @param channel The channel to which to attach.
     */
    public Lasershark(int channel);

    /**
     * Construct a new Lasershark attached to a DigitalSource object.
     *
     * @param source The digital source to which to attach.
     */
    public Lasershark(DigitalSource source);

    /**
     * Get the distance reported by the LiDAR sensor in feet.
     */
    public double getDistanceFeet();

    /**
     * Get the distance reported by the LiDAR sensor in inches.
     */
    public double getDistanceInches();

    /**
     * Get the distance reported by the LiDAR sensor in centimeters.
     */
    public double getDistanceCentimeters();

    /**
     * Get the distance reported by the LiDAR sensor in meters.
     */
    public double getDistanceMeters();
}