Difference between revisions of "Adapting SyRoTek Intro to ROS Code"
From wikidb
m (Edc moved page Twist Motion to Adapting SyRoTek Intro to ROS Code) |
(→Quaternions) |
||
(24 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
* [https://www.researchgate.net/publication/229003977_Syrotek_a_robotic_system_for_education paper] | * [https://www.researchgate.net/publication/229003977_Syrotek_a_robotic_system_for_education paper] | ||
* [https://www.researchgate.net/publication/221130409_A_Technical_Solution_of_a_Robotic_e-Learning_System_in_the_SyRoTek_Project SyRoTek Paper] | * [https://www.researchgate.net/publication/221130409_A_Technical_Solution_of_a_Robotic_e-Learning_System_in_the_SyRoTek_Project SyRoTek Paper] | ||
+ | |||
+ | = Code Download = | ||
+ | == PID == | ||
+ | |||
+ | * [https://syrotek.felk.cvut.cz/about/code download] | ||
+ | |||
+ | 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 | ||
+ | |||
+ | [[Image:pid_rqt_graph.png|800px]] | ||
+ | |||
+ | = 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 | ||
+ | ** [http://wiki.ros.org/rviz/DisplayTypes/Odometry 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 | ||
+ | |||
+ | |||
+ | [[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