VL.Devices.RPLidar - Access to the path 'COM11' is denied

try to use the example test the sensor, and show error.
RPLidar C1 sensor I am using ( only Baud Rate changed for C1 ).

ps. already tested on Slamtec RoboStudio is working.

This is two error debug logs.

2024/10/30 01:16:20.561 [CRT] (App) 0 Explanation Overview Unexpected exception during Update: RESULT_INVALID_ANS_TYPE

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Exception: RESULT_INVALID_ANS_TYPE
   at RPLidar4Net.Api.Helpers.ResponseDescriptorHelper.ToResponseDescriptor(Byte[] data)
   at RPLidar4Net.IO.RPLidarSerialDevice.Connect()
   at _VL_Devices_RPLidar_.Devices.RPLidar.RPLidar_FjblDMXnUUpOwiST0TCeoK.Update(ComPort Port_Name_In, Int32 Baud_Rate_In, Int32 Timeout_In, Single Scaling_In, Boolean Scan_In, Boolean Enabled_In, IObservable`1& Result_Out, String& Device_Info_Out, Int32& Error_Code_Out, Int32& Status_Out, Boolean& Is_Connected_Out)
   at _Explanation_Overview_.__auto.Explanation_OverviewApplication_AUG8FKHHtBaPXZzWVXf2OrProgram_.Update__TRACE__(Explanation_OverviewApplication_AUG8FKHHtBaPXZzWVXf2Or __self, PatchTracer __tracer) in C:\Users\nzh13\AppData\Local\vvvv\gamma\nugets\VL.Devices.RPLidar.1.0.0\help\Explanation Overview.vl.1.cs:line 146
   at _Explanation_Overview_.__auto.Explanation_OverviewApplication_AUG8FKHHtBaPXZzWVXf2OrProgram_.Update(Explanation_OverviewApplication_AUG8FKHHtBaPXZzWVXf2Or __self) in C:\Users\nzh13\AppData\Local\vvvv\gamma\nugets\VL.Devices.RPLidar.1.0.0\help\Explanation Overview.vl.1.cs:line 35
   at _Explanation_Overview_.__auto.Explanation_OverviewApplication_AUG8FKHHtBaPXZzWVXf2Or.Update() in C:\Users\nzh13\AppData\Local\vvvv\gamma\nugets\VL.Devices.RPLidar.1.0.0\help\Explanation Overview.vl.1.cs:line 40
   at InvokeStub_Explanation_OverviewApplication_AUG8FKHHtBaPXZzWVXf2Or.Update(Object, Object, IntPtr*)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
   at VL.Lang.Platforms.RuntimeInstance.Step(ITargetCompilation compilation)

2024/10/30 01:17:13.998 [CRT] (App) 0 Explanation Overview Unexpected exception during Update: Access to the path 'COM11' is denied.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.UnauthorizedAccessException: Access to the path 'COM11' is denied.
   at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
   at System.IO.Ports.SerialPort.Open()
   at RPLidar4Net.IO.RPLidarSerialDevice.Connect()
   at _VL_Devices_RPLidar_.Devices.RPLidar.RPLidar_FjblDMXnUUpOwiST0TCeoK.Update(ComPort Port_Name_In, Int32 Baud_Rate_In, Int32 Timeout_In, Single Scaling_In, Boolean Scan_In, Boolean Enabled_In, IObservable`1& Result_Out, String& Device_Info_Out, Int32& Error_Code_Out, Int32& Status_Out, Boolean& Is_Connected_Out)
   at _Explanation_Overview_.__auto.Explanation_OverviewApplication_AUG8FKHHtBaPXZzWVXf2OrProgram_.Update__TRACE__(Explanation_OverviewApplication_AUG8FKHHtBaPXZzWVXf2Or __self, PatchTracer __tracer) in C:\Users\nzh13\AppData\Local\vvvv\gamma\nugets\VL.Devices.RPLidar.1.0.0\help\Explanation Overview.vl.1.cs:line 146
   at _Explanation_Overview_.__auto.Explanation_OverviewApplication_AUG8FKHHtBaPXZzWVXf2OrProgram_.Update(Explanation_OverviewApplication_AUG8FKHHtBaPXZzWVXf2Or __self) in C:\Users\nzh13\AppData\Local\vvvv\gamma\nugets\VL.Devices.RPLidar.1.0.0\help\Explanation Overview.vl.1.cs:line 35
   at _Explanation_Overview_.__auto.Explanation_OverviewApplication_AUG8FKHHtBaPXZzWVXf2Or.Update() in C:\Users\nzh13\AppData\Local\vvvv\gamma\nugets\VL.Devices.RPLidar.1.0.0\help\Explanation Overview.vl.1.cs:line 40
   at InvokeStub_Explanation_OverviewApplication_AUG8FKHHtBaPXZzWVXf2Or.Update(Object, Object, IntPtr*)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
   at VL.Lang.Platforms.RuntimeInstance.Step(ITargetCompilation compilation)

welcome @hhn, thanks for this report!

while the C1 is supposed to be supported by the slamtec sdk, i’m afraid we haven’t tested it yet (tested only A1 and A2 so far). so there is a potential that it needs a bit of special treatment still.

the error regarding COM11:

  • you’re sure that your device is on this port, right? this is just the default in the helppatch but you need to adapt it to the actual port your device is on
  • make sure that you don’t have the device open in another software (e.g. robostudio) at the same time

if the above does not help and you’d be up debugging this yourself, please note that the sources are available here: GitHub - vvvv/VL.Devices.RPLidar: Support for RPLidar devices by Slamtec

if this is out of your scope, please let us know and we’ll see how we can help further.