Page 2 of 2

Re: Controlling a robot arm from PureBasic?

Posted: Mon Jan 27, 2025 11:49 pm
by idle
infratec wrote: Mon Jan 20, 2025 9:23 am The 'hardware' is still available:

https://owirobot.com/robotic-arm-edge/
that's pretty cool. Does it appear as a hid device?
I've got a build of hidapi which is wrapper over libusb

Code: Select all

Structure hid_device_info Align #PB_Structure_AlignC
  *path.Ascii
  vendor_id.u
  product_id.u
  serial_number.s
  release_number.u
  manufacturer_string.s
  product_string.s
  usage_page.u
  usage.u
  interface_number.l
  *next.hid_device_info
EndStructure


ImportC "hidapix64.a" 
  hid_init()
  hid_exit()
  hid_enumerate.i(vendor_id.u = 0, product_id.u = 0)
  hid_free_enumeration(*devs.hid_device_info)
  hid_open(vendor_id.u,product_id.u,serial_number.s)
  hid_open_path(*path.Ascii)                        
  hid_write(dev.i,*data.Ascii,length.i)             
  hid_read_timeout(dev.i,*data.Ascii,length.i,milliseconds.l)
  hid_read(dev.i,*data.Ascii,length.i)                       
  hid_set_nonblocking(dev.i,nonblock.l)                      
  hid_send_feature_report(dev.i,*data.Ascii,length.l)        
  hid_get_feature_report(dev.i,*data.Ascii,length.l)         
  hid_get_input_report(dev.i,*data.Ascii,length.l)           
  hid_close(dev.i)                                           
  hid_get_manufacturer_string(dev.i,*string,maxlen.i)            
  hid_get_product_string(dev.i,*string,maxlen.i)             
  hid_get_serial_number_string(dev.i,*string,maxlen.i)       
  hid_get_device_info(dev.i)                                  
  hid_get_indexed_string(dev.i,string_index.l,*string,maxlen.i)
  hid_get_report_descriptor(dev.i,*buf,buf_size.l)             
  hid_error(dev.i)                                             
  hid_version()                                                
  hid_version_str()                                            
  hid_set_numinputbuffers(dev.i,buf_size.i)
  hid_get_numinputbuffers(dev.i);
EndImport  

ProcedureDLL AttachProcess(Instance)
  hid_init()   
EndProcedure

ProcedureDLL DetachProcess(Instance)
  hid_exit()   
EndProcedure

Re: Controlling a robot arm from PureBasic?

Posted: Tue Jan 28, 2025 8:00 am
by infratec
idle wrote: Mon Jan 27, 2025 11:49 pm that's pretty cool. Does it appear as a hid device?
No, it is a 'plain' usb device.
You need an own driver for it.