|
3.31 PenDerived from Solid.
3.31.1 DescriptionThe Pen node models a pen attached to a mobile robot, typically used to show the trajectory of the robot. In order to work, a pen needs to be over a textured floor. Such a textured floor should be made up of a Solid node containing a Shape with a textured Material in its Appearance. Additionally, its geometry should be a rectangular IndexedFaceSet located at y=0. An example of an appropriate textured floor used with a robot equipped with a pen is given in the botstudio_pen.wbt example world (located in the projects/robots/hemisson/worlds directory of Webots). Note: The drawings performed by a pen can be seen by infra-red distance sensors looking down at the ground. Hence, it is possible to implement a robotics experiment where a robot draws a line on the floor with a pen and a second robot performs a line following behavior with the line drawn by the first robot. Note: The pen drawing will not be seen by Camera devices when the camera windows are displayed outside of Webots' main window. However, the pen drawing will be correctly perceived by Camera devices rendered inside Webots' main window. Please find more information on the two different camera behaviors in the Camera section. 3.31.2 Field Summary
3.31.3 Pen FunctionsNAMEwb_pen_write - enable or disable pen writingC SYNOPSIS#include <webots/pen.h>void wb_pen_write(WbDeviceTag pen, bool write); C++ SYNOPSIS#include <webots/Pen.hpp>void Pen::write(bool write); JAVA SYNOPSISimport com.cyberbotics.webots.controller.Pen;void Pen.write(boolean write); PYTHON SYNOPSISfrom controller import Pennone Pen.write(bool write) DESCRIPTIONwb_pen_write() allows the user to switch a pen device on or off to disable or enable writing. If the write parameter is true, the specified pen device will write; if write is false, it won't. NAMEwb_pen_set_ink_color - change the color of a pen's inkC SYNOPSIS#include <webots/pen.h>void pen_set_ink_color(WbDeviceTag pen, int color, double density); C++ SYNOPSIS#include <webots/Pen.hpp>void Pen::setInkColor(int color, double density); JAVA SYNOPSISimport com.cyberbotics.webots.controller.Pen;void Pen.setInkColor(int color, double density); PYTHON SYNOPSISfrom controller import Pennone Pen.setInkColor(int color, float density) DESCRIPTIONwb_pen_set_ink_color() changes the current ink color of the specified pen device. The color is a 32 bit integer value which defines the new color of the ink in the 0xRRGGBB hexadecimal format (i.e., 0x000000 is black, 0xFF0000 is red, 0x00FF00 is green, 0x0000FF is green, 0xF0A040 is orange, 0X808080 is grey 0xFFFFFF is white, etc.). The density parameter defines the ink density, with 0 meaning transparent ink and 1 meaning completely opaque ink. EXAMPLE
The above statement will change the ink color of the indicated pen to some red color. ![]() ^ page top ^ |
| E-mail to webmaster | Last updated: | Copyright © 2008 Cyberbotics Ltd. |