|
@@ -97,7 +97,7 @@ std::shared_ptr<monkey_bus> monkey_person::getBus()
|
|
|
{
|
|
|
return m_bus.lock();
|
|
|
}
|
|
|
-point_2 monkey_person::get_position()
|
|
|
+point_2 monkey_person::get_position(double &speedx)
|
|
|
{
|
|
|
uint64_t timeval = tool_time::now_to_ms();
|
|
|
if (m_bus.expired() || m_cur_distance == 0x12345678)
|
|
@@ -122,11 +122,13 @@ point_2 monkey_person::get_position()
|
|
|
//get time val
|
|
|
double val = 1.*(timeval - m_timeval)/1000;
|
|
|
//get Distance
|
|
|
- double ds = tbus->getNextStep_Distance(val)/m_area.lock()->getScale();
|
|
|
+ double scale=m_area.lock()->getScale();
|
|
|
+ double ds = tbus->getNextStep_Distance(val)/scale;
|
|
|
m_cur_distance += ds;
|
|
|
//compensation speed...
|
|
|
m_cur_distance += m_compensation_speed * val;
|
|
|
double total_length = m_area.lock()->get_total_length();
|
|
|
+ speedx=(tbus->m_speed+m_compensation_speed*scale)*3.6;
|
|
|
if (m_cur_distance < ZERO_)
|
|
|
{
|
|
|
m_cur_distance = 0;
|
|
@@ -134,6 +136,7 @@ point_2 monkey_person::get_position()
|
|
|
else if (m_cur_distance >=total_length)
|
|
|
{
|
|
|
m_cur_distance = total_length;
|
|
|
+ speedx=0;
|
|
|
}
|
|
|
//get point
|
|
|
point_2 tmp = m_area.lock()->map(m_cur_distance);
|