【Nao V6】Representation——写逻辑常用的

前言

记录写逻辑时常用的representations
角度默认弧度制,逆时针增加。时间默认ms,长度默认mm。
机器人坐标系为右手坐标系,即上为z轴正方向,前为x轴正方向,左边为y轴正方向。

正文

pose2f

记录平面坐标和旋转角度

  (Angle)(0) rotation,
  (Vector2f)(Vector2f::Zero()) translation,
robotpose

记录了机器人的世界坐标
继承了pose2f,此外还有:

  Pose2f inversePose,
  (float)(0) validity,                            /**< The validity of the robot pose. (0 = invalid, 1 = perfect) */
  (unsigned)(0) timeOfLastConsideredFieldFeature, /**< Additional information about how good this pose might be */
  (float)(unknownDeviation) deviation,            /**< The deviation of the robot pose. */
  (Matrix3f)(Matrix3f::Identity()) covariance,    /**< The covariance matrix of the estimated robot pose. */
  (unsigned)(0) timestampLastJump,                /**< Timestamp of last "big change" (jump) notificaion */

正朝敌方球门为0度。中线为(0,0)点
inversePose *世界坐标 = 自身坐标系下的相对坐标

BallModel

之前先定义了BallState,包括相对位置坐标、速度、角度(一直是0)、半径(一直是50):

  (Vector2f)(Vector2f::Zero()) position,      /**< The position of the ball relative to the robot (in mm)*/
  (Vector2f)(Vector2f::Zero()) velocity,      /**< The velocity of the ball relative to the robot (in mm/s)*/
  (float)(0) rotation,                        /**< The rotation of the ball (in rad/s)*/
  (float)(50) radius,                         /**< The assumed radius of the ball (in mm)*/
  (Matrix2f)(Matrix2f::Identity()) covariance, /**< The covariance matrix of the ball*/

然后有BallModel,包括上一次看到的相对位置(正常情况下与estimate的位置一样)、上一次看到的时间等。

  (Vector2f)(Vector2f::Zero()) lastPerception, /**< The last seen position of the ball */
  (BallState) estimate, /**< The state of the ball estimated from own observations; it is propagated even if the ball is not seen */
  (unsigned)(0) timeWhenLastSeen, /**< Time stamp, indicating what its name says */
  (unsigned)(0) timeWhenDisappeared, /**< The time when the ball was not seen in the image altough it should have been there */
  (unsigned char)(0) seenPercentage, /**< How often was the ball seen in the recent past (0%...100%). */

BallModel缺少球的世界坐标,不利于队伍之间的通信

TeamBallModel
  ENUM(Contributors,
  {,
    onlyMe,         /**< This is just my own ball model. Go, team, go ??!!? :-( */
    oneOther,       /**< The ball model of one other robot was used. */
    multipleOthers, /**< The ball models of multiple other robots have been combined. */
    meAndOthers,    /**< My ball was combined which the ball model(s) of others. Teamwork! :-) */
  });
  (Vector2f) position,                         /**< The position of the ball in global field coordinates (in mm) */
  (Vector2f) velocity,                         /**< The velocity of the ball in global field coordinates (in mm/s) */
  (bool)(false) isValid,                       /**< Position and velocity are valid (i.e. somebody has seen the ball), if true */
  (unsigned)(0) timeWhenLastValid,             /**< Workaround by Andreas St. -> Tim L. suggests to remove it */
  (unsigned)(0) timeWhenLastSeen,              /**< The point of time when the ball was seen the last time by a teammate */
  (Contributors)(onlyMe) contributors,         /**< Information about which robot(s) contributed to the computation of this model */
  (std::vector<Vector2f>) balls,               /**< List of all merged ball positions */

TeamBallModel 没有球的相对坐标

FieldBall

在这里插入图片描述
从图中可以看到,FieldBall 综合了所有有关球的信息,写逻辑一般直接用这个,所以注意力要放在这里:

 (Vector2f)(Vector2f::Zero()) positionOnField,           /**< The ball position in global field coordinates */
  (Vector2f)(Vector2f::Zero()) positionRelative,          /**< The ball position in relative robot coordinates */
  (Vector2f)(Vector2f::Zero()) positionOnFieldClipped,    /**< The ball position in global field coordinates, clipped to the area defined by the outer lines */
  (Vector2f)(Vector2f::Zero()) positionRelativeClipped,   /**< The ball position in relative robot coordinates, clipped to the area defined by the outer lines */
  (Vector2f)(Vector2f::Zero()) endPositionOnField,        /**< The ball end position (i.e. where it comes to a stop) in global field coordinates */
  (Vector2f)(Vector2f::Zero()) endPositionRelative,       /**< The ball end position (i.e. where it comes to a stop) in relative robot coordinates */
  (Vector2f)(Vector2f::Zero()) teamPositionOnField,       /**< The ball position in global field coordinates, as estimated by the whole team */
  (Vector2f)(Vector2f::Zero()) teamPositionRelative,      /**< The ball position in relative robot coordinates, as estimated by the whole team */
  (Vector2f)(Vector2f::Zero()) teamEndPositionOnField,    /**< The ball end position (i.e. where it comes to a stop) in global field coordinates, as estimated by the whole team */
  (Vector2f)(Vector2f::Zero()) teamEndPositionRelative,   /**< The ball end position (i.e. where it comes to a stop) in relative robot coordinates, as estimated by the whole team */
  (int)(0) timeSinceBallWasSeen,                          /**< Yes, you guessed it */
  (int)(0) timeSinceBallDisappeared,                      /**< Yes, you guessed it */
  (int)(0) timeSinceTeamBallWasValid,                     /**< Yes, you guessed it */
  (bool)(false) isRollingTowardsOpponentGoal,             /**< Yes, you guessed it */
  (bool)(false) isRollingTowardsOwnGoal,                  /**< Yes, you guessed it */
  (bool)(false) isInsideOwnPenaltyArea,                   /**< Yes, you guessed it */
  (float)(0.f) distanceToOwnPenaltyArea,                  /**< Yes, you guessed it. If the ball is inside the area, member is set to 0.f. If the position is unknown, member is set to -1.f.*/
  (Vector2f)(Vector2f::Zero()) intersectionPositionWithOwnYAxis,          /**< The position (in local coordinates) at which a rolling ball will pass the robot. Vector2f::Zero(), if this will not happen. */
  (float)(std::numeric_limits<float>::max()) timeUntilIntersectsOwnYAxis, /**< The time until a rolling ball will pass the robot. float::max, if this will not happen. */

提几个数据吧,positionOnFieldClipped一旦超过边界,出界的轴的坐标就显示为极值不变了。endPositionOnField是对滚动的球最终位置的预估,当球静止时就和positionOnField一样。distanceToOwnPenaltyArea根据x和y综合计算的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值