DRC Vehicle commands via rospy
Hi, I am trying to control the DRC Vehicle using a python code to substitute the rostopic pub commands given through the terminal, however, I'm not making much headway. On running the code, rostopic echo returns the default values for all parameters. This is the code I have tried: (I'm very new to ROS and Gazebo, recently started learning)
import roslib; roslib.loadmanifest('vehiclecontrol') import rospy from stdmsgs.msg import Float64 from stdmsgs.msg import Int8
def mover(): rospy.initnode('vehiclecontrol')
rospy.loginfo("Release brake.")
pub1=rospy.Publisher('/drc_vehicle_xp900/hand_brake/cmd', Float64)
pub1.publish(data=0.0)
rospy.sleep(3);
rospy.loginfo("Moving forward.")
pub2=rospy.Publisher('/drc_vehicle_xp900/gas_pedal/cmd', Float64)
pub2.publish(data=1.0)
rospy.sleep(3);
rospy.loginfo("Turning right.")
pub3=rospy.Publisher('/drc_vehicle_xp900/hand_wheel/cmd', Float64)
pub3.publish(data=3.14)
rospy.sleep(3);
rospy.loginfo("Killing engine.")
pub5=rospy.Publisher('/drc_vehicle_xp900/key/cmd', Int8)
pub5.publish(data=0)
rospy.sleep(3);
if name == 'main': try: mover() except rospy.ROSInterruptException: pass
Any help would be great, thanks in advance!
Asked by karthikj219 on 2015-06-16 23:32:31 UTC
Comments