33 const double angle_max,
34 const double range_min,
35 const double range_max,
37 const std::int32_t status) :
51 if (!read_angle_min(reader)) {
54 if (!read_angle_max(reader)) {
57 if (!read_range_min(reader)) {
60 if (!read_range_max(reader)) {
63 if (!read_scans(reader)) {
66 if (!read_status(reader)) {
85 if (!write_angle_min(writer)) {
88 if (!write_angle_max(writer)) {
91 if (!write_range_min(writer)) {
94 if (!write_range_max(writer)) {
97 if (!write_scans(writer)) {
100 if (!write_status(writer)) {
113 return write(writer);
140 yarp().setOwner(*
this);
166 return obj !=
nullptr;
185 if (group == 0 && is_dirty) {
192 will_set_angle_min();
194 mark_dirty_angle_min();
202 return obj->angle_min;
220 will_set_angle_max();
222 mark_dirty_angle_max();
230 return obj->angle_max;
248 will_set_range_min();
250 mark_dirty_range_min();
258 return obj->range_min;
276 will_set_range_max();
278 mark_dirty_range_max();
286 return obj->range_max;
383 writer.
writeString(
"send: 'help' or 'patch (param1 val1) (param2 val2)'");
398 if (!writer.
writeTag(
"many", 1, 0)) {
406 if (field ==
"angle_min") {
413 if (!writer.
writeString(
"first angle of the scan [deg]")) {
417 if (field ==
"angle_max") {
424 if (!writer.
writeString(
"last angle of the scan [deg]")) {
428 if (field ==
"range_min") {
435 if (!writer.
writeString(
"the minimum distance of the scan [m]")) {
439 if (field ==
"range_max") {
446 if (!writer.
writeString(
"the maximum distance of the scan [m]")) {
450 if (field ==
"scans") {
454 if (!writer.
writeString(
"yarp::sig::Vector scans")) {
457 if (!writer.
writeString(
"the scan data, measured in [m]. The angular increment of each ray is obtained by (angle_max-angle_min)/num_of_elements. Invalid data are represented as std::inf.")) {
461 if (field ==
"status") {
483 bool have_act =
false;
484 if (tag !=
"patch") {
485 if (((len - 1) % 2) != 0) {
488 len = 1 + ((len - 1) / 2);
492 for (
int i = 1; i < len; ++i) {
506 if (key ==
"angle_min") {
507 will_set_angle_min();
508 if (!obj->nested_read_angle_min(reader)) {
512 }
else if (key ==
"angle_max") {
513 will_set_angle_max();
514 if (!obj->nested_read_angle_max(reader)) {
518 }
else if (key ==
"range_min") {
519 will_set_range_min();
520 if (!obj->nested_read_range_min(reader)) {
524 }
else if (key ==
"range_max") {
525 will_set_range_max();
526 if (!obj->nested_read_range_max(reader)) {
530 }
else if (key ==
"scans") {
532 if (!obj->nested_read_scans(reader)) {
536 }
else if (key ==
"status") {
538 if (!obj->nested_read_status(reader)) {
569 if (is_dirty_angle_min) {
579 if (!obj->nested_write_angle_min(writer)) {
583 if (is_dirty_angle_max) {
593 if (!obj->nested_write_angle_max(writer)) {
597 if (is_dirty_range_min) {
607 if (!obj->nested_write_range_min(writer)) {
611 if (is_dirty_range_max) {
621 if (!obj->nested_write_range_max(writer)) {
625 if (is_dirty_scans) {
635 if (!obj->nested_write_scans(writer)) {
639 if (is_dirty_status) {
649 if (!obj->nested_write_status(writer)) {
657 void LaserScan2D::Editor::communicate()
662 if (
yarp().canWrite()) {
669 void LaserScan2D::Editor::mark_dirty()
675 void LaserScan2D::Editor::mark_dirty_angle_min()
677 if (is_dirty_angle_min) {
681 is_dirty_angle_min =
true;
686 void LaserScan2D::Editor::mark_dirty_angle_max()
688 if (is_dirty_angle_max) {
692 is_dirty_angle_max =
true;
697 void LaserScan2D::Editor::mark_dirty_range_min()
699 if (is_dirty_range_min) {
703 is_dirty_range_min =
true;
708 void LaserScan2D::Editor::mark_dirty_range_max()
710 if (is_dirty_range_max) {
714 is_dirty_range_max =
true;
719 void LaserScan2D::Editor::mark_dirty_scans()
721 if (is_dirty_scans) {
725 is_dirty_scans =
true;
730 void LaserScan2D::Editor::mark_dirty_status()
732 if (is_dirty_status) {
736 is_dirty_status =
true;
741 void LaserScan2D::Editor::dirty_flags(
bool flag)
744 is_dirty_angle_min = flag;
745 is_dirty_angle_max = flag;
746 is_dirty_range_min = flag;
747 is_dirty_range_max = flag;
748 is_dirty_scans = flag;
749 is_dirty_status = flag;
750 dirty_count = flag ? 6 : 0;
virtual bool did_set_scans()
void set_scans(const yarp::sig::Vector &scans)
void set_angle_max(const double angle_max)
virtual bool did_set_angle_max()
virtual bool did_set_angle_min()
double get_range_max() const
double get_angle_min() const
void set_angle_min(const double angle_min)
bool edit(LaserScan2D &obj, bool dirty=true)
virtual bool did_set_range_max()
virtual bool did_set_status()
virtual bool will_set_range_min()
virtual bool will_set_angle_max()
double get_angle_max() const
virtual bool will_set_range_max()
double get_range_min() const
std::int32_t get_status() const
virtual bool will_set_scans()
virtual bool will_set_angle_min()
virtual bool did_set_range_min()
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
const yarp::sig::Vector & get_scans() const
virtual bool will_set_status()
void set_status(const std::int32_t status)
void set_range_min(const double range_min)
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
void set_range_max(const double range_max)
yarp::sig::Vector scans
the scan data, measured in [m].
double angle_min
first angle of the scan [deg]
bool write(const yarp::os::idl::WireWriter &writer) const override
double angle_max
last angle of the scan [deg]
double range_min
the minimum distance of the scan [m]
bool read(yarp::os::idl::WireReader &reader) override
double range_max
the maximum distance of the scan [m]
std::string toString() const
A simple collection of objects that can be described and transmitted in a portable way.
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
An interface for reading from a network connection.
An interface for writing to a network connection.
bool setOwner(yarp::os::PortReader &owner)
Set the owner of this WireLink.
yarp::os::WireLink & yarp()
Get YARP state associated with this object.
IDL-friendly connection reader.
bool readNested(WirePortable &obj)
bool readString(std::string &str, bool *is_vocab=nullptr)
bool readI32(std::int32_t &x)
bool read(WirePortable &obj)
bool readFloat64(yarp::conf::float64_t &x)
IDL-friendly connection writer.
bool writeI32(std::int32_t x) const
bool write(const WirePortable &obj) const
bool writeListHeader(int len) const
bool writeTag(const char *tag, int split, int len) const
bool writeFloat64(yarp::conf::float64_t x) const
bool writeString(const std::string &tag) const
bool writeNested(const WirePortable &obj) const
bool writeVocab(std::int32_t x) const
bool isValid()
Check if time is valid (non-zero).
constexpr yarp::conf::vocab32_t createVocab(char a, char b=0, char c=0, char d=0)
The main, catch-all namespace for YARP.