-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInstructions.txt
More file actions
84 lines (47 loc) · 3.56 KB
/
Copy pathInstructions.txt
File metadata and controls
84 lines (47 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
----------------------------------------------------------------------------------------------------------
Using a Pan Tilt Unit (PTU)
----------------------------------------------------------------------------------------------------------
A Pan Tilt Unit as the name suggests allows you to adjust the pan and tilt of the thing connected to the unit (I am using it with a kinect camera on top). I have the Pan Tilt Unit connected via USB to my computer.
I am using the driver found on Washington University's code repository which can be found here:
https://code.google.com/p/wu-robotics/source/browse/
1) Navigate to where you want to put the files.
2) Checkout the code from the repository
svn checkout http://wu-robotics.googlecode.com/svn/trunk/wu_ptu ptu
----------------------------------------------------------------------------------------------------------
Creating a urdf model from a .xacro file
----------------------------------------------------------------------------------------------------------
Ros uses urdf models to keep track of the size and shape of a robot, the direction the robot is facing, the position of the robots joints and many more things.
Urdf files are not user editable and are generated from .xacro files using a python script which is included with Ros. .xacro files are just xml and so are user editable.
The script to convert .xacro -> urdf is:
rosrun xacro xacro.py model.xacro > model.urdf
----------------------------------------------------------------------------------------------------------
Creating a custom ROS Message type and importing into ROSJava
----------------------------------------------------------------------------------------------------------
To create a custom message type in ROS follow the instructions in the following ROS Tutorial
http://wiki.ros.org/ROS/Tutorials/CreatingMsgAndSrv#Creating_a_msg
To import the custom message type into ROSJava you must first delete the messages compiled and recompile them
To do this cd into the rosjava_messages folder
roscd rosjava_messages
(Note this command does not work on my setup and so the command that should be used is roscd rosjava_core; cd rosjava_messages)
You can then delete the compiled rosjava messages by using the command:
rm -rf build/generated-src
Then recompile the source by running the following command:
../gradlew install
This then recompiles the source and the messages should have been created. To check, check the build/generated-src folder for the folder relating to the name of your message type
----------------------------------------------------------------------------------------------------------
Importing a ROS Image into the ROSJava BufferedImage format
----------------------------------------------------------------------------------------------------------
To import images from a ROS Image format into the ROSJava BufferedImage format the following code snippet is useful:
import sensor_msgs.Image;
public void receivedImage(Image image) {
DataBuffer videoBuffer = new DataBufferByte(image.getData().array(),
image.getData().array().length);
latestImage = new BufferedImage(image.getWidth(), image.getHeight(),
BufferedImage.TYPE_INT_BGR);
ComponentSampleModel sampleModel = new ComponentSampleModel(
DataBuffer.TYPE_BYTE, image.getWidth(), image.getHeight(), 3,
image.getWidth() * 3, new int[] { 2, 1, 0 });
Raster raster = Raster.createRaster(sampleModel, videoBuffer, null);
latestImage.setData(raster);
}
This can be used when using the Kinect camera system to import the rgb image into ROSJava.