-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unusual behaviour of DReyeVR_vehicle after autpoilot is disabled #46
Comments
That should not be the case, since the autopilot control should be gracefully handed back to the user. Though honestly I don't remember testing this particular case well so maybe we missed it and there is a bug. In either case, you should at any time be able to override the autopilot controls by pressing |
Yes! Pressing 1 does work. However, it's kind of weird that set_autopilot() does not work. Moreover, pressing 1 would not suit my study implementation as I want to enact a perfect manual hand-over upon Take-Over-Request (TOR). |
Hmm. Pressing 1 should work so this does sound like a bug. I will also be running a study in the future with TOR so I'll be adding this to the featureset (and fixing this bug) sometime soon-ish. Yes, calling What I could recommend you try (which shouldn't take too long) is so toggle Code would look something like this: // in EgoVehicle tick
if (timeToToggle > 0) { // using timeToToggle as a timer
timeToToggle -= DeltaSeconds;
}
else {
SetAutopilot(!bAutopilotEnabled);
timeToToggle = 5.0; // restart the timer to 5s
}
|
Also, I'm now testing again and the behaviour seems to be working for me. So just to verify, can you try this:
This seems to work for me. |
Also are you sending controls via keyboard (WASD) or logitech? |
Yes, as I mentioned earlier, pressing 1 does fully give control to the user (i.e., it can now ONLY be controlled by WASD/Logitech), but this does not serve well for my study implementation. I want to use set_autopilot() in python API to get the same behavior as pressing 1 (to give manual control) |
Moreover, after setting |
Try running this:
You may be able to reproduce the problem. The autopilot isn't disabled after 5 secs. |
Okay gotcha, yeah this makes more sense now. So everything is actually working as intended I think. By calling I agree this is unusual since you might expect instead of lingering inputs the car sets all its inputs to 0 and comes to a halt. Is this more like what you want to do? |
Yes! That's exactly what I want! |
Wait! Not exactly come to a halt. But the car continues to move forward at a decreasing speed (as it normally does) since autopilot is disabled. Moreover, it should ONLY be responsive to WASD/Logitech's steer/brake/throttle. What I experienced is that once I disable autopilot, the vehicle continues to move with a constant velocity/steer which shouldn't happen. |
Right, as if the user were to let go of all the inputs (until they press WASD/Logitech again) |
Ok I think you can try this: in void AEgoVehicle::SetAutopilot(const bool AutopilotOn)
{
bAutopilotEnabled = AutopilotOn;
AI_Player->SetAutopilot(bAutopilotEnabled);
AI_Player->SetStickyControl(bAutopilotEnabled);
if (!bAutopilotEnabled) {
this->SetSteering(0);
this->SetThrottle(0);
this->SetBrake(0);
}
} Then rebuild and you should get the behaviour you want. |
Unfortunately, this still doesn't change anything. The vehicle still has a constant velocity after autopilot is disabled. Moreover, if the brakes are applied by using WASD/ Logitech and released, the vehicle accelerates to reach a certain speed (based on the global speed difference percentage). Have you tried running the script? Does it work for you? |
Yes, you are right. You can ignore that suggestion and undo those changes. I did a bit of digging and found the solution. Arguably this is more of a Carla bug than a DReyeVR bug but here you go: You are gonna want to add this line here in on line ~39 (before the TM stuff) GetEpisode().Lock()->SetVehicleAutopilot(*this, enabled); Then rebuild everything We will include this Carla patch in the next version of DReyeVR |
This doesn't seem to work. Sorry! The vehicle is still moving with a constant velocity after the autopilot is disabled. |
Hmm it worked for me. I'll investigate more tmrw but for now verify that you built everything successfully (maybe make clean first) |
This is so infuriating that it's not working for me. I did do
|
Ok just so we're on the same page, can you try this: Go to EgoVehicle tick (in C++: EgoVehicle.cpp) and add a debug message such as: UE4_LOG(LogTemp, Log, TEXT("Autopilot enabled: %d"), AI_Player-> IsAutopilotEnabled()); After rebuilding with these changes go to the Editor ( Next, run the script you posted above and watch the car's autopilot turn on, when this happens you should see Is this consistent with what you're seeing? |
I really appreciate you following up with me. So, Instead of using UE_LOG, I created a Log text file because I am not able to see the logs in the output log window (and I have no incentive to fix this atm).
The surprising thing is that it only contains "FALSE" in the text log. I have no clue why this is happening. |
Yeah, mine contains both 1's (true) and 0's (false) so there might be something funky going on with your addition of So just to verify, after running |
I first edited |
Can you print out the whole path (relative to the base Carla/DReyeVR root) of this LibCarla file? |
|
Ok well everything looks okay here. Just to verify things are correctly getting built can you add a debug log in the same code for Then make sure the log is updated when you call Sorry for all the hacky tests but I really thought this would fix it (as it did for me) so I just want to sanity check. |
While I do that, I just want to make sure that I don't have to execute |
The log was not displayed. I think that The updated file is not being compiled. Do you have any suggestions on what I should do now? |
Sure, there may be something very wrong with the build procedure (or caching) so doing a clean build might be the way to go. You could also try this by deleting the |
I'm pretty sure LibCarla is rebuilt with PythonAPI because it is a dependency as denoted in the makefile. However I'm not sure if it checks if there were any changes in LibCarla source or for just existing binaries (which would explain not rebuilding)... So you can try it as well:
|
I deleted the I can see the following in the terminal.
Doesn't this mean that there is no error in the building stage? And maybe the implementation not working? Just so that we are on the same page, this is the behavior I am getting. Video (You will have to skip a bit in the starting). |
Okay this makes sense now. Your
So this explains why your LibCarla changes are not getting applied. Can you investigate more why this is happening and try to fix it. I'll also do some research on my end but I'm away from my computer at the moment. |
Thank you for the resources. I will investigate further into this. |
Hey! I have tried all the things the posts you mentioned asked me to do. I am not sure why this I happening since I do not have expertise in CPP. But, It worked the first time when I installed DReyeVR, I don't know what happened between then and now. |
Hm ok this will be difficult to debug since I don't have a windows 11 machine and don't have your system configuration. But a couple things to point out:
|
Hey! Sorry for taking a long time to respond. So, I downgraded my system to Windows 10 and reinstalled carla and DReyeVR, and made the changes to |
Well since you made a fresh install of CARLA a clear sign of the I would be very surprised if the changes to Vehicle.cpp still do not solve it and that hints to me that they were not properly built. Can you add the debug prints mentioned earlier to ensure the file was compiled correctly? |
The .egg file does exists.
|
First off, in your logs (around line ~8000) there are some compile errors with your logging mechanism, so you should first check that out. They look like this:
My guess is that since LibCarla (hence PythonAPI) is not building, the dependencies are not getting copied over to dependencies/lib, so you are seeing this |
I am not sure what I should do at this point. I was somewhat unsure if my logging method:
would work or not because I didn't know whether FFileHelper is imported or not. I am using FFileHelper to log the data because the normal UE_LOG() method doesn't work. |
Well I can't say for sure since I haven't used this library before but you are probably missing a header of some sort because there are lots of |
Okay so the logging problem is fixed and egg file is also being generated but the log is not being displayed. At this point, I am not sure what to do. Edit: You may be able to see LNK errors but, that is only when I run |
Once again, there are linker errors but this time with |
Okay, @GustavoSilvera and I finally figured out what the problem was. I installed the Thank you so much @GustavoSilvera for your assistance throughout this issue. |
A note for the future readers: cd %CARLA_ROOT%/Util/InstallersWin
install_sqlite3.bat
install_xercesc.bat
install_proj.bat
:: Copy all the folders generated to the Build folder in carla root
xcopy %CARLA_ROOT%/Util/InstallersWin/FOLDER_NAMES %CARLA_ROOT%/Build
cd %CARLA_ROOT%
make osm2odr
make PythonAPI After this, the autopilot should be disabled. |
Once the traffic manager's autopilot is set to
True
for the ego vehicle, it runs autonomously perfectly. However, when it is disabled afterward, the vehicle still has a throttle and a steer. Why is that so?I tried to apply manual control with everything to default settings (like steer = 0, brake = 0.5, etc), however, it does not work. If you require any additional information/logs, please let me know.
The text was updated successfully, but these errors were encountered: