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

From wikidb
Jump to: navigation, search
(With rviz Model)
(With rviz Model)
Line 109: Line 109:
 
   roscd floor_hugger/model
 
   roscd floor_hugger/model
 
   
 
   
   roslaunch urdf_tutorial display.launch model:=floor_hugger_05.urdf
+
   roslaunch urdf_tutorial display.launch model:=floor_hugger.urdf
  
 
*  In rviz change the add odometry
 
*  In rviz change the add odometry

Revision as of 22:48, 15 May 2016

References

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.launch

Terminal 4

 rosrun syrotek pid -f 0.4

or

 rosrun syrotek cmd -f 0.4

Investigate

Watch the odomometry messages in another terminal

 rostopic echo odom
 
 rqt_graph

Pid rqt graph.png

With rviz Model

TBD - This almost works. Map and Odom need to be linked in correctly

Another Terminal

 roslaunch floor_hugger tf_map.launch

Another Terminal

 roscd floor_hugger/model

 roslaunch urdf_tutorial display.launch model:=floor_hugger.urdf
  • In rviz change the add odometry
  • In Global Options change fixed Frame to map

MathJax