Skip to content

Commit

Permalink
new steering node works
Browse files Browse the repository at this point in the history
1. be aware of image publisher name bug.
2. perhaps write in more warning
  • Loading branch information
NeilNie committed Aug 5, 2018
1 parent 1c407ea commit 367d8a2
Show file tree
Hide file tree
Showing 28 changed files with 478 additions and 1,025 deletions.
402 changes: 230 additions & 172 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ros/build/catkin_generated/installspace/_setup_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def _parse_arguments(args=None):
sys.exit(1)

# environment at generation time
CMAKE_PREFIX_PATH = '/home/neil/Workspace/self-driving-golf-cart/devel;/opt/ros/kinetic'.split(';')
CMAKE_PREFIX_PATH = '/opt/ros/kinetic'.split(';')
# prepend current workspace if not already part of CPP
base_path = os.path.dirname(__file__)
if base_path not in CMAKE_PREFIX_PATH:
Expand Down
8 changes: 4 additions & 4 deletions ros/build/catkin_generated/setup_cached.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
# new environment variables

# modified environment variables
export CMAKE_PREFIX_PATH="/home/neil/Workspace/self-driving-golf-cart/ros/devel:/opt/ros/kinetic"
export CMAKE_PREFIX_PATH="/home/neil/Workspace/self-driving-golf-cart/ros/devel:$CMAKE_PREFIX_PATH"
export LD_LIBRARY_PATH="/home/neil/Workspace/self-driving-golf-cart/ros/devel/lib:/opt/ros/kinetic/lib:/opt/ros/kinetic/lib/x86_64-linux-gnu:/usr/local/cuda-9.0/lib64"
export PKG_CONFIG_PATH="/home/neil/Workspace/self-driving-golf-cart/ros/devel/lib/pkgconfig:/opt/ros/kinetic/lib/pkgconfig:/opt/ros/kinetic/lib/x86_64-linux-gnu/pkgconfig"
export PKG_CONFIG_PATH="/home/neil/Workspace/self-driving-golf-cart/ros/devel/lib/pkgconfig:$PKG_CONFIG_PATH"
export PWD="/home/neil/Workspace/self-driving-golf-cart/ros/build"
export PYTHONPATH="/home/neil/Workspace/self-driving-golf-cart/ros/devel/lib/python2.7/dist-packages:/opt/ros/kinetic/lib/python2.7/dist-packages"
export PYTHONPATH="/home/neil/Workspace/self-driving-golf-cart/ros/devel/lib/python2.7/dist-packages:$PYTHONPATH"
export ROSLISP_PACKAGE_DIRECTORIES="/home/neil/Workspace/self-driving-golf-cart/ros/devel/share/common-lisp"
export ROS_PACKAGE_PATH="/home/neil/Workspace/self-driving-golf-cart/ros/src:/opt/ros/kinetic/share"
export ROS_PACKAGE_PATH="/home/neil/Workspace/self-driving-golf-cart/ros/src:$ROS_PACKAGE_PATH"
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ if __name__ == '__main__':
sys.exit(1)

# environment at generation time
CMAKE_PREFIX_PATH = '/home/neil/Workspace/self-driving-golf-cart/devel;/opt/ros/kinetic'.split(';')
CMAKE_PREFIX_PATH = '/opt/ros/kinetic'.split(';')
# prepend current workspace if not already part of CPP
base_path = os.path.dirname(__file__)
if base_path not in CMAKE_PREFIX_PATH:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ if(NOT " " STREQUAL " ")
elseif(NOT " " STREQUAL " ")
set(_report "Check the website '' for information and consider reporting the problem.")
else()
set(_report "Report the problem to the maintainer 'yongyang <yongyang@todo.todo>' and request to fix the problem.")
set(_report "Report the problem to the maintainer 'yongyang <yongyang.nie@gmail.com>' and request to fix the problem.")
endif()
foreach(idir ${_include_dirs})
if(IS_ABSOLUTE ${idir} AND IS_DIRECTORY ${idir})
Expand Down
2 changes: 1 addition & 1 deletion ros/build/steering_control/catkin_generated/package.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set(_CATKIN_CURRENT_PACKAGE "steering_control")
set(steering_control_VERSION "0.0.0")
set(steering_control_MAINTAINER "yongyang <yongyang@todo.todo>")
set(steering_control_MAINTAINER "yongyang <yongyang.nie@gmail.com>")
set(steering_control_PACKAGE_FORMAT "2")
set(steering_control_BUILD_DEPENDS "roscpp" "rospy" "rosserial_client" "rosserial_msgs" "rosserial_python" "std_msgs")
set(steering_control_BUILD_EXPORT_DEPENDS "roscpp" "rospy" "rosserial_client" "rosserial_msgs" "rosserial_python" "std_msgs")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
<maintainer email="yongyang@todo.todo">yongyang</maintainer>
<maintainer email="yongyang.nie@gmail.com">yongyang</maintainer>


<!-- One license tag required, multiple allowed, one license per tag -->
Expand Down
2 changes: 1 addition & 1 deletion ros/devel/_setup_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def _parse_arguments(args=None):
sys.exit(1)

# environment at generation time
CMAKE_PREFIX_PATH = '/home/neil/Workspace/self-driving-golf-cart/devel;/opt/ros/kinetic'.split(';')
CMAKE_PREFIX_PATH = '/opt/ros/kinetic'.split(';')
# prepend current workspace if not already part of CPP
base_path = os.path.dirname(__file__)
if base_path not in CMAKE_PREFIX_PATH:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ if(NOT " " STREQUAL " ")
elseif(NOT " " STREQUAL " ")
set(_report "Check the website '' for information and consider reporting the problem.")
else()
set(_report "Report the problem to the maintainer 'yongyang <yongyang@todo.todo>' and request to fix the problem.")
set(_report "Report the problem to the maintainer 'yongyang <yongyang.nie@gmail.com>' and request to fix the problem.")
endif()
foreach(idir ${_include_dirs})
if(IS_ABSOLUTE ${idir} AND IS_DIRECTORY ${idir})
Expand Down
16 changes: 16 additions & 0 deletions ros/src/driver/launch/drive.launch
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
<!--
##################################################
This is the master launch file for the program.
if you are looking for a way to run the system
as a whole, you are at the right place. Currently,
rviz and rosbag are running as default. No random
changes accepted
(c) Yongyang Nie, 2018
All Rights Reserved.
##################################################
-->


<launch>

<!--open up the camera -->
Expand All @@ -8,6 +23,7 @@
<param name="port" value="/dev/ttyACM0" />
</node>

<!-- launch steering node -->
<include file="$(find steering_control)/launch/steering_control.launch"/>

<!-- open rviz launch -->
Expand Down
6 changes: 4 additions & 2 deletions ros/src/simulation/scripts/camera_sim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"""
publish the frames of the dataset
under the topic of: /cv_camera_node/image_sim
under the topic of: /cv_camera/image_sim
(c) Neil Nie, 2018
All Rights Reserved
Expand All @@ -16,6 +16,8 @@ import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError

# TODO: waiting to be completed


class CameraSim():

Expand All @@ -24,7 +26,7 @@ class CameraSim():
rospy.init_node('cv_camera_sim')
self.bridge = CvBridge()

self.camera_pub = rospy.Publisher('/cv_camera_node/image_sim', Image, queue_size=10)
self.camera_pub = rospy.Publisher('/cv_camera/image_sim', Image, queue_size=10)
self.rate = rospy.Rate(15)

self.frame_path = rospy.get_param("/simulation/frame_path")
Expand Down
9 changes: 9 additions & 0 deletions ros/src/steering_control/launch/steering.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<launch>

<node name="steering_node" type="steering_node" pkg="steering_control">
<param name="/model_path" value="$(find steering_control)/scripts/weights/i3d_rgb_64_8.h5" />
<param name="length" value="64" />
<param name="scale_factor" value='30' />
</node>

</launch>
7 changes: 1 addition & 6 deletions ros/src/steering_control/launch/steering_control.launch
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<launch>

<node name="steering_controller" type="steering_controller" pkg="steering_control">
<param name="/model_path" value="/home/neil/Workspace/self-driving-golf-cart/src/steering_control/scripts/weights/own/trained-cai-v6.h5" />
<param name="image_height" value="480" />
<param name="image_width" value="640" />
<param name="scale_factor" value="20" />
</node>
<include file="$(find steering_control)/launch/steering.launch"> </include>

<node name="steering_visualization" type="visualization.py" pkg="steering_control" />

Expand Down
20 changes: 0 additions & 20 deletions ros/src/steering_control/launch/steering_so.launch

This file was deleted.

13 changes: 13 additions & 0 deletions ros/src/steering_control/launch/steering_stand_alone.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<launch>

<!--open up the camera -->
<node name="cv_camera_node" pkg="cv_camera" type="cv_camera_node" />

<!-- setup the Arduino serial -->
<node name="serial_node" pkg="rosserial_python" type="serial_node.py">
<param name="port" value="/dev/ttyACM0" />
</node>

<include file="$(find steering_control)/launch/steering_control.launch"/>

</launch>
2 changes: 1 addition & 1 deletion ros/src/steering_control/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
<maintainer email="yongyang@todo.todo">yongyang</maintainer>
<maintainer email="yongyang.nie@gmail.com">yongyang</maintainer>


<!-- One license tag required, multiple allowed, one license per tag -->
Expand Down
48 changes: 7 additions & 41 deletions ros/src/steering_control/scripts/models/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
dir = "/Volumes/Personal_Drive/Datasets/udacity-driving/dataset-2/"
dir3 = "/Volumes/Personal_Drive/Datasets/udacity-driving/dataset-3/"
dir2 = "/Volumes/Personal_Drive/Datasets/udacity-driving/dataset-1/"
# val_dir = "/Volumes/Personal_Drive/Datasets/udacity-driving/steering_validation/"
# ---------------------------------------------------------------------------------

dataset_dirs = ["/home/neil/dataset/steering/train/part-1",
Expand All @@ -21,17 +20,7 @@

# ---------------------------------------------------------------------------------

# TRAINING
image_width = 320
image_height = 160
load_weights = True

model_path = './str-cai-self-v3.h5'
# model_path = "./weights/own/trained-cai-v6.h5"
# model_path = "/Users/yongyangnie/Developer/self-driving-golf-cart/steering/weights/own/trained-cai-v6.h5"
# model_path = "./steering/weights/training/str-cai-self-v2.h5"

train_model_path = "./str-cai-self-v1.h5"

BLACK = ( 0, 0, 0)
WHITE = (255, 255, 255)
Expand All @@ -41,37 +30,14 @@

# -----------------------------------------

# define some constants

# RNNs are typically trained using (truncated) backprop through time. SEQ_LEN here is the length of BPTT.
# Batch size specifies the number of sequence fragments used in a sigle optimization step.
# (Actually we can use variable SEQ_LEN and BATCH_SIZE, they are set to constants only for simplicity).
# LEFT_CONTEXT is the number of extra frames from the past that we append to the left of our input sequence.
# We need to do it because 3D convolution with "VALID" padding "eats" frames from the left, decreasing
# the sequence length.One should be careful here to maintain the model's causality.

SEQ_LEN = 10
BATCH_SIZE = 4
LEFT_CONTEXT = 5

# These are the input image parameters.
HEIGHT = 480
WIDTH = 640
IMG_WIDTH = 224
IMG_HEIGHT = 224
CHANNELS = 3
LENGTH = 64

# The parameters of the LSTM that keeps the model state.
RNN_SIZE = 32
RNN_PROJ = 32

KEEP_PROB_TRAIN = 0.25

NUM_EPOCHS = 2
VAL_DIR = '/home/neil/dataset/steering/test/'
CC_VAL_DIR = '/home/neil/dataset/udacity/'

CSV_HEADER = "index, timestamp, width, height, frame_id, filename, angle, torque, speed, lat, long, alt".split(",")
OUTPUTS = CSV_HEADER[-6:-3] # angle,torque,speed
OUTPUT_DIM = len(OUTPUTS) # predict all features: steering angle, torque and vehicle speed
MODEL_PATH = ""

DS_PATH = "/home/neil/dataset/udacity/"
TRAIN_DS_PATH = "/home/neil/dataset/udacity/main.csv"
TEST_DS_PATH = "/home/neil/dataset/udacity/test.csv"
VAL_DIR = "/home/neil/dataset/steering/test/"
LOG_PATH = './logs/64_rgb'
Binary file modified ros/src/steering_control/scripts/models/configs.pyc
Binary file not shown.
Binary file modified ros/src/steering_control/scripts/models/helper.pyc
Binary file not shown.
Binary file added ros/src/steering_control/scripts/models/i3d.pyc
Binary file not shown.

0 comments on commit 367d8a2

Please sign in to comment.