# Revision history [back]

### Rendering error of camera sensor (partially gray image)

I use a camera plugin to create an image for each iteration of a controller. However, quite often, rendering errors occur. This is how the image should look like (piece of wood lying on the ground [dark gray] with "sky" in the background [light gray]):

This is how the image looks sometimes:

And this is the predominant outcome of the rendering:

It seems like the rendering starts at the top of the image and is interrupted at some point during the task. The shown images are have been created in one run without change of code (see below). Any ideas what might be the cause of this error?

Gazebo version is 7.0.0.

This is the code from the camera plugin:

class FlipBook : public ModelPlugin
{
private:
std::shared_ptr<gazebo::sensors::CameraSensor> camera;
ros::NodeHandle* rosnode_;
ros::Subscriber sub_;
physics::ModelPtr model;
public:
{
// Store the pointer to the model
this->model = _parent;

int argc = 0;
char** argv = NULL;
ros::init(argc, argv, "ModelPublisher", ros::init_options::NoSigintHandler | ros::init_options::AnonymousName);
rosnode_ = new ros::NodeHandle("robot/");

// Subscribe
sub_ = rosnode_->subscribe("data", 100, &FlipBook::callback, this);

gazebo::sensors::SensorManager *mgr = gazebo::sensors::SensorManager::Instance();
this->camera=std::static_pointer_cast<gazebo::sensors::CameraSensor>(mgr->GetSensor("my_camera"));
}

void createImage(const std_msgs::Float64MultiArray::ConstPtr& data) {
camera->SaveFrame (std::string("/home/user/catkin_ws/camera/temp.jpg"); // <---- This is used to create the images.
}
// Register this plugin with the simulator
GZ_REGISTER_MODEL_PLUGIN(ModelPush)
}


### Rendering error of camera sensor (partially gray image)

I use a camera plugin to create an image for each iteration of a controller. However, quite often, rendering errors occur. This is how the image should look like (piece of wood lying on the ground [dark gray] with "sky" in the background [light gray]):

This is how the image looks sometimes:

And this is the predominant outcome of the rendering:

Edit: In all cases, the function returns True (successful).

It seems like the rendering starts at the top of the image and is interrupted at some point during the task. The shown images are have been created in one run without change of code (see below). Any ideas what might be the cause of this error?

Gazebo version is 7.0.0.

This is the code from the camera plugin:

class FlipBook : public ModelPlugin
{
private:
std::shared_ptr<gazebo::sensors::CameraSensor> camera;
ros::NodeHandle* rosnode_;
ros::Subscriber sub_;
physics::ModelPtr model;
public:
{
// Store the pointer to the model
this->model = _parent;

int argc = 0;
char** argv = NULL;
ros::init(argc, argv, "ModelPublisher", ros::init_options::NoSigintHandler | ros::init_options::AnonymousName);
rosnode_ = new ros::NodeHandle("robot/");

// Subscribe
sub_ = rosnode_->subscribe("data", 100, &FlipBook::callback, this);

gazebo::sensors::SensorManager *mgr = gazebo::sensors::SensorManager::Instance();
this->camera=std::static_pointer_cast<gazebo::sensors::CameraSensor>(mgr->GetSensor("my_camera"));
}

void createImage(const std_msgs::Float64MultiArray::ConstPtr& data) {
camera->SaveFrame (std::string("/home/user/catkin_ws/camera/temp.jpg"); // <---- This is used to create the images.
}
// Register this plugin with the simulator
GZ_REGISTER_MODEL_PLUGIN(ModelPush)
}