34 const double odom_theta,
35 const double base_vel_x,
36 const double base_vel_y,
37 const double base_vel_theta,
38 const double odom_vel_x,
39 const double odom_vel_y,
40 const double odom_vel_theta) :
44 odom_theta(odom_theta),
45 base_vel_x(base_vel_x),
46 base_vel_y(base_vel_y),
47 base_vel_theta(base_vel_theta),
48 odom_vel_x(odom_vel_x),
49 odom_vel_y(odom_vel_y),
50 odom_vel_theta(odom_vel_theta)
57 if (!read_odom_x(reader)) {
60 if (!read_odom_y(reader)) {
63 if (!read_odom_theta(reader)) {
66 if (!read_base_vel_x(reader)) {
69 if (!read_base_vel_y(reader)) {
72 if (!read_base_vel_theta(reader)) {
75 if (!read_odom_vel_x(reader)) {
78 if (!read_odom_vel_y(reader)) {
81 if (!read_odom_vel_theta(reader)) {
100 if (!write_odom_x(writer)) {
103 if (!write_odom_y(writer)) {
106 if (!write_odom_theta(writer)) {
109 if (!write_base_vel_x(writer)) {
112 if (!write_base_vel_y(writer)) {
115 if (!write_base_vel_theta(writer)) {
118 if (!write_odom_vel_x(writer)) {
121 if (!write_odom_vel_y(writer)) {
124 if (!write_odom_vel_theta(writer)) {
137 return write(writer);
164 yarp().setOwner(*
this);
190 return obj !=
nullptr;
209 if (group == 0 && is_dirty) {
272 will_set_odom_theta();
274 mark_dirty_odom_theta();
276 did_set_odom_theta();
282 return obj->odom_theta;
300 will_set_base_vel_x();
302 mark_dirty_base_vel_x();
304 did_set_base_vel_x();
310 return obj->base_vel_x;
328 will_set_base_vel_y();
330 mark_dirty_base_vel_y();
332 did_set_base_vel_y();
338 return obj->base_vel_y;
356 will_set_base_vel_theta();
358 mark_dirty_base_vel_theta();
360 did_set_base_vel_theta();
366 return obj->base_vel_theta;
384 will_set_odom_vel_x();
386 mark_dirty_odom_vel_x();
388 did_set_odom_vel_x();
394 return obj->odom_vel_x;
412 will_set_odom_vel_y();
414 mark_dirty_odom_vel_y();
416 did_set_odom_vel_y();
422 return obj->odom_vel_y;
440 will_set_odom_vel_theta();
442 mark_dirty_odom_vel_theta();
444 did_set_odom_vel_theta();
450 return obj->odom_vel_theta;
491 writer.
writeString(
"send: 'help' or 'patch (param1 val1) (param2 val2)'");
506 if (!writer.
writeTag(
"many", 1, 0)) {
514 if (field ==
"odom_x") {
521 if (!writer.
writeString(
"position of the robot [m], expressed in the world reference frame")) {
525 if (field ==
"odom_y") {
532 if (!writer.
writeString(
"position of the robot [m], expressed in the world reference frame")) {
536 if (field ==
"odom_theta") {
543 if (!writer.
writeString(
"orientation the robot [deg], expressed in the world reference frame")) {
547 if (field ==
"base_vel_x") {
554 if (!writer.
writeString(
"velocity of the robot [m/s] expressed in the robot reference frame")) {
558 if (field ==
"base_vel_y") {
565 if (!writer.
writeString(
"velocity of the robot [m/s] expressed in the robot reference frame")) {
569 if (field ==
"base_vel_theta") {
573 if (!writer.
writeString(
"double base_vel_theta")) {
576 if (!writer.
writeString(
"angular velocity of the robot [deg/s] expressed in the robot reference frame")) {
580 if (field ==
"odom_vel_x") {
587 if (!writer.
writeString(
"velocity of the robot [m/s] expressed in the world reference frame")) {
591 if (field ==
"odom_vel_y") {
598 if (!writer.
writeString(
"velocity of the robot [m/s] expressed in the world reference frame")) {
602 if (field ==
"odom_vel_theta") {
606 if (!writer.
writeString(
"double odom_vel_theta")) {
609 if (!writer.
writeString(
"angular velocity of the robot [deg/s] expressed in the world reference frame")) {
630 bool have_act =
false;
631 if (tag !=
"patch") {
632 if (((len - 1) % 2) != 0) {
635 len = 1 + ((len - 1) / 2);
639 for (
int i = 1; i < len; ++i) {
653 if (key ==
"odom_x") {
655 if (!obj->nested_read_odom_x(reader)) {
659 }
else if (key ==
"odom_y") {
661 if (!obj->nested_read_odom_y(reader)) {
665 }
else if (key ==
"odom_theta") {
666 will_set_odom_theta();
667 if (!obj->nested_read_odom_theta(reader)) {
670 did_set_odom_theta();
671 }
else if (key ==
"base_vel_x") {
672 will_set_base_vel_x();
673 if (!obj->nested_read_base_vel_x(reader)) {
676 did_set_base_vel_x();
677 }
else if (key ==
"base_vel_y") {
678 will_set_base_vel_y();
679 if (!obj->nested_read_base_vel_y(reader)) {
682 did_set_base_vel_y();
683 }
else if (key ==
"base_vel_theta") {
684 will_set_base_vel_theta();
685 if (!obj->nested_read_base_vel_theta(reader)) {
688 did_set_base_vel_theta();
689 }
else if (key ==
"odom_vel_x") {
690 will_set_odom_vel_x();
691 if (!obj->nested_read_odom_vel_x(reader)) {
694 did_set_odom_vel_x();
695 }
else if (key ==
"odom_vel_y") {
696 will_set_odom_vel_y();
697 if (!obj->nested_read_odom_vel_y(reader)) {
700 did_set_odom_vel_y();
701 }
else if (key ==
"odom_vel_theta") {
702 will_set_odom_vel_theta();
703 if (!obj->nested_read_odom_vel_theta(reader)) {
706 did_set_odom_vel_theta();
734 if (is_dirty_odom_x) {
744 if (!obj->nested_write_odom_x(writer)) {
748 if (is_dirty_odom_y) {
758 if (!obj->nested_write_odom_y(writer)) {
762 if (is_dirty_odom_theta) {
772 if (!obj->nested_write_odom_theta(writer)) {
776 if (is_dirty_base_vel_x) {
786 if (!obj->nested_write_base_vel_x(writer)) {
790 if (is_dirty_base_vel_y) {
800 if (!obj->nested_write_base_vel_y(writer)) {
804 if (is_dirty_base_vel_theta) {
814 if (!obj->nested_write_base_vel_theta(writer)) {
818 if (is_dirty_odom_vel_x) {
828 if (!obj->nested_write_odom_vel_x(writer)) {
832 if (is_dirty_odom_vel_y) {
842 if (!obj->nested_write_odom_vel_y(writer)) {
846 if (is_dirty_odom_vel_theta) {
856 if (!obj->nested_write_odom_vel_theta(writer)) {
864 void OdometryData::Editor::communicate()
869 if (
yarp().canWrite()) {
876 void OdometryData::Editor::mark_dirty()
882 void OdometryData::Editor::mark_dirty_odom_x()
884 if (is_dirty_odom_x) {
888 is_dirty_odom_x =
true;
893 void OdometryData::Editor::mark_dirty_odom_y()
895 if (is_dirty_odom_y) {
899 is_dirty_odom_y =
true;
904 void OdometryData::Editor::mark_dirty_odom_theta()
906 if (is_dirty_odom_theta) {
910 is_dirty_odom_theta =
true;
915 void OdometryData::Editor::mark_dirty_base_vel_x()
917 if (is_dirty_base_vel_x) {
921 is_dirty_base_vel_x =
true;
926 void OdometryData::Editor::mark_dirty_base_vel_y()
928 if (is_dirty_base_vel_y) {
932 is_dirty_base_vel_y =
true;
937 void OdometryData::Editor::mark_dirty_base_vel_theta()
939 if (is_dirty_base_vel_theta) {
943 is_dirty_base_vel_theta =
true;
948 void OdometryData::Editor::mark_dirty_odom_vel_x()
950 if (is_dirty_odom_vel_x) {
954 is_dirty_odom_vel_x =
true;
959 void OdometryData::Editor::mark_dirty_odom_vel_y()
961 if (is_dirty_odom_vel_y) {
965 is_dirty_odom_vel_y =
true;
970 void OdometryData::Editor::mark_dirty_odom_vel_theta()
972 if (is_dirty_odom_vel_theta) {
976 is_dirty_odom_vel_theta =
true;
981 void OdometryData::Editor::dirty_flags(
bool flag)
984 is_dirty_odom_x = flag;
985 is_dirty_odom_y = flag;
986 is_dirty_odom_theta = flag;
987 is_dirty_base_vel_x = flag;
988 is_dirty_base_vel_y = flag;
989 is_dirty_base_vel_theta = flag;
990 is_dirty_odom_vel_x = flag;
991 is_dirty_odom_vel_y = flag;
992 is_dirty_odom_vel_theta = flag;
993 dirty_count = flag ? 9 : 0;
virtual bool did_set_odom_x()
virtual bool did_set_odom_vel_x()
virtual bool will_set_odom_vel_theta()
virtual bool did_set_odom_theta()
virtual bool will_set_base_vel_y()
virtual bool did_set_odom_y()
double get_odom_vel_x() const
void set_odom_theta(const double odom_theta)
double get_odom_vel_y() const
virtual bool did_set_base_vel_x()
double get_base_vel_y() const
virtual bool did_set_odom_vel_theta()
void set_odom_vel_theta(const double odom_vel_theta)
virtual bool will_set_odom_theta()
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
virtual bool will_set_base_vel_x()
void set_odom_x(const double odom_x)
void set_base_vel_theta(const double base_vel_theta)
void set_base_vel_y(const double base_vel_y)
virtual bool will_set_odom_x()
void set_odom_vel_y(const double odom_vel_y)
virtual bool did_set_base_vel_y()
void set_odom_y(const double odom_y)
double get_base_vel_x() const
double get_odom_y() const
void set_odom_vel_x(const double odom_vel_x)
double get_base_vel_theta() const
virtual bool will_set_odom_vel_x()
double get_odom_theta() const
bool edit(OdometryData &obj, bool dirty=true)
double get_odom_vel_theta() const
virtual bool did_set_base_vel_theta()
virtual bool will_set_odom_y()
virtual bool did_set_odom_vel_y()
virtual bool will_set_odom_vel_y()
double get_odom_x() const
void set_base_vel_x(const double base_vel_x)
virtual bool will_set_base_vel_theta()
double base_vel_x
velocity of the robot [m/s] expressed in the robot reference frame
double odom_vel_y
velocity of the robot [m/s] expressed in the world reference frame
double base_vel_theta
angular velocity of the robot [deg/s] expressed in the robot reference frame
double odom_vel_theta
angular velocity of the robot [deg/s] expressed in the world reference frame
double base_vel_y
velocity of the robot [m/s] expressed in the robot reference frame
bool read(yarp::os::idl::WireReader &reader) override
double odom_x
position of the robot [m], expressed in the world reference frame
std::string toString() const
double odom_y
position of the robot [m], expressed in the world reference frame
double odom_theta
orientation the robot [deg], expressed in the world reference frame
double odom_vel_x
velocity of the robot [m/s] expressed in the world reference frame
bool write(const yarp::os::idl::WireWriter &writer) const override
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 readString(std::string &str, bool *is_vocab=nullptr)
bool readFloat64(yarp::conf::float64_t &x)
IDL-friendly connection writer.
bool writeVocab32(yarp::conf::vocab32_t x) 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 isValid()
Check if time is valid (non-zero).
The main, catch-all namespace for YARP.