30 const double angle_max,
31 const double range_min,
32 const double range_max,
34 const std::int32_t status) :
48 if (!read_angle_min(reader)) {
51 if (!read_angle_max(reader)) {
54 if (!read_range_min(reader)) {
57 if (!read_range_max(reader)) {
60 if (!read_scans(reader)) {
63 if (!read_status(reader)) {
82 if (!write_angle_min(writer)) {
85 if (!write_angle_max(writer)) {
88 if (!write_range_min(writer)) {
91 if (!write_range_max(writer)) {
94 if (!write_scans(writer)) {
97 if (!write_status(writer)) {
110 return write(writer);
137 yarp().setOwner(*
this);
163 return obj !=
nullptr;
182 if (group == 0 && is_dirty) {
189 will_set_angle_min();
191 mark_dirty_angle_min();
199 return obj->angle_min;
217 will_set_angle_max();
219 mark_dirty_angle_max();
227 return obj->angle_max;
245 will_set_range_min();
247 mark_dirty_range_min();
255 return obj->range_min;
273 will_set_range_max();
275 mark_dirty_range_max();
283 return obj->range_max;
380 writer.
writeString(
"send: 'help' or 'patch (param1 val1) (param2 val2)'");
395 if (!writer.
writeTag(
"many", 1, 0)) {
403 if (field ==
"angle_min") {
410 if (!writer.
writeString(
"first angle of the scan [deg]")) {
414 if (field ==
"angle_max") {
421 if (!writer.
writeString(
"last angle of the scan [deg]")) {
425 if (field ==
"range_min") {
432 if (!writer.
writeString(
"the minimum distance of the scan [m]")) {
436 if (field ==
"range_max") {
443 if (!writer.
writeString(
"the maximum distance of the scan [m]")) {
447 if (field ==
"scans") {
451 if (!writer.
writeString(
"yarp::sig::Vector scans")) {
454 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.")) {
458 if (field ==
"status") {
480 bool have_act =
false;
481 if (tag !=
"patch") {
482 if (((len - 1) % 2) != 0) {
485 len = 1 + ((len - 1) / 2);
489 for (
int i = 1; i < len; ++i) {
503 if (key ==
"angle_min") {
504 will_set_angle_min();
505 if (!obj->nested_read_angle_min(reader)) {
509 }
else if (key ==
"angle_max") {
510 will_set_angle_max();
511 if (!obj->nested_read_angle_max(reader)) {
515 }
else if (key ==
"range_min") {
516 will_set_range_min();
517 if (!obj->nested_read_range_min(reader)) {
521 }
else if (key ==
"range_max") {
522 will_set_range_max();
523 if (!obj->nested_read_range_max(reader)) {
527 }
else if (key ==
"scans") {
529 if (!obj->nested_read_scans(reader)) {
533 }
else if (key ==
"status") {
535 if (!obj->nested_read_status(reader)) {
566 if (is_dirty_angle_min) {
576 if (!obj->nested_write_angle_min(writer)) {
580 if (is_dirty_angle_max) {
590 if (!obj->nested_write_angle_max(writer)) {
594 if (is_dirty_range_min) {
604 if (!obj->nested_write_range_min(writer)) {
608 if (is_dirty_range_max) {
618 if (!obj->nested_write_range_max(writer)) {
622 if (is_dirty_scans) {
632 if (!obj->nested_write_scans(writer)) {
636 if (is_dirty_status) {
646 if (!obj->nested_write_status(writer)) {
654 void LaserScan2D::Editor::communicate()
659 if (
yarp().canWrite()) {
666 void LaserScan2D::Editor::mark_dirty()
672 void LaserScan2D::Editor::mark_dirty_angle_min()
674 if (is_dirty_angle_min) {
678 is_dirty_angle_min =
true;
683 void LaserScan2D::Editor::mark_dirty_angle_max()
685 if (is_dirty_angle_max) {
689 is_dirty_angle_max =
true;
694 void LaserScan2D::Editor::mark_dirty_range_min()
696 if (is_dirty_range_min) {
700 is_dirty_range_min =
true;
705 void LaserScan2D::Editor::mark_dirty_range_max()
707 if (is_dirty_range_max) {
711 is_dirty_range_max =
true;
716 void LaserScan2D::Editor::mark_dirty_scans()
718 if (is_dirty_scans) {
722 is_dirty_scans =
true;
727 void LaserScan2D::Editor::mark_dirty_status()
729 if (is_dirty_status) {
733 is_dirty_status =
true;
738 void LaserScan2D::Editor::dirty_flags(
bool flag)
741 is_dirty_angle_min = flag;
742 is_dirty_angle_max = flag;
743 is_dirty_range_min = flag;
744 is_dirty_range_max = flag;
745 is_dirty_scans = flag;
746 is_dirty_status = flag;
747 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 writeVocab32(yarp::conf::vocab32_t x) const
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 isValid()
Check if time is valid (non-zero).
The main, catch-all namespace for YARP.