TypeId
LocationTag::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::LocationTag")
.SetParent<Tag> ()
;
return tid;
}
TypeId
PositionTag::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::PositionTag")
.SetParent<LocationTag> ()
;
return tid;
}
const Vector &
PositionTag::GetPosition () const
{
return m_position; // from MobilityHelper
}
const Vector &
PositionTag::GetSpeed () const
{
return m_velocity; // from ConstantVelovityHelper
}
#include "ns3/tag.h"
#include "ns3/vector.h"
error: ‘m_velocity’ was not declared in this scope
assert failed. cond="m_current + 1 <= m_end", file=./ns3/tag-buffer.h, line=174
terminate called without an active exception
Program received signal SIGABRT, Aborted.
0x00007fffed3f8428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
54 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory
/*
* Location Tag
*/
Ptr<MobilityModel> model = GetNode ()->GetObject<MobilityModel> ();
Vector position;
position = model->GetPosition ();
NS_LOG_INFO ("Sender position is: " << position);
Vector velocity;
velocity = model->GetVelocity();
NS_LOG_INFO ("Snder velocity is: " << velocity);
Time timeNow;
timeNow = Simulator::Now();
NS_LOG_INFO ("Current time is: " << timeNow);
if (model)
{
position = model->GetPosition ();
velocity = model->GetVelocity ();
GeoTag tag;
tag.SetPosition (position);
tag.SetSpeed (velocity);
tag.SetTimestamp(timeNow);
interest->GetPayload()->AddPacketTag (tag);
NS_LOG_INFO ("Consumer adding tag!");
}
LocationTag::GetSerializedSize() const { return 2 * sizeof (double); }
assert failed. cond="tag.GetSerializedSize () <= TagData::MAX_SIZE", file=../src/network/model/packet-tag-list.cc, line=257
terminate called without an active exception
LocationTag::GetSerializedSize() const { return 2 * sizeof (double); }
I updated my tag class to implement velocity and timestamp. The code compiles, but when I try to run the application it crashes with the following message. This is the GDB output, which didn't help me.
assert failed. cond="m_current + 1 <= m_end", file=./ns3/tag-buffer.h, line=174
terminate called without an active exception
Program received signal SIGABRT, Aborted.
0x00007fffed3f8428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/rai se.c:54
54 ../sysdeps/unix/sysv/linux/rai se.c: No such file or directory
The complete tag files are attached.
My application calls
/*
* Location Tag
*/
Ptr<MobilityModel> model = GetNode ()->GetObject<MobilityModel> ();
Vector position;
position = model->GetPosition ();
NS_LOG_INFO ("Sender position is: " << position);
Vector velocity;
velocity = model->GetVelocity();
NS_LOG_INFO ("Snder velocity is: " << velocity);
Time timeNow;
timeNow = Simulator::Now();
NS_LOG_INFO ("Current time is: " << timeNow);
if (model)
{
position = model->GetPosition ();
velocity = model->GetVelocity ();
GeoTag tag;
tag.SetPosition (position);
tag.SetSpeed (velocity);
tag.SetTimestamp(timeNow);
interest->GetPayload()->AddPac ketTag (tag);
To unsubscribe from this group and all its topics, send an email to ns-3-users+unsubscribe@googlegroups.com.
Hi Konstantinos,Thank you for your reply.
I changed the buffer size to 4, but got an error.
assert failed. cond="tag.GetSerializedSize () <= TagData::MAX_SIZE", file=../src/network/model/ packet-tag-list.cc, line=257
To unsubscribe from this group and all its topics, send an email to ns-3-users+unsubscribe@googlegroups.com.