Professional Documents
Culture Documents
1 / 11
Overview
1. Custom messages
2. Assignment
2 / 11
Custom messages
In assignment 0: we implemented
I Name publisher with String message type
I Roll number publisher with Numeric message type
We created separate nodes to publish each type.
3 / 11
Custom message: Student info
4 / 11
Directory structure
5 / 11
Modifications 1
The custom message type we defined needs to be built with
catkin make
We notify catkin make by modifying the contents of package.xml
file
1 <? xml v e r s i o n=” 1 . 0 ” ?>
2 <p a c k a g e f o r m a t=” 2 ”>
3 <name>t e m p l a t e a 3</name>
4 <v e r s i o n>0 . 0 . 0</ v e r s i o n>
5 <d e s c r i p t i o n>The t e m p l a t e a 3 p a c k a g e</ d e s c r i p t i o n>
6 ...
7 <b u i l d t o o l d e p e n d>c a t k i n</ b u i l d t o o l d e p e n d>
8 <b u i l d d e p e n d>r o s p y</ b u i l d d e p e n d>
9
10 <b u i l d d e p e n d>m e s s a g e g e n e r a t i o n</ b u i l d d e p e n d>
11 <e x e c d e p e n d>m e s s a g e r u n t i m e</ e x e c d e p e n d>
12
13 <b u i l d e x p o r t d e p e n d>r o s p y</ b u i l d e x p o r t d e p e n d>
14 <e x e c d e p e n d>r o s p y</ e x e c d e p e n d>
15
16 <e x p o r t>
17 <!−− O t h e r t o o l s can r e q u e s t a d d i t i o n a l i n f o r m a t i o n be p l a c e d h e r e −−>
18 </ e x p o r t>
19 </ p a c k a g e>
Line 10,11 are added to let the build system know that we want to
use custom messages.
6 / 11
Modifications 2
We also need to modify CMakeLists.txt file
1 c m a k e m i n i m u m r e q u i r e d ( VERSION 2 . 8 . 3 )
2 project ( template a3 )
3 ## Components
4 f i n d p a c k a g e ( c a t k i n REQUIRED COMPONENTS
5 rospy
6 roscpp
7 std msgs ## m o d i f i e d
8 message generation ## m o d i f i e d
9 )
10 ## G e n e r a t e m e s s a g e s i n t h e ’ msg ’ f o l d e r
11 add message files (
12 FILES
13 S t u d e n t i n f o . msg ## m o d i f i e d
14 Landmark . msg ## m o d i f i e d
15 T r i l a t e r a t i o n . msg ## m o d i f i e d
16 )
17 ## G e n e r a t e added m e s s a g e s and s e r v i c e s w i t h any d e p e n d e n c i e s l i s t e d h e r e
18 generate messages (
19 DEPENDENCIES
20 std msgs ## m o d i f i e d
21 )
22 ## c a t k i n s p e c i f i c c o n f i g u r a t i o n
23 catkin package (
24 CATKIN DEPENDS m e s s a g e r u n t i m e ##m o d i f i e d
25 )
26
27 ## S p e c i f y a d d i t i o n a l l o c a t i o n s o f h e a d e r files
28 include directories (
29 ${catkin INCLUDE DIRS}
30 )
7 / 11
Custom message: Publisher
8 / 11
Custom message : Result
9 / 11
Assignment 3
The robot loads with pose (0, 0, 0). Three landmarks are placed at [7,7], [-7,-7], [7,-7], the distance and identity of
the landmarks is being published under the topic name /trilateration data.
I Calculate the position (x,y) of robot using the trilateration data. This part of code should be written inside
the callback function (see line 30 of controller.py).
I Calculate the heading of the robot using two consecutive poses of the robot. This part will also go inside
the callback function (see line 32 of controller.py)
I Track a circular trajectory with radius 5 meter centered at origin.
I Plot the waypoints and the tracked trajectory. Save figure with labels and title.
I Calculate the mean squared error for one complete traversal of the circular trajectory.
I Sample 100 points along the tracked trajectory
I For each robot pose Xr = (x,y,θ) find the closest point Xc on the circle x 2 + y 2 = 52
I Calculate the distance to Derror and square it
I Sum all D 2
error terms and divide by 100 to obtain you MSE. Report this number in a file named
RESULT.txt.
http://bit.ly/2tdpTemplateA4
10 / 11
Thank you
11 / 11