Commit 1bd4c868 authored by Arnaud Blanchard's avatar Arnaud Blanchard

With texture

parent 06a67daf
......@@ -11,7 +11,7 @@ list(APPEND CMAKE_CXX_FLAGS "${GAZEBO_CXX_FLAGS}")
add_library(planting_camera SHARED planting_camera.cpp)
set_target_properties(planting_camera PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_link_libraries(planting_camera ${BL_LIBRARIES} ${GAZEBO_LIBRARIES})
target_link_libraries(planting_camera ${BL_LIBRARIES} ${GAZEBO_LIBRARIES} CameraPlugin)
add_library(planting_robot SHARED gripper.cpp)
set_target_properties(planting_robot PROPERTIES POSITION_INDEPENDENT_CODE ON)
......
......@@ -5,7 +5,6 @@
#include <unistd.h>
#include "blc_channel.h"
enum { RIGHT_FRONT, RIGHT_REAR,LEFT_FRONT, LEFT_REAR};
using namespace gazebo;
......@@ -15,7 +14,6 @@ class Planting_camera : public CameraPlugin
{
private:
blc_channel camera;
event::ConnectionPtr updateConnection;
public:
void Load(sensors::SensorPtr _model, sdf::ElementPtr _sdf);
......@@ -25,15 +23,14 @@ public:
GZ_REGISTER_SENSOR_PLUGIN(Planting_camera)
// Called by the world update start event
void Planting_camera::OnNewFrame(unsigned char const*, unsigned int, unsigned int, unsigned int, const std::string &format){
void Planting_camera::OnNewFrame(unsigned char const* image, unsigned int width, unsigned int height, unsigned int depth, const std::string &format){
memcpy(camera.data, image, camera.size);
}
void Planting_camera::Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf){
// CameraPlugin::Load(_parent, _sdf);
camera.create_or_open("/camera", BLC_CHANNEL_READ, 'UIN8', 'NDEF', 3, 3, 320, 200);
// updateConnection = event::Events::ConnectWorldUpdateBegin(std::bind(&Planting_camera::OnNewFrame, this));
}
CameraPlugin::Load(_parent, _sdf);
camera.create_or_open("/camera", BLC_CHANNEL_WRITE, 'UIN8', 'RGB3', 3, 3, 320, 240);
}
......
......@@ -50,9 +50,9 @@
</plane>
</geometry>
<material>
<script>
<uri>file://media/materials/scripts/gazebo.material</uri>
<name>Gazebo/Grey</name>
<script>
<file>materials/scripts/ground.material</file>
<name>Ground/Image</name>
</script>
</material>
</visual>
......@@ -73,9 +73,15 @@
<ambient>0.4 0.4 0.4 1</ambient>
<background>0.7 0.7 0.7 1</background>
<shadows>1</shadows>
<sky>
<clouds>
<speed>12</speed>
</clouds>
</sky>
</scene>
<audio>
<device>default</device>
<device>default</device>
</audio>
<wind/>
<spherical_coordinates>
......@@ -409,7 +415,7 @@
<right_rear>right_rear</right_rear>
<left_front>left_front</left_front>
<left_rear>left_rear</left_rear>
</plugin>
</plugin>
</model>
<state world_name='default'>
<sim_time>3240 967000000</sim_time>
......@@ -524,6 +530,7 @@
</geometry>
</visual>
<sensor name='camera' type='camera'>
<plugin name='libplanting_camera' filename='libplanting_camera.so'>
<camera name='__default__'>
<horizontal_fov>1.047</horizontal_fov>
<image>
......@@ -532,12 +539,13 @@
</image>
<clip>
<near>0.1</near>
<far>100</far>
</clip>
<far>100</far> </clip>
</camera>
<always_on>1</always_on>
<update_rate>30</update_rate>
<visualize>1</visualize>
</plugin>
</sensor>
<self_collide>0</self_collide>
<enable_wind>0</enable_wind>
......
material Ground/Image
{
technique
{
pass
{
ambient 0.5 0.5 0.5 1.0
diffuse 1.0 1.0 1.0 1.0
specular 0.0 0.0 0.0 1.0
texture_unit
{
texture ground.jpg
filtering trilinear
}
}
}
}
<model>
<name>r-stepps</name>
<version>1.0</version>
<sdf version="1.0">r-stepps.sdf</sdf>
<description>
Robots for r-stepps' project
</description>
</model>
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment