forked from f1tenth/f1tenth_gym_ros
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
349 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,57 @@ | ||
FROM ros:melodic-robot-bionic | ||
# MIT License | ||
|
||
ENV IM_IN_DOCKER Yes | ||
|
||
RUN apt-get update --fix-missing && \ | ||
apt-get install -y \ | ||
python-pip | ||
|
||
RUN apt-get install -y libzmq3-dev \ | ||
git \ | ||
build-essential \ | ||
autoconf \ | ||
libtool \ | ||
libeigen3-dev \ | ||
cmake \ | ||
vim \ | ||
ros-melodic-ackermann-msgs \ | ||
ros-melodic-map-server \ | ||
ros-melodic-genpy | ||
# Copyright (c) 2020 Hongrui Zheng | ||
|
||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
|
||
RUN cp -r /usr/include/eigen3/Eigen /usr/include | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
|
||
RUN git clone https://github.com/protocolbuffers/protobuf.git && \ | ||
cd protobuf && \ | ||
git checkout tags/v3.8.0 && \ | ||
git submodule update --init --recursive && \ | ||
./autogen.sh && \ | ||
./configure && \ | ||
make -j8 && \ | ||
make install && \ | ||
ldconfig && \ | ||
make clean && \ | ||
cd .. && \ | ||
rm -r protobuf | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
RUN pip install --upgrade pip | ||
FROM osrf/ros:foxy-desktop | ||
|
||
RUN pip install numpy==1.16.0 \ | ||
scipy==1.2.0 \ | ||
zmq \ | ||
pyzmq \ | ||
Pillow \ | ||
gym \ | ||
protobuf==3.8.0 \ | ||
pyyaml \ | ||
llvmlite==0.31.0 \ | ||
numba==0.47.0 | ||
|
||
|
||
# RUN git clone https://github.com/f1tenth/f1tenth_gym | ||
RUN mkdir /f1tenth_gym | ||
COPY ./f1tenth_gym /f1tenth_gym | ||
|
||
RUN cd f1tenth_gym && \ | ||
mkdir build && \ | ||
cd build && \ | ||
cmake .. && \ | ||
make | ||
SHELL ["/bin/bash", "-c"] | ||
|
||
# dependencies | ||
RUN apt-get update --fix-missing && \ | ||
apt-get install -y git \ | ||
nano \ | ||
vim \ | ||
python3-pip | ||
|
||
RUN pip3 install --upgrade pip | ||
RUN pip3 install numpy \ | ||
scipy \ | ||
Pillow \ | ||
gym \ | ||
pyyaml \ | ||
llvmlite \ | ||
numba \ | ||
pyglet | ||
|
||
# f1tenth gym | ||
RUN git clone https://github.com/f1tenth/f1tenth_gym | ||
RUN cd f1tenth_gym && \ | ||
cp ./build/sim_requests_pb2.py ./gym/ && \ | ||
pip install -e gym/ | ||
|
||
RUN /bin/bash -c "source /opt/ros/melodic/setup.bash; mkdir -p catkin_ws/src; cd catkin_ws; catkin_make" | ||
|
||
RUN mkdir /catkin_ws/src/f1tenth_gym_ros | ||
|
||
COPY . /catkin_ws/src/f1tenth_gym_ros | ||
|
||
RUN /bin/bash -c "source /opt/ros/melodic/setup.bash; cd catkin_ws; catkin_make; source devel/setup.bash" | ||
|
||
pip3 install -e gym/ | ||
|
||
CMD ["/catkin_ws/src/f1tenth_gym_ros/start.sh"] | ||
# ros2 gym bridge | ||
RUN mkdir -p sim_ws/src/f1tenth_gym_ros | ||
COPY . /sim_ws/src/f1tenth_gym_ros | ||
RUN source /opt/ros/foxy/setup.bash && \ | ||
cd sim_ws/ && \ | ||
rosdep install -i --from-path src --rosdistro foxy -y && \ | ||
colcon build | ||
|
||
# CMD ["roslaunch", "package file.launch"] | ||
ENTRYPOINT ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?xml version="1.0"?> | ||
<package format="2"> | ||
<name>f1tenth_gym_ros</name> | ||
<version>0.0.0</version> | ||
<description>The f1tenth_gym_ros package</description> | ||
|
||
<maintainer email="[email protected]">Hongrui Zheng</maintainer> | ||
|
||
|
||
<!-- One license tag required, multiple allowed, one license per tag --> | ||
<!-- Commonly used license strings: --> | ||
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 --> | ||
<license>TODO</license> | ||
|
||
<buildtool_depend>catkin</buildtool_depend> | ||
<build_depend>message_filters</build_depend> | ||
<build_depend>nav_msgs</build_depend> | ||
<build_depend>roscpp</build_depend> | ||
<build_depend>rospy</build_depend> | ||
<build_depend>sensor_msgs</build_depend> | ||
<build_depend>std_msgs</build_depend> | ||
<build_depend>visualization_msgs</build_depend> | ||
<build_depend>message_generation</build_depend> | ||
<build_export_depend>message_filters</build_export_depend> | ||
<build_export_depend>nav_msgs</build_export_depend> | ||
<build_export_depend>roscpp</build_export_depend> | ||
<build_export_depend>rospy</build_export_depend> | ||
<build_export_depend>sensor_msgs</build_export_depend> | ||
<build_export_depend>std_msgs</build_export_depend> | ||
<build_export_depend>visualization_msgs</build_export_depend> | ||
<exec_depend>message_filters</exec_depend> | ||
<exec_depend>nav_msgs</exec_depend> | ||
<exec_depend>roscpp</exec_depend> | ||
<exec_depend>rospy</exec_depend> | ||
<exec_depend>sensor_msgs</exec_depend> | ||
<exec_depend>std_msgs</exec_depend> | ||
<exec_depend>visualization_msgs</exec_depend> | ||
<exec_depend>message_runtime</exec_depend> | ||
|
||
|
||
<!-- The export tag contains other, unspecified, tags --> | ||
<export> | ||
<!-- Other tools can request additional information be placed here --> | ||
|
||
</export> | ||
</package> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# MIT License | ||
|
||
# Copyright (c) 2020 Hongrui Zheng | ||
|
||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
|
||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
|
||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
import rclpy | ||
from rclpy.node import Node | ||
|
||
from sensor_msgs.msg import LaserScan | ||
from nav_msgs.msg import Odometry | ||
from geometry_msgs.msg import PoseStamped | ||
from geometry_msgs.msg import TransformStamped | ||
from geometry_msgs.msg import Transform | ||
from geometry_msgs.msg import Quaternion | ||
from ackermann_msgs.msg import AckermannDriveStamped | ||
|
||
import gym | ||
|
||
class GymBridge(Node): | ||
def __init__(self): | ||
super().__init__('gym_bridge') | ||
|
||
# env backend | ||
self.env = gym.make('f110_gym:f110_v0', | ||
map=self.get_parameter('map_path').get_parameter_value(), | ||
map_ext=self.get_parameter('map_img_ext').get_parameter_value(), | ||
num_agents=self.get_parameter('num_agent').get_parameter_value()) | ||
|
||
# params | ||
ego_scan_topic = self.get_parameter('ego_scan_topic').get_parameter_value().string_value | ||
ego_odom_topic = self.get_parameter('ego_odom_topic').get_parameter_value().string_value | ||
ego_drive_topic = self.get_parameter('ego_drive_topic').get_parameter_value().string_value | ||
opp_scan_topic = self.get_parameter('opp_scan_topic').get_parameter_value().string_value | ||
opp_odom_topic = self.get_parameter('opp_odom_topic').get_parameter_value().string_value | ||
opp_drive_topic = self.get_parameter('opp_drive_topic').get_parameter_value().string_value | ||
|
||
# sim physical step timer | ||
self.timer = self.create_timer(0.01, self.timer_callback) | ||
|
||
# publishers | ||
self.ego_scan_pub = self.create_publisher(LaserScan, ego_scan_topic, 10) | ||
self.ego_odom_pub = self.create_publisher(Odometry, ego_odom_topic, 10) | ||
|
||
# subscribers | ||
self.ego_drive_sub = self.create_subscription( | ||
AckermannDriveStamped, | ||
ego_drive_topic, | ||
self.drive_callback, | ||
10) | ||
|
||
def drive_callback(self, drive_msg): | ||
pass | ||
|
||
def pose_callback(self, pose_msg): | ||
pass | ||
|
||
def timer_callback(self): | ||
pass | ||
|
||
def main(args=None): | ||
rclpy.init(args=args) | ||
gym_bridge = GymBridge() | ||
rclpy.spin(gym_bridge) | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# MIT License | ||
|
||
# Copyright (c) 2020 Hongrui Zheng | ||
|
||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
|
||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
|
||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
from launch import LaunchDescription | ||
from launch_ros.actions import Node | ||
|
||
def generate_launch_description(): | ||
return LaunchDescription([ | ||
Node( | ||
package='f1tenth_gym_ros', | ||
executable='gym_bridge', | ||
name='bridge', | ||
parameters=[{ | ||
'ego_scan_topic': 'scan', | ||
'ego_odom_topic': 'odom', | ||
'ego_drive_topic': 'drive', | ||
'opp_scan_topic': 'opp_scan', | ||
'opp_odom_topic': 'opp_odom', | ||
'opp_drive_topic': 'opp_drive', | ||
'scan_distance_to_base_link': 0.275, | ||
'scan_fov': 4.7, | ||
'scan_beams': 1080, | ||
'map_path': '/f1tenth_gym/maps/berlin.yaml', | ||
'map_img_ext': '.png', | ||
'num_agent': 1 | ||
}] | ||
), | ||
Node( | ||
package='rviz2', | ||
executable='rviz2', | ||
name='rviz' | ||
) | ||
]) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
image: levine.png | ||
resolution: 0.050000 | ||
origin: [-51.224998, -51.224998, 0.000000] | ||
negate: 0 | ||
occupied_thresh: 0.65 | ||
free_thresh: 0.196 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,24 @@ | ||
<?xml version="1.0"?> | ||
<package format="2"> | ||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | ||
<package format="3"> | ||
<name>f1tenth_gym_ros</name> | ||
<version>0.0.0</version> | ||
<description>The f1tenth_gym_ros package</description> | ||
<description>Bridge for using f1tenth_gym in ROS2</description> | ||
<maintainer email="[email protected]">Billy Zheng</maintainer> | ||
<license>MIT</license> | ||
|
||
<maintainer email="[email protected]">Hongrui Zheng</maintainer> | ||
|
||
|
||
<!-- One license tag required, multiple allowed, one license per tag --> | ||
<!-- Commonly used license strings: --> | ||
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 --> | ||
<license>TODO</license> | ||
|
||
<buildtool_depend>catkin</buildtool_depend> | ||
<build_depend>message_filters</build_depend> | ||
<build_depend>nav_msgs</build_depend> | ||
<build_depend>roscpp</build_depend> | ||
<build_depend>rospy</build_depend> | ||
<build_depend>sensor_msgs</build_depend> | ||
<build_depend>std_msgs</build_depend> | ||
<build_depend>visualization_msgs</build_depend> | ||
<build_depend>message_generation</build_depend> | ||
<build_export_depend>message_filters</build_export_depend> | ||
<build_export_depend>nav_msgs</build_export_depend> | ||
<build_export_depend>roscpp</build_export_depend> | ||
<build_export_depend>rospy</build_export_depend> | ||
<build_export_depend>sensor_msgs</build_export_depend> | ||
<build_export_depend>std_msgs</build_export_depend> | ||
<build_export_depend>visualization_msgs</build_export_depend> | ||
<exec_depend>message_filters</exec_depend> | ||
<exec_depend>geometry_msgs</exec_depend> | ||
<exec_depend>nav_msgs</exec_depend> | ||
<exec_depend>roscpp</exec_depend> | ||
<exec_depend>rospy</exec_depend> | ||
<exec_depend>sensor_msgs</exec_depend> | ||
<exec_depend>std_msgs</exec_depend> | ||
<exec_depend>visualization_msgs</exec_depend> | ||
<exec_depend>message_runtime</exec_depend> | ||
<exec_depend>ackermann_msgs</exec_depend> | ||
<exec_depend>rclpy</exec_depend> | ||
|
||
<test_depend>ament_copyright</test_depend> | ||
<test_depend>ament_flake8</test_depend> | ||
<test_depend>ament_pep257</test_depend> | ||
<test_depend>python3-pytest</test_depend> | ||
|
||
<!-- The export tag contains other, unspecified, tags --> | ||
<export> | ||
<!-- Other tools can request additional information be placed here --> | ||
|
||
<build_type>ament_python</build_type> | ||
</export> | ||
</package> |
Empty file.
Oops, something went wrong.