f1tenth / f1tenth_gym Goto Github PK
View Code? Open in Web Editor NEWThis is the repository of the F1TENTH Gym environment.
License: MIT License
This is the repository of the F1TENTH Gym environment.
License: MIT License
Migrate from `setup.py` to `pyproject.toml`.
Originally posted by @hzheng40 in #29 (comment)
Not sure why this is happening, but when initializing vec envs it takes way longer:
python3 -m timeit -n 1 -v "import gymnasium as gym; gym.make('f110_gym:f110-v0')"
raw times: 4.96 sec, 4.5 sec, 4.98 sec, 4.93 sec, 4.89 sec
python3 -m timeit -n 1 -v "import gymnasium as gym; [gym.make('f110_gym:f110-v0') for _ in range(10)]"
raw times: 48.2 sec, 44 sec, 45.1 sec, 44.9 sec, 46 sec
python3 -m timeit -n 1 -v "import gymnasium as gym; gym.make_vec('f110_gym:f110-v0', num_envs=10)"
raw times: 378 sec, 384 sec, 376 sec, 409 sec, 417 sec
I think the expectation is that it should scale linearly with the number of envs.
Remove unnecessary environment variables and clean up dependencies.
ENV_IM_IN_DOCKER
emacs
and add vim
protobuf
versiontorch
installAdd example files for setting up an agent using the gym environment.
Describe the bug
On running the command pip3 install -e .
I get the following error:
To Reproduce
Steps to reproduce the behavior:
pip3 install -e .
Expected behavior
The dependencies should get installed and set up should be complete without errors.
Desktop (please complete the following information):
Description: CarAction currently specifies speed or acceleration control jointly for steering and vx/ax. To mix between the two CarAction types, we would need to create one class per combination.
Suggested Feature: Separate CarAction into SpeedAction and SteerAction to allow for separate types for speed and steer.
Hello,
This shouldn't be a bug from your end.
I followed the README documentation and ran the docker scripts. However, it seems that, inside the container environment, no libraries are installed including gym, numpy, and even Python.
I don't have much experience with Docker but it's not clear what I am missing. Would be happy to know if anyone else had the same issue
Describe the bug
The root cause of this behavior is that the reset function does not provide the opportunity to choose the raceline on the track that is used for restarts. The PurePursuit controller overcorrects, and this results in a crash.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The waypoint follow should not result in a crash
Additional context
Adding an additional option to set the line along which a respawn happens would fix this issue. This is inside masked_reset.py
Currently, the simulation instantiates two agents in the environment by default.
Compile .proto
files every time Dockerfile is built.
Add command in Dockerfile to run protoc
and output protobuf generated files to correct paths instead of using cp
in Dockerfile.
Currently, there is no option to change the number of laps that the agent drives before terminated and done are flagged as true. Additionally, the lap time observation is actually a total time observation for all (two) laps in this case.
The _check_done function would need to be rewritten to accomodate a config setting. The lap times calculation would need to be reworked to compute current lap time.
Currently, the scan still has random noise when reset is called.
Current behavior: reset() returns different observations with the same argument used depending on how many times reset() is called on the same instance of env. This creates an enormous inconvenience when trying to reproduce experiments.
Expected behavior: reset() should return the same observation with the same argument no matter how many times it's been called on the same env instance.
Hi there,
Thanks for your nice work! I tried to train an RL agent using stable baselines for your gym. But I've got several bugs since your gym is slightly different than the standard OpenAI gym. I was wondering which RL framework did you use in your RL experiments or which RL framework is compatible with your gym? Here are a few differences I encountered for stable baselines (these are rather easy to solve but I was just wondering which RL framework would work out of box with your env)
observation_space
and action_space
definedreset
method returns more than just obsRandom trackgen should be packaged properly as a binary/script in the f110 gym package
However, we should decide if keeping the old tracks (without raceline and centerline) or get rid of them.
Originally posted by @luigiberducci in #82 (comment)
Remove deprecated sections:
Usage/Customized Usage Example/Custom Map/Random Track Generator (Beta)
reset
/step
in Example Usage/Customized Usage Example/Multiple Agents
Reproducibility
Enhancements:
Usage/Customized Usage Example/Changing Parameters in Vehicle Dynamics
API Referece/What’s In an Observation
README
See pull request #50
Refactoring to Python would eliminate the need for building the C++ back-end and protobuf.
With numba, the computation speed should still be acceptable.
See exp_py branch for details.
Problem description:
The entrypoint script worker_online.py
(referenced in DockerfileUI
) is missing.
Steps to reproduce:
docker build -t f1tenth_gym_ui -f DockerfileUI .
xhost local:$USER
docker run --gpus all -it --name=f1tenth_gym_ui_container --rm -p 5557:5557 -p 5558:5558 -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix f1tenth_gym_ui
Output:
python3: can't open file 'worker_online.py': [Errno 2] No such file or directory
The ROS simulator has a great feature of being able to easily add and remove random obstacles on the track.
I think this feature would be very useful in this simulator too, namely to test benchmark 2 which is a track with random obstacles.
Since gym 0.21.0, abstract methods for the Env object is marked abstract openai/gym#2158. This means overriding with extra arguments no longer works.
Might need to consider workarounds like loading the yaml file for the map during env instantiation while allowing for optional arguments.
Implement 2D scan simulation in Python as a separate module for easier testing before integrating it into the env.
maps/<racetrack_name>/
racetrack
object containing occupancy, centerline and raceline (if available) to avoid the user to load cvs files for the plannermap_name
, without map_path
and map_ext
f1tenth_racetracks
Ongoing discussion for adding acceleration and steering velocity as control inputs.
api.f1tenth.org
, using structure of f1tenth_racetracks
src/ackermann_kinematics.cpp
and src/ks_kinematics.cpp
src/st_kinematics.cpp
to vehicle_dynamics.cpp
Steps to do:
Explore the option of using @ayoubraji 's method of finish line condition checking.
(Project agent's current position onto the centerline of the track and check the cumulated arc length)
Single finish line for all agents on the track.
As title.
Add a random track generator and instructions on how to use it.
Describe the bug
Termination due to collision is triggered without any visible collision with the map boundaries.
To Reproduce
Steps to reproduce the behavior:
waypoint_follow.py
from Monza or Austin.env = gym.make(
"f110_gym:f110-v0",
config={
"map": "Monza",
"num_agents": 1,
"timestep": 0.01,
"integrator": "rk4",
"control_input": "speed",
"model": "st",
"observation_config": {"type": "kinematic_state"},
"params": {"mu": 1.0},
},
render_mode="human",
)
Expected behavior
No collision is expected, at least looking at the rendered simulation (see screenshot).
It looks to depend on the relatively high threshold in the collision detection method.
In fact, changing the ttc_thresh
from 0.005 to 0.0000005, no collision occurs.
I think @nandantumu had a similar issue in other tracks too.
However, the problem is in the proximity of walls. Many new tracks present racelines with a very small margin to the wall.
If we lose further accuracy by changing the method for collision check (e.g., occupancy map), this issue might become more severe.
Desktop (please complete the following information):
Each track has now a centerline, we can use the longitudinal progress to check lap completion.
Since everyone might have different termination conditions in mind, we want to implement a predefined set of termination conditions (e.g., event-based events, like "on crossing the finish line", "on ego collision", "on any collision").
Currently, the environment needs to be initialized by several file paths and explicitly defined physical parameters of the car.
Proposed changes are to make these file paths and parameters default in the initialization, and include in the documentation how to use non-default parameters when initializing the environment.
Move the Euclidean Distance Transform matrix to part of the track asset, together with the image file and the yaml file.
This speeds up gym.make
and also streamlines the transition to JAX-based env.
In addition, provide script for users to create the matrix from image for custom maps.
The reference point for vehicle_dynamics_st()
and vehicle_dynamics_ks()
is not the same so switching between them is not correct. Instead of using vehicle_dynamics_ks()
we can use vehicle_dynamics_cog
(here) which will solve the problem.
Whenever I launch the demo now it is already collided. I may have clicked save by mistake but I redownloaded the gym_bridge.rviz here and uploaded it and it still did not work
Create web-based visualization for f1tenth simulation and potentially the actual hardware via libraries like https://github.com/cruise-automation/webviz.
as in the title, consider adding better models.
For example std model
This would be so casting it to a tensor or vector is much easier, and does not require the user to dig through source to identify what the keys in the observation are.
Describe the bug
I've found that by taking certain actions, the simulator can be prompted to calculate impossibly large angular velocity values. Once the angular velocity starts exploding, it creates a runaway effect and can increase to millions or billions of radians/sec.
To Reproduce
The following code example produces an angular velocity of -82084.6562721812, which is obviously impossible.
from f110_gym.envs import F110Env
from f110_gym.envs.base_classes import Integrator
import numpy as np
env = F110Env(num_agents=1, integrator=Integrator.Euler)
env.reset(np.array([[0, 0, -0.5]]))
max_reverse = env.params["v_min"]
max_steer = env.params["s_min"]
for _ in range(5):
_, _, done, _ = env.step(np.array([[0, max_reverse]]))
assert not done
for _ in range(25):
obs, _, done, _ = env.step(np.array([[max_steer, max_reverse]]))
assert not done
print(obs) # notice that angular velocity is impossibly large
I'm currently training reinforcement learning algorithms with this environment, but runs keep failing because the agent may accidentally trigger this behavior. Is this a bug in the dynamics? This behavior appears for both euler integration as well as RK4, even after the bugfix introduced by #52.
Bug description
As already privately signaled to the developers, it happens sometimes that the car goes really close to the boundaries and so it triggers the checkpoint used by the lap time system which is in reality in the opposite part of the track.
For example, sometimes it gives me 12s and other times 20s depending on how close the car goes to the boundaries.
To Reproduce
Watch the videos.
Expected behavior
As already have been told me correcting the starting lane width can fix the problem but I think it should be used a more accurate solution. At least for the future.
Suggested solution
Consider using the projection of the car position in a reference path, so using a spline and check whenever the car passes a certain s position on the spline. We use this system in our simulators and in the real f1tenth car, it seems accurate.
To do it in python:
path = Spline2D(xs, ys)
path.update_current_s(car_pose)
and then check if it passed a s_reference:
if path.cur_s > s_reference:
Of course this should be done for each car, so having two path variables but if you use the calc_s function maybe you can use a unique path variable and check the projection of each car using path.calc_s(x,y). In this way it should be faster.
For any further detail don't hesitate to contact me. If you want I can even create a fork of the sim and make the changes and then let you know how it goes.
As in the title, bring the update of the scan outside this method, so that update_pose
is only responsible for updating the racecar state.
In the future, we could compute the scan only if required by the observation space, so it would be better to separate it.
Note: currently the collision check relies on the scan, so this issue depends on finding an alternative way to check for collisions.
Originally posted by @luigiberducci in #74 (comment)
Reset by pose doesn't work with VectorEnv API, should consider setting initial pose as an argument during make().
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.