Skip to content

Commit

Permalink
Add joy_mapper_test.launch to test joy_mapper. Output steering and sp…
Browse files Browse the repository at this point in the history
…eed between -1 an 1.
  • Loading branch information
shihyuan committed Dec 11, 2015
1 parent e112366 commit db4cc11
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions catkin_ws/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
devel/
build/
build/
devel/
12 changes: 12 additions & 0 deletions catkin_ws/src/joy_mapper/launch/joy_mapper_test.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<launch>
<!-- <group ns="veh_name"> -->
<!-- Launch joy -->
<node pkg="joy" type="joy_node" name="joy" output="screen">
<param name="~dev" value="/dev/input/js0"/>
<param name="~deadzone" value="0.1"/>
</node>
<node pkg="joy_mapper" type="joy_mapper.py" name="joy_mapper" output="screen">
<param name="~pub_timestep" value="0.02"/>
</node>
<!-- </group> -->
</launch>
8 changes: 4 additions & 4 deletions catkin_ws/src/joy_mapper/script/joy_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def __init__(self):

# Setup Parameters
self.pub_timestep = self.setupParam("~pub_timestep",0.02)
self.speed_gain = self.setupParam("~speed_gain",1.0)
self.steer_gain = self.setupParam("~steer_gain",np.pi*(15.0/180.0))
# self.speed_gain = self.setupParam("~speed_gain",1.0)
# self.steer_gain = self.setupParam("~steer_gain",np.pi*(15.0/180.0))

# Publications
self.pub_control = rospy.Publisher("~joy_control",CarControl,queue_size=1)
Expand All @@ -38,8 +38,8 @@ def cbLaneControl(self,lane_control_msg):
def publishControl(self,event):
car_control_msg = CarControl()
car_control_msg.need_steering = False
car_control_msg.speed = self.joy.axes[1]*self.speed_gain #Left stick V-axis. Up is positive
car_control_msg.steering = self.joy.axes[3]*self.steer_gain #Right stick H-axis. Right is negative
car_control_msg.speed = self.joy.axes[1] #*self.speed_gain #Left stick V-axis. Up is positive
car_control_msg.steering = self.joy.axes[3] #*self.steer_gain #Right stick H-axis. Right is negative
self.pub_control.publish(car_control_msg)


Expand Down

0 comments on commit db4cc11

Please sign in to comment.