Skip to content

westonrobot/wrp_ros2

Repository files navigation

wrp_ros2

About

This package contains a minimal wrapper around wrp_sdk and provides a ROS2 interface to hardware platforms from Weston Robot. Please first check if your device and environment are supported by the SDK and this ROS package before proceeding:

SDK Documentation and Sample Code can be found here

Supported Environments:

  • Architecture: x86_64/arm64
  • OS: Ubuntu 22.04
  • ROS: Humble

Supported Robots:

Supported Peripherals:

  • Power Regulator V2.1
  • Ultrasonic Sensor
  • Hipnuc and WitMotion IMU
  • NMEA-compatible GPS Receiver
  • Lift Controller

More details can be found in the README inside individual src sub-folders

Getting the package

Install dependencies

  • wrp_sdk >= v1.3.0 ... < v1.5.0 : please follow setup instructions from here

  • Peripheral driver dependencies (optional if you are not using peripherals):

    $ sudo apt-get install -y software-properties-common 
    $ sudo add-apt-repository ppa:lely/ppa
    $ sudo apt-get install -y pkg-config liblely-coapp-dev liblely-co-tools

Build the package

  • Clone the packages into a colcon workspace and compile/source.
    (the following instructions assume your colcon workspace is at: ~/ros2_ws/src)

    mkdir -p ~/ros2_ws/src
    cd ~/ros2_ws/src
    git clone https://github.com/westonrobot/wrp_ros2.git
    cd ..
    colcon build --symlink-install
    . install/setup.bash

Setup CAN-To-USB adapter

Only needed if you are using a CAN robot or peripheral

  1. Enable gs_usb kernel module

    $ sudo modprobe gs_usb
    
  2. Bringup can device

    NOTE: Adjust CAN bitrate accordingly. Refer to the tables in the mobile_base README and peripheral README for the correct bitrate.

    $ sudo ip link set can0 up type can bitrate <bitrate>
    $ sudo ip link set can0 txqueuelen 1000
    
  3. If no error occured during the previous steps, you should be able to see the can device now by using command

    $ ifconfig -a
    
  4. Install and use can-utils to test the hardware

    $ sudo apt install can-utils
    
  5. Testing command

    # receiving data from can0
    $ candump can0
    # send data to can0
    $ cansend can0 001#1122334455667788
    

Scripts are provided here for convenience. You can run "./setup_can2usb.bash" for the first-time setup and run "./bringup_can2usb_1m.bash" to bring up the device each time you unplug and re-plug the adapter.

Example Usage

You can find more information about robot base control from this page.

You may need to change run time parameters by editing the corresponding launch file

  1. Mobile Base Node (and variants)

    ros2 launch wrp_sdk_robot mobile_base.launch.py
  2. Power Regulator Node

    ros2 launch wrp_sdk_periph power_regulator.launch.py
  3. GPS Receiver Node

    ros2 launch wrp_sdk_periph gps_receiver_launch.py 
  4. IMU Sensor Node

    ros2 launch wrp_sdk_periph imu_sensor_launch.py 
  5. Ultrasonic Sensor Node

    ros2 launch wrp_sdk_periph ultrasonic_sensor.launch.py