Error Help Request

Greetings,

So I have a method that I am working with called CanTranslateTo which tells a robot instance whether or not it can translate to a given coordinate. For our purposes, if the robot's speed is greater than or equal to the distance that it needs to translate then it can and should return true.

I am receiving an error that I cannot seem to crack, which is as follows:

ERROR: conversion from 'const csce240::Coordinate' to non-scalar type 'csce240::two_dim::Point' requested two_dim::Point p = *goal;
//first line of CanTranslateTo()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//  .cc
bool MobileRobot::CanTranslateTo(const Coordinate* goal) const{
  two_dim::Point p = *goal;
  
  two_dim::Vector distance = p.(this->location_);
  
  // If the distance is equal to zero, return true
  if(floating_point::Equals(distance.GetLength(), this->location_){
    return true;
  }

  // If the distance is greater than speed, return flase
  if(this->speed_ < distance){
    return false;
  }

  // If the distance is less than speed, return true
  if(this->speed_ > distance){
    return true;
  }
  
  return false;
}

// .h
class MobileRobot{
  public:
    virtual bool CanTranslateTo(const Coordinate* goal) const = 0;
  
  protected:
    double speed_;
    Coordinate *location_;
}
How would you create a two_dim::Point copy from a Coordinate? You do attempt that on line 3.
Topic archived. No new replies allowed.