Difference between revisions of "Adapting SyRoTek Intro to ROS Code"
From wikidb
(→With rviz Model) |
(→Quaternions) |
||
(7 intermediate revisions by the same user not shown) | |||
Line 77: | Line 77: | ||
roscore | roscore | ||
− | Terminal 2 | + | Terminal 2 - TBD - Explain the hack |
− | roslaunch floor_hugger | + | roslaunch floor_hugger motor_control_hack.launch |
Terminal 3 | Terminal 3 | ||
Line 99: | Line 99: | ||
= With rviz Model = | = With rviz Model = | ||
− | In seperate terminals: | + | In seperate terminals. TBD: There are some order dependencies that need to be determined. |
roscore | roscore | ||
− | roslaunch floor_hugger motor_control.launch | + | roslaunch floor_hugger tf_map.launch |
+ | |||
+ | // roslaunch floor_hugger motor_control.launch | ||
+ | roslaunch floor_hugger motor_control_hack.launch // Correct for wheel direction | ||
roslaunch floor_hugger odometry.launch | roslaunch floor_hugger odometry.launch | ||
− | |||
− | |||
roscd floor_hugger/model | roscd floor_hugger/model | ||
roslaunch urdf_tutorial display.launch model:=floor_hugger.urdf | roslaunch urdf_tutorial display.launch model:=floor_hugger.urdf | ||
− | rosrun syrotek pid -f | + | rosrun syrotek pid -f 2 |
* In rviz change the add odometry | * In rviz change the add odometry | ||
Line 120: | Line 121: | ||
* In Grid change reference frame to odom | * In Grid change reference frame to odom | ||
* Configuration stored in floor_hugger/config/floor_hugger.rviz | * Configuration stored in floor_hugger/config/floor_hugger.rviz | ||
+ | |||
+ | |||
+ | [[Image:PID_move_rviz.png|800px]] | ||
+ | |||
+ | = Quaternions = | ||
+ | |||
+ | * [http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-17-quaternions/ OpenGL Tutorial] | ||
+ | * [https://en.wikipedia.org/wiki/Quaternion Ouaternion from Wikipedia] | ||
+ | * [http://answers.ros.org/question/9772/quaternions-orientation-representation/ ROS Answer] | ||
= MathJax = | = MathJax = |
Latest revision as of 10:44, 2 June 2016
Contents
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 - TBD - Explain the hack
roslaunch floor_hugger motor_control_hack.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
With rviz Model
In seperate terminals. TBD: There are some order dependencies that need to be determined.
roscore roslaunch floor_hugger tf_map.launch // roslaunch floor_hugger motor_control.launch roslaunch floor_hugger motor_control_hack.launch // Correct for wheel direction roslaunch floor_hugger odometry.launch roscd floor_hugger/model roslaunch urdf_tutorial display.launch model:=floor_hugger.urdf rosrun syrotek pid -f 2
- In rviz change the add odometry
- Change the topic to /odom
- rviz odometry display
- In Global Options change fixed Frame to map
- In Grid change reference frame to odom
- Configuration stored in floor_hugger/config/floor_hugger.rviz