Skip to content

Commit

Permalink
More documentation about dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
horverno committed Feb 3, 2021
1 parent 4eb1b55 commit e521fe2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
8 changes: 7 additions & 1 deletion lgsvl_nissanleaf_ros/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ rosparam set lgsvl_location gyor
rosparam set lgsvl_location zero
rosrun lgsvl_nissanleaf_ros odom_to_pose.py
```
To start the static + dynamic trasforms and the bridge (in case of Windows), run:
```
roslaunch lgsvl_nissanleaf_ros tf_bridge.launch
```

To start the static + dynamic trasforms, the vehicle model and the bridge (in case of Windows), run:
```
Expand All @@ -27,4 +31,6 @@ roslaunch lgsvl_nissanleaf_ros tf_model.launch
```

## Dependencies
- [nissan_leaf_ros](https://github.com/szenergy/nissan_leaf_ros)/nissan_brigup contains the 3D rviz model
- [lgsvl_msgs](https://github.com/lgsvl/lgsvl_msgs) LGSVL related ROS message types, clone and build in the catkin workspace
- [rosbridge-server](http://wiki.ros.org/rosbridge_server) simply install with `sudo apt install ros-$ROS_DISTRO-rosbridge-server`
- [nissan_leaf_ros](https://github.com/szenergy/nissan_leaf_ros)/nissan_brigup contains the 3D rviz model (optional for visualization in RVIZ)
12 changes: 12 additions & 0 deletions lgsvl_nissanleaf_ros/launch/tf_bridge.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
TF: static + 1 dynamic transform
BRIDGE: roslaunch rosbridge_server rosbridge_websocket.launch
-->
<launch>
<!-- tf -->
<include file="$(find lgsvl_nissanleaf_ros)/launch/tf.launch" />

<!-- bridge -->
<include file="$(find lgsvl_nissanleaf_ros)/launch/bridge.launch" />
</launch>
32 changes: 21 additions & 11 deletions lgsvl_nissanleaf_ros/script/canbus_to_autoware.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
import rospy
import lgsvl_msgs.msg as lgsvl
import geometry_msgs.msg as geomsg
import autoware_msgs.msg as autoware
autoware_installed = True
try:
import autoware_msgs.msg as autoware
except:
autoware_installed = False


pub_velocity = None
pub_vehiclestatus= None


def canCallBack(msg):
global pub_velocity,pub_vehiclestatus
global pub_velocity,pub_vehiclestatus, autoware_installed

#publish current_velocity
vel_msg=geomsg.TwistStamped()
Expand All @@ -20,14 +26,15 @@ def canCallBack(msg):
if pub_velocity is not None:
pub_velocity.publish(vel_msg)

# publish vehicle_status
vehicle_msg=autoware.VehicleStatus()
vehicle_msg.header.stamp = rospy.Time.now()
vehicle_msg.header.frame_id = "base_link"
vehicle_msg.speed=msg.speed_mps #m/s
vehicle_msg.angle=-msg.steer_pct*31*(3.14/180) #rad todo:revision steering limit
if pub_vehiclestatus is not None:
pub_vehiclestatus.publish(vehicle_msg)
# publish vehicle_status
if autoware_installed is True:
vehicle_msg=autoware.VehicleStatus()
vehicle_msg.header.stamp = rospy.Time.now()
vehicle_msg.header.frame_id = "base_link"
vehicle_msg.speed=msg.speed_mps #m/s
vehicle_msg.angle=-msg.steer_pct*31*(3.14/180) #rad todo:revision steering limit
if pub_vehiclestatus is not None:
pub_vehiclestatus.publish(vehicle_msg)


def listener():
Expand All @@ -36,7 +43,10 @@ def listener():
rospy.Subscriber("/canbus", lgsvl.CanBusData, canCallBack)

pub_velocity = rospy.Publisher("/current_velocity", geomsg.TwistStamped, queue_size=10)
pub_vehiclestatus=rospy.Publisher("/vehicle_status", autoware.VehicleStatus, queue_size=10)
if autoware_installed is True:
pub_vehiclestatus=rospy.Publisher("/vehicle_status", autoware.VehicleStatus, queue_size=10)
else:
rospy.logwarn("Autoware is not installed")
rospy.loginfo("current_velocity and vehicle_status are publishing")

rospy.spin()
Expand Down

0 comments on commit e521fe2

Please sign in to comment.