umdlife / psdk_ros2

This repository is a ROS 2 wrapper for the DJI PSDK libraries.
https://umdlife.github.io/psdk_ros2/documentation/Introduction.html
Mozilla Public License 2.0
70 stars 21 forks source link

Unreliable start of psdk_wrapper #147

Open tompe17 opened 2 weeks ago

tompe17 commented 2 weeks ago

I am having issues with starting psdk_wrapper sometimes failing. I start with:

ros2 launch psdk_wrapper wrapper.launch.py link_config_file_path:=/home/lrs/lrs2_ws/src/lrs_m300/cfg/link_config.json psdk_params_file_path:=/home/lrs/lrs2_ws/src/lrs_m300/cfg/psdk_params.yaml namespace:=/dji5

and sometimes get

[INFO] [launch]: All log files can be found below /home/lrs/.ros/log/2024-11-11-16-34-04-460977-mat5-35889
[INFO] [launch]: Default logging verbosity is set to INFO                         
[INFO] [psdk_wrapper_node-1]: process started with pid [36441]                    
[psdk_wrapper_node-1] [INFO] [1731339244.964723431] [dji5.psdk_wrapper_node]: Creating Constructor PSDKWrapper
[psdk_wrapper_node-1] [ERROR] [1731339244.965214816] [dji5.psdk_wrapper_node]: is_waypoint_flying_module_mandatory_: 1
[psdk_wrapper_node-1] [INFO] [1731339244.979036029] [dji5.telemetry_node]: Creating TelemetryModule
[psdk_wrapper_node-1] [INFO] [1731339244.990261983] [dji5.flight_control_node]: Creating FlightControlModule
[psdk_wrapper_node-1] [INFO] [1731339245.001426849] [dji5.waypoint_flying_node]: Creating WaypointFlyingModule
[psdk_wrapper_node-1] [INFO] [1731339245.020803755] [dji5.camera_node]: Creating CameraModule
[psdk_wrapper_node-1] [INFO] [1731339245.035299744] [dji5.gimbal_node]: Creating GimbalModule
[psdk_wrapper_node-1] [INFO] [1731339245.050217265] [dji5.liveview_node]: Creating LiveviewModule
[psdk_wrapper_node-1] [INFO] [1731339245.068056590] [dji5.hms_node]: Creating HmsModule
[psdk_wrapper_node-1] [WARN] [1731339245.111480562] [rcl_lifecycle]: No transition matching 3 found for current state unconfigured
[psdk_wrapper_node-1] [ERROR] [1731339245.111513862] [dji5.psdk_wrapper_node]: Unable to start transition 3 from current state unconfigured: Transition is not registered., at ./src/rcl_lifecycle.c:355     
[psdk_wrapper_node-1] [INFO] [1731339245.112513478] [dji5.psdk_wrapper_node]: Configuring PSDKWrapper
[psdk_wrapper_node-1] [INFO] [1731339245.112539869] [dji5.psdk_wrapper_node]: Loading parameters
[psdk_wrapper_node-1] [INFO] [1731339245.112582028] [dji5.psdk_wrapper_node]: App name: Dummy
[psdk_wrapper_node-1] [INFO] [1731339245.112591342] [dji5.psdk_wrapper_node]: App id: 153720
[psdk_wrapper_node-1] [INFO] [1731339245.112600428] [dji5.psdk_wrapper_node]: App key: ec72214329b2395951193e16af289e0
[psdk_wrapper_node-1] [INFO] [1731339245.112612476] [dji5.psdk_wrapper_node]: Baudrate: 921600
[psdk_wrapper_node-1] [INFO] [1731339245.112621928] [dji5.psdk_wrapper_node]: Using connection configuration file: /home/lrs/lrs2_ws/src/lrs_m300/cfg/link_config.json                                       
[psdk_wrapper_node-1] [INFO] [1731339245.112682278] [dji5.psdk_wrapper_node]: Setting environment
[psdk_wrapper_node-1] [INFO] [1731339245.112712675] [dji5.psdk_wrapper_node]: Registered OSAL handler
[psdk_wrapper_node-1] [INFO] [1731339245.112720613] [dji5.psdk_wrapper_node]: Registered HAL handler
[psdk_wrapper_node-1] [INFO] [1731339245.112836682] [dji5.psdk_wrapper_node]: Loaded configuration file
[psdk_wrapper_node-1] [INFO] [1731339245.112845985] [dji5.psdk_wrapper_node]: Using DJI_USE_UART_USB_BULK_DEVICE
[psdk_wrapper_node-1] [INFO] [1731339245.112855305] [dji5.psdk_wrapper_node]: Environment has been set!
[ERROR] [launch_ros.actions.lifecycle_node]: Failed to make transition 'TRANSITION_ACTIVATE' for LifecycleNode '/dji5/psdk_wrapper_node'

Is this a bug or have I messes up (I am working on a branch adding support for Waypoint V2 flying)?

biancabnd commented 1 week ago

Hi @tompe17! This most probably means the time it takes for the node to transition from one state to another, in this case from configure to activate takes longer than the default timeout. And this seems to be related, with the error you get above : No transition matching 3 found for current state unconfigured. So, if you have added a new module, with a new node, there might be something wrong with how you transition the node through all the lifecycle states. Also, check with the main branch to see if you get the same behavior. I would expect that to work.