Difference between revisions of "Adapting SyRoTek Intro to ROS Code"

From wikidb
Jump to: navigation, search
(Put the source in place)
(Modifications)
Line 78: Line 78:
 
       ---
 
       ---
 
       > #define MAX_SPEED 5.0        //!<Maximum speed of robot.
 
       > #define MAX_SPEED 5.0        //!<Maximum speed of robot.
 +
 +
= Execute =
 +
 +
Terminal 1
 +
  roscore
 +
 +
Terminal 2
 +
  roslaunch floor_hugger motor_control.launch
 +
 +
Terminal 3
 +
  roslaunch floor_hugger odometry.launc
 +
 +
Terminal 4
 +
  rosrun syrotek pid -f 0.4
 +
or
 +
  rosrun syrotek cmd -f 0.4
 +
 +
Watch the odomometry messages in another terminal
 +
  rostopic echo odom

Revision as of 17:34, 11 May 2016

References

MathJax

Code Download

PID

 tar xzf dem_pid.tar.gz

Dead Reckoning

Got it from the SyRoTek lesson web pages.

Setting up the project

Build

 cd /home/eepp/catkin_ws_indigo/src
 
 catkin_create_pkg syrotek roscpp rospy std_msgs
 
 cd ..
 
 catkin_make

Update Meta Files

 emacs CMakeList.txt

added the following to the end

   # for DeadReckoning
   set (SRCS1 ${SRCS1} src/myPoint.cpp)
   set (SRCS1 ${SRCS1} src/node_pid.cpp)
   set (SRCS1 ${SRCS1} src/pid.cpp)
   set (SRCS2 ${SRCS2} src/node_deadReckoningI.cpp)
   set (SRCS2 ${SRCS2} src/deadReckoningI.cpp)
   include_directories(include ${catkin_INCLUDE_DIRS})
   add_executable(cmd ${SRCS1})
   target_link_libraries(cmd ${catkin_LIBRARIES})
   add_executable(deadReckoningReg ${SRCS2})
   target_link_libraries(deadReckoningReg ${catkin_LIBRARIES})
   
   # for PID
   add_executable(pid ${SRCS1})
   target_link_libraries(pid ${catkin_LIBRARIES})
   add_dependencies(pid beginner_tutorials_generate_message_cpp)

Put the source in place

 roscd syrotek/
 
 ll src
     -rw-rw-r-- 1 eepp eepp 1022 May  9 12:10 deadReckoningI.cpp
     -rw-rw-r-- 1 eepp eepp  525 May  9 13:28 myPoint.cpp
     -rw-rw-r-- 1 eepp eepp 3105 May  9 12:09 node_deadReckoningI.cpp
     -rw-rw-r-- 1 eepp eepp 4125 May  9 13:29 node_pid.cpp
     -rw-rw-r-- 1 eepp eepp 2766 May  9 18:35 pid.cpp
 
 ll include
     -rw-rw-r-- 1 eepp eepp  924 May  9 13:27 myPoint.h
     -rw-rw-r-- 1 eepp eepp 1968 May  9 13:36 node_deadReckoningI.h
     -rw-rw-r-- 1 eepp eepp 2997 May  9 13:27 node_pid.h

Modifications

 diff pid.cpp.org pid.cpp
     13c13
     < #define MAX_SPEED 0.5         //!<Maximum speed of robot.
     ---
     > #define MAX_SPEED 5.0         //!<Maximum speed of robot.

Execute

Terminal 1

 roscore

Terminal 2

 roslaunch floor_hugger motor_control.launch 

Terminal 3

 roslaunch floor_hugger odometry.launc

Terminal 4

 rosrun syrotek pid -f 0.4

or

 rosrun syrotek cmd -f 0.4

Watch the odomometry messages in another terminal

 rostopic echo odom