Jump to content

KRPC Joystick Input RPC/sec


tomcunn

Recommended Posts

I am trying to build an interface to a control panel that uses joysticks to interface to KSP via the KRPC. I have everything working, reading the joystick values into a raspberry pi, and then having the pi connect to the KRPC server. I am trying to achieve a 10Hz or better rate for the controls. For my python code, I execute the calls on a loop.


    while(True):
       GetJoyStick()
       start = time.time()
       vessel.control.pitch = joystick_pitch
       vessel.control.yaw   = joystick_yaw
       vessel.control.roll  = joystick_roll
       vessel.control.thottle  y= 1
       vessel.control.forward = 0
       vessel.control.right = 0
       vessel.control.up = 0
       end = time.time()
       print(end-start)
 

I played around with some different settings in KRPC advanced settings in the KRPC interface, the best I could get was 45 RPC/sec. Here is a print statement of time for the update to occur as shown in the code above. 

Starting Controls///
0.439182043076
0.435542106628
0.437279939651
0.441950798035
0.443905830383
0.400623083115
0.742579936981
0.438502073288
0.443440198898
0.435302972794
0.439296007156
0.623143196106
0.461045980453
0.442525863647
0.43900513649
0.439331054688
0.47675204277
0.439754962921
 

I am wondering if this is the best approach that I am taking. For a bank of switches, the rates are fine, but for joystick control, it can be a little laggy.  Any help is appreciated. 

Thanks,

Tom 

 

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...