Why is the gcv_ready() in GPC script always failed?
3 posts
• Page 1 of 1
Why is the gcv_ready() in GPC script always failed?
Gtuner configuration:python 3.8, opencv 4.2.0.34 following the guide:https://www.consoletuner.com/forum/viewtopic.php?t=15147
The problem is when running python cv script normally in cv windows, gcv_ready() in GPC script always failed and info "something wrong" poping up in Gtuner output panel.
I'm confused badly, Why? Could anybody help? Thanks......
The problem is when running python cv script normally in cv windows, gcv_ready() in GPC script always failed and info "something wrong" poping up in Gtuner output panel.
I'm confused badly, Why? Could anybody help? Thanks......
- Code: Select all
int8 gamepadLstick_x = 0;
int8 gamepadLstick_y = 0;
main {
if(gcv_ready()) {
gamepadLstick_x = gcv_read(0);
gamepadLstick_y = gcv_read(1);
printf("test");
}
else printf("something wrong");
}
- Code: Select all
import os
import cv2
class GCVWorker:
def __init__(self, width, height):
os.chdir(os.path.dirname(__file__))
self.gcvdata = bytearray([0x00,0x00])
print("__init__")
print(self.gcvdata)
def __del__(self):
print("__del__")
print(self.gcvdata)
del self.gcvdata
def process(self, frame):
self.gcvdata[0] = 100
self.gcvdata[1] = 100
print("process")
print(self.gcvdata)
return frame,self.gcvdata
- Attachments
-
- Gtuner configuration
- Gtuner cfg.PNG (86.13 KiB) Viewed 3320 times
-
johnsonwhl - Private First Class
- Posts: 2
- Joined: Tue May 16, 2023 12:44 am
Re: Why is the gcv_ready() in GPC script always failed?
gcv_ready() is every frame when data is sent. So it'll spam both test and something wrong.
First get rid of the output panel spam;
Then change the GPC to print the value of your variables instead when you press the right trigger;
For the sticks though you want to use fix32. So in the python script you'd use gcvdata.extend and extend to 4 bytes and then adjust the gpc accordingly. I recommend checking out the apex script by J2Kbr and scrolling down to the gcvdata section near the end to see how it's done.
First get rid of the output panel spam;
- Code: Select all
import os
import cv2
class GCVWorker:
def __init__(self, width, height):
os.chdir(os.path.dirname(__file__))
self.gcvdata = bytearray([0x00,0x00])
def __del__(self):
del self.gcvdata
def process(self, frame):
self.gcvdata[0] = 100
self.gcvdata[1] = 100
return frame, self.gcvdata
Then change the GPC to print the value of your variables instead when you press the right trigger;
- Code: Select all
bool gamepadLstick_x;
bool gamepadLstick_y;
main {
if(gcv_ready()) {
gamepadLstick_x = gcv_read(0);
gamepadLstick_y = gcv_read(1);
}
if(event_active(BUTTON_5)) {
printf("gamepadLstick_x: %d gamepadLstick_y: %d", gamepadLstick_x, gamepadLstick_y);
}
}
For the sticks though you want to use fix32. So in the python script you'd use gcvdata.extend and extend to 4 bytes and then adjust the gpc accordingly. I recommend checking out the apex script by J2Kbr and scrolling down to the gcvdata section near the end to see how it's done.
- Mad
- Major General
- Posts: 4538
- Joined: Wed May 22, 2019 5:39 am
Re: Why is the gcv_ready() in GPC script always failed?
Thanks a lot!
It worked!
It worked!
-
johnsonwhl - Private First Class
- Posts: 2
- Joined: Tue May 16, 2023 12:44 am
3 posts
• Page 1 of 1
Return to Gtuner Computer Vision
Who is online
Users browsing this forum: No registered users and 31 guests