DeepGTAV icon indicating copy to clipboard operation
DeepGTAV copied to clipboard

reward inialiser value

Open IanKirwan opened this issue 7 years ago • 10 comments

Hi @aitorzip I have found that using the initial reward values you specify in the start message example in the readme.md [15.0, 0.5] reward functions ok. However I want to minimise the speed reward part so that I'm just getting lane reward. I tried [15.0, 0.0] which crashes DeepGTAV (without anything entered in DeepGTAV.log) and the same with [15.0, 0.1]. The latter causes no problems on another machine I use which is a bit strange. Do you have any issue like this?

IanKirwan avatar Jan 06 '18 17:01 IanKirwan

@IanKirwan thanks for you help, I set up the vs environment, and found my offset of brake.. But, I got the same issue for reward, it crush my DeepGTAV.

xiaoli-chen avatar Jan 12 '18 10:01 xiaoli-chen

Hi @xiaoli-chen , What offset did you get for brake? Are you using GTAV 1.1290? Make sure you dont have scripthookvdotnet in the gtav exe folder when you try to get reward.

IanKirwan avatar Jan 12 '18 11:01 IanKirwan

My game version is VER_1_0_877_1_STEAM

void Scenario::setThrottle(){
	d["throttle"] = getFloatValue(vehicle, 0x8D4);
}

void Scenario::setBrake(){
	d["brake"] = getFloatValue(vehicle, 0x8D8);
}

void Scenario::setSteering(){
	d["steering"] = -getFloatValue(vehicle, 0x8CC) / 0.6981317008;
}

Still stuck on the reward, try to catch the exception but can not get any.... did you figure a way to make some detail logging?

try{
	rewarder = new GeneralRewarder((char*)(GetCurrentModulePath() + "paths.xml").c_str(), dc["reward"][0].GetFloat(), dc["reward"][1].GetFloat());
	reward = true;
}
catch (const char* e) {
	freopen("deepgtav.log", "w", stdout);
	printf("%s", *e);
}

xiaoli-chen avatar Jan 13 '18 02:01 xiaoli-chen

same here, the reward part is tricky, I also can not make it correct. I try to figure out it by my self. Maybe the paths.xml part crash the project.

angelapper avatar Jan 13 '18 03:01 angelapper

I make some log and found this part cause the crash.

try {
	node1 = nodes.at(node1.id);
	node2 = nodes.at(node2.id);
	printf("node %d, node %d\n", node1.id, node2.id);
}
catch (const std::out_of_range) {
	//Empty on purpose
}

angelapper avatar Jan 13 '18 09:01 angelapper

@angelapper Can you fix it and post the fix? I'm no C++ programmer so am reliant on others to fix issues like this.

IanKirwan avatar Jan 13 '18 11:01 IanKirwan

@xiaoli-chen Suprised your code compiled with freopen(). Should be freeopen() I think.

IanKirwan avatar Jan 13 '18 11:01 IanKirwan

is there anyone solved the reward problem? The GTAV crashed every time I try to get the lane and vehicle reward. I checked the paths.xml, it's just in the same directory with GTA5.exe. The initialized reward is tricky, I cannot get any combination of two numbers that makes GTAV reward work, [15.0, 0.5] doesn't work for me at all. I used the VPilot, and the python code is like following: dataset = Dataset(rate=10, frame=[800,600],throttle=True, brake=True, steering=True,trafficSigns=True, vehicles=True,peds=True, location=True, drivingMode=True, reward=[15.0, 0.5]) scenario = Scenario(weather='EXTRASUNNY',vehicle='blista',time=[12,0],drivingMode=[786603,20.0],location=[-2573.13916015625, 3292.256103515625, 13.241103172302246]) client.sendMessage(Config(scenario=scenario,dataset=dataset))

blabla....

dataset = Dataset(rate=10, frame=[800,600],throttle=True, brake=True, steering=True,trafficSigns=True, vehicles=True,peds=True, location=True, drivingMode=True, reward=[15.0, 0.5]) # Automatic driving scenario scenario = Scenario(weather='EXTRASUNNY',vehicle='blista',time=[12,0],drivingMode=[786603,20.0],location=[-2573.13916015625, 3292.256103515625, 13.241103172302246]) #drivingmode=-1 for manual client.sendMessage(Start(scenario=scenario,dataset=dataset)) # Start request

Any help will be appreciated! Thank you guys!

LevineYang avatar May 29 '18 10:05 LevineYang

I make some log and found this part cause the crash.

try {
	node1 = nodes.at(node1.id);
	node2 = nodes.at(node2.id);
	printf("node %d, node %d\n", node1.id, node2.id);
}
catch (const std::out_of_range) {
	//Empty on purpose
}

My tests show the problem occurring at the same location. Also, I tried it with [15.0, 0.0] reward function. I noticed that the iteration number where the error happens is not constant. Out of the ~80,000 node links loaded from paths.xml, the error for me happens at ~20,000 - ~30,000 node link (different at different runs). This makes me wonder if the error is related to too much memory being consumed?

If anyone has solved this issue in the 2 years since it was opened... would really appreciate any help!

sharma-n avatar Aug 25 '20 08:08 sharma-n

Please refer this link page

add #include <stdexcept> in LaneRewarder.cpp

Sudo42b avatar Jun 05 '21 07:06 Sudo42b