umdlife / psdk_ros2

This repository is a ROS 2 wrapper for the DJI PSDK libraries.

Home Page:https://umdlife.github.io/psdk_ros2/documentation/Introduction.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

psdk_params.yaml not loaded properly

andre-f-moura opened this issue · comments

Tell us about your environment

  • Ubuntu version: 20.04 LTS
  • Docker Version: NA
  • ROS/ROS2 version: Foxy Fitzroy
  • Commit hash: f77a730

Steps to reproduce issue

Following the getting started procedure:

mkdir -p ~/psdk_ros2_ws/src
cd ~/psdk_ros2_ws/src
# Clone the psdk_ros2 wrapper and the Payload-SDK 
git clone https://github.com/umdlife/psdk_ros2.git
git clone https://github.com/dji-sdk/Payload-SDK.git

# Checkout the proper version of the Payload-SDK (currently the wrapper is compatible with the latest release v3.5)
cd Payload-SDK
git checkout release/v3.5

# Before building, check the Dependencies section and make sure you have everything installed
# Build the code
cd ~/psdk_ros2_ws
colcon build --packages-skip entry	# Skip the build corresponding to DJI PSDK sample code

Then, changed the psdk_params.yaml file to:

/**:
  psdk_wrapper_node:
    ros__parameters:
      app_name: "*****************"
      app_id: "*****************"
      app_key: "*****************"
      app_license: "*****************"
      developer_account: "*****************"
      baudrate: "921600"
      hardware_connection: "DJI_USE_UART_AND_USB_BULK_DEVICE"
      uart_dev_1: "/dev/ttyTHS0"
      uart_dev_2: "/dev/ttyACM0"

      imu_frame: "psdk_imu_link"
      body_frame: "psdk_base_link"
      map_frame: "psdk_map_enu"
      gimbal_frame: "psdk_gimbal_link"
      camera_frame: "psdk_camera_link"
      publish_transforms: true
  
      data_frequency: # Options are: 1, 5, 10, 50, 100, 200, 400 Hz 
        imu: 100
        attitude: 100
        acceleration: 50
        velocity: 50
        angular_velocity: 100
        position: 50
        gps_fused_position: 10
        gps_data: 5
        rtk_data: 5
        magnetometer: 50
        rc_channels_data: 1
        gimbal_data: 1
        flight_status: 1
        battery_level: 1
        control_information: 50

Finally, launched the wrapper with:

# Launch the node
ros2 launch psdk_wrapper wrapper.launch.py

Expected behavior

Expected the parameters from psdk_params.yaml to load properly.

Actual behavior

The parameters seem to not load, as the RCLCPP_INFO outputs don't contain the strings with parameters. Consequently the launcher is unable to initiate dji_core. The console output is as follows:

[INFO] [launch]: All log files can be found below /home/jetson_m350/.ros/log/2023-09-26-17-17-41-182445-ubuntu-15439
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [psdk_wrapper_node-1]: process started with pid [15451]
[psdk_wrapper_node-1] [INFO] [1695745061.429307870] [wrapper.psdk_wrapper_node]: Creating Constructor PSDKWrapper
[psdk_wrapper_node-1] [INFO] [1695745061.609794574] [wrapper.psdk_wrapper_node]: Configuring PSDKWrapper
[psdk_wrapper_node-1] [INFO] [1695745061.609922639] [wrapper.psdk_wrapper_node]: Loading parameters
[psdk_wrapper_node-1] [INFO] [1695745061.610097905] [wrapper.psdk_wrapper_node]: App name: 
[psdk_wrapper_node-1] [INFO] [1695745061.610153393] [wrapper.psdk_wrapper_node]: App id: 
[psdk_wrapper_node-1] [INFO] [1695745061.610171538] [wrapper.psdk_wrapper_node]: App key: 
[psdk_wrapper_node-1] [INFO] [1695745061.610196242] [wrapper.psdk_wrapper_node]: Baudrate: 
[psdk_wrapper_node-1] [INFO] [1695745061.610214130] [wrapper.psdk_wrapper_node]: Hardware connection: 
[psdk_wrapper_node-1] [INFO] [1695745061.610246354] [wrapper.psdk_wrapper_node]: Uart dev 1: 
[psdk_wrapper_node-1] [INFO] [1695745061.610263858] [wrapper.psdk_wrapper_node]: Uart dev 2: 
[psdk_wrapper_node-1] [INFO] [1695745061.610360307] [wrapper.psdk_wrapper_node]: Setting environment
[psdk_wrapper_node-1] [INFO] [1695745061.610462868] [wrapper.psdk_wrapper_node]: Registered OSAL handler
[psdk_wrapper_node-1] [INFO] [1695745061.610483253] [wrapper.psdk_wrapper_node]: Registered HAL handler
[psdk_wrapper_node-1] [INFO] [1695745061.610493397] [wrapper.psdk_wrapper_node]: Using DJI_USE_UART_AND_USB_BULK_DEVICE
[psdk_wrapper_node-1] [INFO] [1695745061.610517141] [wrapper.psdk_wrapper_node]: Environment has been set!
[psdk_wrapper_node-1] [INFO] [1695745061.610534453] [wrapper.psdk_wrapper_node]: Initializing ROS publishers
[psdk_wrapper_node-1] [INFO] [1695745061.636097909] [wrapper.psdk_wrapper_node]: Creating subscribers
[psdk_wrapper_node-1] [INFO] [1695745061.640615906] [wrapper.psdk_wrapper_node]: Creating services
[psdk_wrapper_node-1] [INFO] [1695745061.673331562] [wrapper.psdk_wrapper_node]: Activating PSDKWrapper
[psdk_wrapper_node-1] [INFO] [1695745061.673410379] [wrapper.psdk_wrapper_node]: Init DJI Core...
[psdk_wrapper_node-1] chmod: missing operand after ‘777’
[psdk_wrapper_node-1] Try 'chmod --help' for more information.
[psdk_wrapper_node-1] [ERROR] [1695745061.676822477] [wrapper.psdk_wrapper_node]: DJI core could not be initiated. Error code is: 236
[ERROR] [launch_ros.actions.lifecycle_node]: Failed to make transition 'TRANSITION_ACTIVATE' for LifecycleNode '/wrapper/psdk_wrapper_node'

Hi @andre-f-moura,

I see you are using ROS 2 Foxy. This has been developed and tested for ROS 2 Humble. In Humble I cannot reproduce this error, thus I assume this has something to do with how these two distros handle the parameters. If there is no constraint on your side, I would suggest you to use Humble, otherwise please feel free to open a PR to make this compatible with Foxy distros as well.

Thank you for your response.
You were right, I forgot the package was for ROS2 Humble, that part is working now, sorry.

However I have another question. When launching the wrapper, the program tries to chmod 777 /dev/dji_serial (/dev/ttyTHS0) but I'm only able to chmod with super user privileges, so I have been using ros2 launch as root, otherwise the program stops on that line. Do you do it any other way? I also tried adding the user to the dialout group, which gives access to the serial device but not permission to run the chmod command.

Hello again, this is a matter of how you want to handle permissions in your set-up. Running programs with superuser privileges should be avoided for security reasons. How we handle this is by changing the permissions with sudo for the specific devices that the program needs to access before running the wrapper. Then, the wrapper is launched without superuser privileges. I hope this helps.

Closing issue as this is not an actual bug.